Yocto Build Linux: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 19: Line 19:
Build the Linux kernel:
Build the Linux kernel:
  $ source {{#var:TOOLCHAIN_LOCATION}}
  $ source {{#var:TOOLCHAIN_LOCATION}}
  $ {{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M|export LDFLAGS=|}}
  {{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M|$ export LDFLAGS=|}}


  $ make mrproper
  $ make mrproper
Line 50: Line 50:
Assuming the boot partition is mounted on /media/user/BOOT-{{#var:HARDWARE_NAME}} and the rootfs partition is mounted on /media/user/rootfs:
Assuming the boot partition is mounted on /media/user/BOOT-{{#var:HARDWARE_NAME}} and the rootfs partition is mounted on /media/user/rootfs:


{{#ifeq: {{#var:HARDWARE_NAME}}|DART-MX8M |
<br>
  Install the kernel image and modules:
  Install the kernel image and modules:
  $ cp arch/arm/boot/{{#var:KERNEL_IMAGE}} /media/user/{{#var:EMMC_FAT_PARTITION_NAME}}
$ image=$(basename /media/user/rootfs/boot/Image.gz-*)
$ cp arch/arm64/boot/{{#var:KERNEL_IMAGE}} /media/user/rootfs/boot/$image
$ sudo make ARCH=arm modules_install INSTALL_MOD_PATH=/media/user/rootfs
 
Install the device trees:
$ for dtb in arch/arm64/boot/dts/variscite/*.dtb; do cp $dtb /media/user/rootfs/devicetree-Image.gz-$(basename $dtb); done
|
<br>
Install the kernel image and modules:
  $ cp arch/arm/boot/{{#var:KERNEL_IMAGE}} /media/user/{{#var:EMMC_FAT_PARTITION_NAME}}}}
  $ sudo make ARCH=arm modules_install INSTALL_MOD_PATH=/media/user/rootfs
  $ sudo make ARCH=arm modules_install INSTALL_MOD_PATH=/media/user/rootfs


  Install the device trees:
  Install the device trees:
  $ cp arch/arm/boot/dts/*var*.dtb /media/user/{{#var:EMMC_FAT_PARTITION_NAME}}
  $ cp arch/arm/boot/dts/*var*.dtb /media/user/{{#var:EMMC_FAT_PARTITION_NAME}}
 
}}
Note:<br>
Note:<br>
If you are using our {{Varlink2|Yocto Recovery SD card|{{#var:RELEASE_LINK}}}}, and you want the NAND flash/eMMC installation to update as well as the SD card boot itself, you need to also update the /opt/images/Yocto directory.
If you are using our {{Varlink2|Yocto Recovery SD card|{{#var:RELEASE_LINK}}}}, and you want the NAND flash/eMMC installation to update as well as the SD card boot itself, you need to also update the /opt/images/Yocto directory.

Revision as of 13:41, 3 July 2018

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.

Toolchain installation for out of Yocto builds

To install the toolchain, follow Yocto Toolchain installation.

Build Linux out of Yocto tree

Get the Linux source code:

$ git clone https://github.com/varigit/linux-2.6-imx.git
$ cd linux-2.6-imx
$ git checkout imx-rel_imx_4.1.15_2.0.0_ga-var02

Build the Linux kernel:

$ source /opt/fslc-x11/2.2.1/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi

$ make mrproper
$ make imx6ul-var-dart_defconfig
Customize the kernel configuration (optional step):
$ make menuconfig
Build everything:
$ make -j4
Build zImage only:
$ make -j4  zImage

Build modules only:
$ make -j4  modules

Build device trees only:
$ make -j4 dtbs
Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC and WiFi:
$ make -j4 imx6ul-var-dart-emmc_wifi.dtb

Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC and SD card:
$ make -j4 imx6ul-var-dart-sd_emmc.dtb

Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash and WiFi:
$ make -j4 imx6ul-var-dart-nand_wifi.dtb

Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash and SD card:
$ make -j4 imx6ul-var-dart-sd_nand.dtb

Build only the device tree for DART-6UL with i.MX6ULL SOC, eMMC and WiFi:
$ make -j4 imx6ull-var-dart-emmc_wifi.dtb

Build only the device tree for DART-6UL with i.MX6ULL SOC, eMMC and SD card:
$ make -j4 imx6ull-var-dart-sd_emmc.dtb

Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash and WiFi:
$ make -j4 imx6ull-var-dart-nand_wifi.dtb

Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash and SD card:
$ make -j4 imx6ull-var-dart-sd_nand.dtb


Notes:

If you replace the kernel image (zImage) 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.

Install the built kernel on an SD card

Copy the zImage 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-DART-6UL and the rootfs partition is mounted on /media/user/rootfs:


Install the kernel image and modules:
$ cp arch/arm/boot/zImage /media/user/BOOT-VAR6UL
$ sudo make ARCH=arm modules_install INSTALL_MOD_PATH=/media/user/rootfs
Install the device trees:
$ cp arch/arm/boot/dts/*var*.dtb /media/user/BOOT-VAR6UL

}} Note:
If you are using our Yocto Recovery SD card, and you want the NAND flash/eMMC installation to update as well as the SD card boot itself, you need to also update the /opt/images/Yocto directory.