VAR-SOM-AM43 Yocto Krogoth Build Linux out of tree
Downloading source code
- Linux kernel sources are located in: https://github.com/varigit/VAR-SOM-AMx3-Kernel-4-x
- Kernel is based on TI :https://git.ti.com/ti-linux-kernel/ti-linux-kernel/commits/linux-4.4.y
First, clone the git repository to a local directory, as follows:
$ mkdir ~/varsomam43 $ cd ~/varsomam43 $ git clone https://github.com/varigit/VAR-SOM-AMx3-Kernel-4-x.git $ cd VAR-SOM-AMx3-Kernel-4-x $ git checkout var-som-AMx3-sdk-linux-03.01.00
Setup Toolchain path
$ export PATH=/opt/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf/bin:$PATH
Cleaning the Kernel Sources
Prior to compiling the Linux kernel make sure that the kernel sources are clean.
The command to clean the kernel is:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
Configuring the Kernel
Before compiling the Linux kernel it needs to be configured to select which components will become part of the kernel image:
Using Default Configurations
To build the defualt configuration for the VAR-SOM-AM43:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am437x_defconfig
Customizing the Configuration
For configuring the kernel run:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
Once the configuration window is open you can select which kernel components will be included in the build. Exiting the configuration will save your selections to a file in the root of the kernel tree called .config.
Compiling the Kernel
Once the kernel has been configured compile kernel:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage LOADADDR=0x80200000
This will result in a kernel image file being created in the arch/arm/boot/ directory called zImage. This file can be used by u-boot to boot your device.
If you selected any components of the kernel to be built as dynamic modules you must issue an additional command to compile those modules. The command is:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
This will result in .ko (kernel object) files being placed in the kernel tree. These .ko files are the dynamic kernel modules. The next section will cover how to install these modules.
Building the VAR-SOM-AM43 device tree
To build the VAR-SOM-AM43 device tree (dtb image), please use the following command line:
for Ethernet + Wifi SOMs $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43.dtb for dual Ethernet SOMs: $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43-eth1.dtb
The dtb images will be located in: arch/arm/boot/dts/
Replace bootable SD-Card's kernel
In order to install the newly created kernel to the SD-Card, please follow the instructions below:
1) Plug in the bootable SD-Card created above to a Linux host PC
2) Mount the second partition, which holds the system's file system as /media/rootfs.
3) Install by executing the following commands:
$ sudo cp arch/arm/boot/zImage /media/rootfs/boot $ sudo cp arch/arm/boot/dts/var-som-am43.dtb /media/rootfs/boot $ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=/media/rootfs $ sync $ sudo umount /media/boot $ sudo umount /media/rootfs $ sudo umount /media/user