Monday, March 7, 2011

Kernel Compilation For ARM

Hi,
Since I am trying to make an initramfs for my ARM board, I have to make modules for my hardware before doing anythings. For making modules, you have to compile the kernel. Here is a short explanation about how to compile the kernel for an ARM-based architecture and how to make modules. 
  1. First, download a source code. Here is a list of source code: Source code for kernels. I downloaded linux-2.6.28.1 because I want to add a newer version in my project. You can grab the last version.
  2. Extract compress file, for example, tar xjvf linux-2.6.28.1.tar.bz2 in my case
  3. Change to new directory like: cd linux-2.6.28
  4. Edit the Makefile and  change to the following:   ARCH ?= arm and CROSS_COMPILE ?= arm5tel-redhat-linux-gnueabi-  
  5. To allow a set of defaults to be selected for the particular machine that you are compiling the source for, you should find the proper confing file in arch/arm/configs/ directory. In my case, the proper file is arch/arm/configs/omap3_beagle_defconfig. Then you should run the following make command:    make omap3_beagle_defconfig
  6. After that, use make gconfig to open up the GUI configuration. This is a very useful command that you can customize everything, for example, you can choose to install a specific driver or ipv6 or so many other things.
  7. Compile the kernel source by following commands: 1) make clean 2)make ARCH=arm CROSS_COMPILE=/usr/armv5tel-redhat-linux-gnueabi/bin/ zImage      The zImage in a compress file. you can use uImage instead if you do not want to compress the kernel. In my case, the path to compiler was /usr/armv5tel-redhat-linux-gnueabi/bin/ . You should find the proper address in your case.
  8. Finally, to make the modules, you should use the following command: make modules_install INSTALL_MOD_PATH=/tmp/arm-modules    This can be any path in your choice.I will use these modules later for making iniramfs. 
In my next blog, I will talk about initramfs and how to install an initramfs on Fedora-ARM based kernel in an ARM board.

Regards,
Khosro Taraghi

1 comment:

  1. I wonder how to make initramfs?
    Sincere thanks,
    Jack

    ReplyDelete