VAR-SOM-AM33 Yocto Fido R1 Build Linux out of tree: Difference between revisions

From Variscite Wiki
(Fixed Toolchain path)
Line 13: Line 13:
== Setup Toolchain path ==
== Setup Toolchain path ==
<pre>
<pre>
$ export PATH=/opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin:$PATH
$ export PATH=/opt/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin:$PATH
</pre>
</pre>



Revision as of 12:13, 19 December 2016

Downloading source code


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-1.git

Setup Toolchain path

$ export PATH=/opt/gcc-linaro-4.9-2016.02-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.

Enter linux kernel directory:

$ cd VAR-SOM-AMx3-Kernel-4-1/


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:

$ 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-AM33:

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_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-AM33 device tree

To build the VAR-SOM-AM33 device tree (dtb image), please use the following command line:

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am33.dtb

The image will be located in: arch/arm/boot/dts/var-som-am33.dtb

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