Compiling Linux Kernel 3.10 for Acqua A5 SoM

This article illustrates how to generate a bootable Linux Kernel image for the Acqua A5 SoM based on Atmel SAMA5D53x MPU.

Hardware requirements:

Software requirements

Step-by-step Kernel cross-compilation procedure:

Download from the Atmel GitHub repository the patched Linux Kernel sources for SAMA5D3x:

Extract the Kernel sources from the compressed file by typing:

~$ unzip
~$ mv linux-at91-linux-3.10-at91 linux-3.10-acqua

Move inside the new folder:

~$ cd linux-3.10-acqua

At this point I suggest to create a your own personal branch on Linux Kernel sources to keep a trace of any changes from the Kernel mainline using git.

Apply the patches for Acqua A5 module

Download the patch file:

and apply it:

~/linux-3.10-acqua$ patch -p1 < acme.patch

Download the device tree file for the LCD you are using:

and save it in arch/arm/boot/dts.

Download the default Kernel config and save it in arch/arm/configs.

Set the basic Kernel configuration

~/linux-3.10-acqua1$ make ARCH=arm acme-acqua_defconfig
# configuration written to .config

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-3.10-acqua$ make ARCH=arm menuconfig

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

Compile the Device Tree Blob file

Compile the device tree file source to generate the file .dtb.

For the LCD 4.3 inch for example use this line:

~/linux-3.10-acqua$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- acme-acqua_lcd_43.dtb
DTC     arch/arm/boot/dts/acme-acqua_lcd_43.dtb

Compile the Kernel image

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

~/linux-3.10-acqua$ make -j8 ARCH=arm  CROSS_COMPILE=arm-linux-gnueabi- zImage
Kernel: arch/arm/boot/zImage is ready

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

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-3.10-acqua$ make modules -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
~/linux-3.10-acqua$ make modules_install INSTALL_MOD_PATH=./modules ARCH=arm

Copy the boot files into the first microSD partition

Method 1 - Direct write on microSD

Insert a formatted microSD in your Linux PC and copy on it the files directly:

Write the Linux Kernel image and Device tree blog files in the first microSD partition:

~/linux-3.10-acqua$ cp arch/arm/boot/dts/acme-acqua_lcd_43.dtb /media/$USER/KERNEL/at91-sama5d3_acqua.dtb
~/linux-3.10-acqua$ cp arch/arm/boot/zImage /media/$USER/KERNEL

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

Write the Kernel modules in the rootfs (second microSD partition):

~/linux-3.10-acqua$ sudo rsync -avc modules/lib/. /media/$USER/rootfs/lib/.

Method 2 - Remote writing via ssh

Use this method if you have a working board accessible via LAN

Write the Linux Kernel image and Device tree blog files in the first microSD partition:

~/linux-3.10-acqua$ scp arch/arm/boot/dts/acme-acqua_lcd_43.dtb root@acqua-ip-address:/boot/at91-sama5d3_acqua.dtb
~/linux-3.10-acqua$ scp arch/arm/boot/zImage root@acqua-ip-address:/boot

Write the Kernel modules in the rootfs (second microSD partition):

~/linux-3.10-acqua$ rsync -avc modules/lib/. root@acqua-ip-address:/lib/.

If this command doesn't work verify if rsync in installed on your board. Use apt-get install rsync.

After the first boot

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

~# depmod -a

Create the rootfs contents

Related links