Mu-arm

From Bashlinux
Revision as of 15:44, 4 June 2012 by (talk)
Jump to: navigation, search

ARM Microcontroller

Mini 2440

How to build the kernel

To get running the kernel, we need to setup the environment with the proper toolchain so we can start to cross-compile the kernel.

GNU ARM Toolchain

  • Download arm-none-linux-gnueabi from sourcery.mentor.com or the manufacturer website
  • Decompress the tarball and place in `~/CROSS_COMPILER`
  • Add the path to your environment by editing `~/.bash_profile` and adding
 PATH=$PATH:$HOME/bin:~/CROSS_COMPILER/arm/4.4.3/bin
 


Build the kernel

  • Download the kernel from kernel.org
  • Create a working directory and decompress the kernel inside there
 # mkdir kernel
 # cd kernel
 # wget http://mirrors.kernel.org/...linux-2.6.36...
 # tar zxvf linux-2.6.36*tgz
 # mkdir kernel-bin
 # cd linux-2.6.36
 


  • Generate `.config`
 CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig
 


  • Modify the kernel
 # cd ../kernel-bin
 # make ARCH=arm menuconfig
 # cd ../mini2440
 


  • Cross compile the kernel and modules
 CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/
 


  • If using uboot, then generate uImage
 # ../uboot/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage ../uImage
 


=== Kernel Modules ===
  • Build the modules that are going to be placed into the filesystem
 CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ modules
 CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ INSTALL_MOD_PATH=.. modules_install
 


  • Mount the FS image and copy the files inside the root folder
 # cp ../lib/modules/2.6.36/ /mnt/mini2440/rootfs/lib/modules/ -r
 


=== uboot ===
  • Get the sources from git repository
 # mkdir uboot
 # cd uboot
 # git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
 


  • Prepare and build uboot
 # cd mini2440
 # make mini2440_config
 # make all