Compiling Linux Kernel 2.6.38 for FOX Board G20 and Netus G20

This article illustrates how get and patch the Linux Kernel version 2.6.38 sources and generate a working binary image bootable from the FOX Board G20.

Requirements

Download the source tree without revision history

This is the faster way to download the already patched sources without the whole Linux commit history:

Download the source tree with the complete revision history

This is the slowest way to download the sources because it includes the whole Linux commit history and each patch applied by Acme. To follow this way you have to install Git on your Linux PC.

Open a terminal session and type:

$ git clone git://github.com/tanzilli/foxg20-linux-2.6.38.git
...
$ cd foxg20-linux-2.6.38

Using gitk take a look to the patches applied by Acme Systems on the Linux Kernel Vanilla 2.6.38 to obtain a working image for the FOX Board G20 by typing:

$ gitk

You can see all the commit also via web on https://github.com/tanzilli/foxg20-linux-2.6.38/commits/acme-2.6.38.

Configuring your Kernel

Set the default Kernel configuration used by Acme to generate its default bootable microSD.

$ make foxg20_defconfig

Access the Kernel configuration and make your changes (if you have any changes to make) typing:

$ make menuconfig

Kernel compilation

To launch the Kernel compilation type:

$ make -j8
...

The j8 option is to build the kernel in a multithreaded way.

"It is best to give a number to the -j option that corresponds to twice the number of processors in the system". (From pag.26 of Linux in a Nutshell by Greg Kroah-Hartman)

When finished you will find a new uImage file containing the bootable Kernel image in binary format. This file has to be copied on the first FAT16 partition of your microSD card as described next.

Place the new Kernel image on the bootable microSD: Method 1

  • Insert the FOX microSD card on your Linux PC
  • once /media/kernel folder copy on ite the file uImage
  • copy your module tree from ./foxg20-modules/lib to /media/rootfs/lib
  • unmount /media/kernel and /media/rootfs
  • transfer the microSD card back to your FOX Board G20
  • start your FOX Board G20 to see your new kernel in action!
  • don't forget to type the command depmod -a on the FOX Board command line to build the modules dependencies files

Place the new Kernel image on the bootable microSD: Method 2

If you have a FOX Board already running you can store the Kernel image on the bootable micro SD remotely by following this article: How to update the kernel uImage remotely.

Kernel modules compilation

To compile the Kernel modules type:

$ make modules -j8
$ make modules_install

Note that modules are not installed but copied to the foxg20-modules sub-directory. If you don't want old modules you've built before, instead of that last line do:

$ rm -rf ./foxg20-modules
$ make modules_install

Install the modules inside the FOX Board

Copy your module tree from your build machine's foxg20-modules/lib to the FOX Board G20 rootfs:

$ rsync -avc foxg20-modules/lib/. root@192.168.1.90:/lib/.

If this doesn't work install rsync on the FOX with the command:

$ apt-get install rsync

Back to the FOX Board G20 terminal and update the module dependencies:

$ depmod -a

Finally reboot the FOX Board G20 to load the new Kernel.