Personal tools

Yocto Build Linux

From Variscite Wiki

Jump to: navigation, search


Build Linux from source code


It is recommended to build the kernel image using Yocto (see the Customizing the Linux kernel page) instead of using the direct method described in this page.
This is because some of the Yocto packages may depend on the kernel, like the WiFi module that is built from outside of the kernel source tree on some of the Yocto releases.

1 Toolchain installation for out of Yocto builds

To install the toolchain, follow Yocto Toolchain installation.

2 Build Linux out of Yocto tree

Get the Linux source code:

$ git clone https://github.com/varigit/linux-imx.git
$ cd linux-imx
$ git checkout imx_4.9.11_1.0.0_ga-var01

Build the Linux kernel:

$ source /opt/fslc-x11/2.4.1/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi
$ make mrproper
$ make imx_v7_var_defconfig
Customize the kernel configuration (optional step):
$ make menuconfig
Build everything:
$ make -j4
Build uImage only:
$ make -j4 LOADADDR=0x10008000 uImage

Build modules only:
$ make -j4 LOADADDR=0x10008000 modules

Build device trees only:
$ make -j4 dtbs
Build individual device trees:

Build the device tree for VAR-SOM-MX6 Dualite/Solo on VAR-MX6CustomBoard with capacitive touchscreen:
$ make -j4 imx6dl-var-som-cap.dtb

Build the device tree for VAR-SOM-MX6 Dualite/Solo on VAR-MX6CustomBoard with resistive touchscreen:
$ make -j4 imx6dl-var-som-res.dtb

Build the device tree for VAR-SOM-MX6 Dualite/Solo on VAR-SOLOCustomBoard:
$ make -j4 imx6dl-var-som-vsc.dtb

Build the device tree for VAR-SOM-MX6 Quad/Dual on VAR-MX6CustomBoard with capacitive touchscreen:
$ make -j4 imx6q-var-som-cap.dtb

Build the device tree for VAR-SOM-MX6 Quad/Dual on VAR-MX6CustomBoard with resistive touchscreen:
$ make -j4 imx6q-var-som-res.dtb

Build the device tree for VAR-SOM-MX6 Quad/Dual on VAR-SOLOCustomBoard:
$ make -j4 imx6q-var-som-vsc.dtb

Build the device tree for VAR-SOM-MX6 QuadPlus/DualPlus on VAR-MX6CustomBoard with capacitive touchscreen:
$ make -j4 imx6qp-var-som-cap.dtb

Build the device tree for VAR-SOM-MX6 QuadPlus/DualPlus on VAR-MX6CustomBoard with resistive touchscreen:
$ make -j4 imx6qp-var-som-res.dtb

Build the device tree for VAR-SOM-MX6 QuadPlus/DualPlus on VAR-SOLOCustomBoard:
$ make -j4 imx6qp-var-som-vsc.dtb

Build the device tree for VAR-SOM-SOLO on VAR-MX6CustomBoard with capacitive touchscreen:
$ make -j4 imx6dl-var-som-solo-cap.dtb

Build the device tree for VAR-SOM-SOLO on VAR-MX6CustomBoard with resistive touchscreen:
$ make -j4 imx6dl-var-som-solo-res.dtb

Build the device tree for VAR-SOM-SOLO on VAR-SOLOCustomBoard:
$ make -j4 imx6dl-var-som-solo-vsc.dtb

Build the device tree for DART-MX6:
$ make -j4 imx6q-var-dart.dtb


Notes:

If you replace the kernel image (uImage) on your system, you also need to reinstall the kernel modules, and vice versa.
If you just want to make a change in the device tree, you can compile and replace it without replacing the kernel image and modules.

3 Install the built kernel on an SD card

Copy the uImage and device trees to the SD card boot partition, and install the modules in the SD card rootfs partition.
Assuming the boot partition is mounted on /media/user/BOOT-VARMX6 and the rootfs partition is mounted on /media/user/rootfs:

Install the kernel image and modules:
$ cp arch/arm/boot/uImage /media/user/BOOT-VARMX6
$ sudo make ARCH=arm modules_install INSTALL_MOD_PATH=/media/user/rootfs


Install the device trees:


$ cp arch/arm/boot/dts/imx6q*var*.dtb  /media/user/BOOT-VARMX6
$ cp arch/arm/boot/dts/imx6dl*var*.dtb /media/user/BOOT-VARMX6

Notes:

  • If you are using our Yocto Recovery SD card, and you want the NAND flash/eMMC installation process to be updated as well as the SD card boot itself, you need to also update the /opt/images/Yocto directory.
  • You should always properly unmount your SD card before physically removing it.