Compiling Linux Kernel 3.12.x

This article illustrates how to generate a bootable class='acmetable' Linux Kernel image for Aria G25

What do you need:

Hardware required:

Software toolchain to install on your Linux PC:

Kernel sources:

Download and save in your home directory the Linux Kernel sources you need from this page:

Select the [tar.xz] format.

Kernel source cross-compilation step by step:

Untar the Kernel sources by typing:

~$ tar xvfJ linux-x.xx.x.tar.xz
...

Changing of course the x.xx.x part with the release version :-)

Move inside the just created folder:

~$ cd linux-x.xx.x
~/linux-x.xx.x$

Download the default Kernel configuration file

Download our basic configuration file. It contains a basic set of kernel drivers and features to get starting. Select the file for your board and save it into arch/arm/configs:

Now create the .config working file by typing:

~/linux-3.xx.x$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- at91-ariag25_defconfig
...
#
# configuration written to .config
#

A file called .config is created inside the Linux sources root directory. All the changes you will do using make menuconfig will be saved on this file so, if you want to create your own default kernel configuration, simple copy the new .config you obtain file in arch/arm/configs with a custom name like at91-myconfiguration.

Download e generate the device tree file

"The Device Tree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspect of the hardware can be described in a data structure that is passed to the operating system at boot time."

When you compile a Device Tree File (.dts) you will obtain a Device Three Blob file (.dtb) to save in the first partition of your bootable class='acmetable' microSD card together with Linux Kernel image.

Download and save our basic Device Tree Source file for your board in arch/arm/boot/dts:

Generate the Device Tree Blob file by typing:

~/linux-x.xx.x$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- at91-ariag25.dtb
...

Customize the default Linux Kernel configuration:

If you need to customize the Kernel configuration or just taking a look to the drivers and features activated type:

~/linux-x.xx.x$ make ARCH=arm menuconfig

and navigate inside the Kernel configuration using the arrow keys and following the help provided by the menuconfig interface.

Kernel compilation

To compile the Linux Kernel sources and generate a binary image file to place in your bootable class='acmetable' microSD card type:

~/linux-x.xx.x$ make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
...
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-x.xx.x
Created:      ...
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    ...
Load Address: 20008000
Entry Point:  20008000
  Image arch/arm/boot/uImage is ready

On a mid-power PC the whole source compilation requires about 5 minutes.

Copying the binary files generated in the bootable class='acmetable' microSD

Copy on a bootable class='acmetable' and formatted microSD the Linux uImage file renaming it in image.bin and the Device Tree Blog file at91-ariag25.dtb in the first FAT32 partition:

~/linux-x.xx.x$ cp arch/arm/boot/dts/at91-ariag25.dtb /media/$USER/KERNEL/at91-ariag25.dtb
~/linux-x.xx.x$ cp arch/arm/boot/uImage /media/$USER/KERNEL/image.bin

If you are using an Ubuntu release older than 13.10 remove $USER in the path

Compile the Kernel modules

The image generated contains the Linux Kernel and all the built-in device drivers (option [*] in menuconfig) compiled with it.

Al the drivers compiled as external modules (option [M] in menuconfig) need to be compiled and saved in the rootfs /lib directory on the second partition of the microSD. To compile them type:

~/linux-x.xx.x$ make modules -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
...
~/linux-x.xx.x$ make modules_install INSTALL_MOD_PATH=./modules ARCH=arm
...

Copy the kernel modules on the microSD:

~/linux-x.xx.x$ sudo rsync -avc modules/lib/. /media/$USER/rootfs/lib/.

At the first access to the board command line update the module dependencies by typing this command:

~# depmod -a

rootfs contents

Use the new Kernel with Aria R5 microSD contents (Debian 6.0 Lenny)

To use the current Aria R5 rootfs contents with this Kernel version simply change these files:

In /etc/fstab changes:

proc /proc proc none 0 0

in

proc /proc proc defaults 0 0

In /etc/network/interfaces add after the lines:

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

the line:

hwaddress ether 00:01:04:1b:2C:1F

Using the MAC address you want to set for the Aria G25 ethernet port.

Use the new Kernel with EmDebian 7.2 Wheezy Grip

Follow this article:

Related links