Var som am33 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 ~/varsomam33
$ cd ~/varsomam33
$ 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¶
Cleaning the Kernel Sources¶
Prior to compiling the Linux kernel make sure that the kernel sources are clean.
**NOTE:**The next step will delete any saved .config file in the kernel tree as well as the generated object files. If you have done a previous configuration and do not wish to lose your configuration file you should save a copy of the configuration file before proceeding.
The command to clean the kernel is:
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-AM33:
Customizing the Configuration¶
For configuring the kernel run:
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:
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:
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-AM33 device tree¶
To build the VAR-SOM-AM33 device tree (dtb image), please use the following command line:
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-am33.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