Yocto Build Linux: Difference between revisions
No edit summary |
(Add support for Yocto Debian) |
||
Line 9: | Line 9: | ||
{{#vardefine:CUSTOMIZE_LINUX_KERNEL|Yocto Customizing the Linux kernel}} <!-- Default to Yocto | {{#vardefine:CUSTOMIZE_LINUX_KERNEL|Yocto Customizing the Linux kernel}} <!-- Default to Yocto | ||
--> {{#varexists:DEBIAN_NAME | | --> {{#varexists:DEBIAN_NAME | | ||
{{#vardefine:PLATFORM_OS|Debian | {{#vardefine:PLATFORM_OS|Debian}} }} <!-- | ||
--> {{PageHeader|Build Linux from source code}} {{DocImage|category1=Yocto|category2=Debian}} <!-- | --> {{PageHeader|Build Linux from source code}} {{DocImage|category1=Yocto|category2=Debian}} <!-- | ||
--> [[category:{{#var:HARDWARE_NAME}}]] __toc__ | --> [[category:{{#var:HARDWARE_NAME}}]] __toc__ | ||
{{note|It is recommended to build the kernel image using | {{note|It is recommended to build the kernel image using Yocto (see the {{Varlink|{{#var:CUSTOMIZE_LINUX_KERNEL}}|{{#var:RELEASE_LINK}}|Customizing the Linux kernel}} page) instead of using the direct method described in this page.<br> | ||
This is because some of the | 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 {{#var:PLATFORM_OS}} releases.}} | ||
= Toolchain installation for out of | = Toolchain installation for out of Yocto builds = | ||
To install the toolchain, follow the {{Varlink2| | To install the toolchain, follow the {{Varlink2|Yocto Toolchain installation|{{#var:RELEASE_LINK}}}} guide. | ||
= Setup the environment: = | = Setup the environment: = | ||
Line 25: | Line 24: | ||
$ mkdir ${WORKDIR} | $ mkdir ${WORKDIR} | ||
= Build Linux out of | = Build Linux out of Yocto tree = | ||
== Fetch {{#var:KERNEL_REPO_NAME}} source code: == | == Fetch {{#var:KERNEL_REPO_NAME}} source code: == | ||
Line 34: | Line 33: | ||
Setup the environment: | Setup the environment: | ||
$ source {{#var:TOOLCHAIN_LOCATION}}{{#switch: {{#var:SOC_SERIES}}|imx8|mx93=<br>$ unset LDFLAGS|}} | $ source {{#var:TOOLCHAIN_LOCATION}}{{#switch: {{#var:SOC_SERIES}}|imx8|mx93=<br>$ unset LDFLAGS|}} | ||
Clean and prepare the kernel: | Clean and prepare the kernel: | ||
Line 65: | Line 56: | ||
$ make -j$(nproc) dtbs | $ make -j$(nproc) dtbs | ||
<!-- Attach DTB section from specific release--> | <!-- Attach DTB section from specific release--> | ||
{{#lst: | {{#lst:Yocto_Platform_Customization|{{#var:KERNEL_DTB_SECTION}}}} | ||
== Install kernel modules to temporary directory == | == Install kernel modules to temporary directory == |
Revision as of 13:14, 19 April 2024
This page is using the default release RELEASE_MORTY_V1.0_DART-6UL.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
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 the Yocto Toolchain installation guide.
Setup the environment:
Setup a working directory
$ export WORKDIR=~/imx6ul-var-dart-linux $ mkdir ${WORKDIR}
Build Linux out of Yocto tree
Fetch linux-2.6-imx source code:
$ cd $WORKDIR $ git clone https://github.com/varigit/linux-2.6-imx.git -b imx-rel_imx_4.1.15_2.0.0_ga-var02 linux-2.6-imx $ cd linux-2.6-imx && \ git checkout imx-rel_imx_4.1.15_2.0.0_ga-var02 && \ cd ../
Build Kernel, Modules, and DTBs:
Setup the environment:
$ source /opt/fslc-x11/2.2.1/environment-setup-armv7at2hf-neon-fslc-linux-gnueabi
Clean and prepare the kernel:
$ cd ${WORKDIR}/linux-2.6-imx $ make mrproper $ make imx6ul-var-dart_defconfig
Customize the kernel configuration (optional step): $ make menuconfig
Build kernel parts:
Build everything: $ make -j$(nproc) Build zImage only: $ make -j$(nproc) zImage Build modules only: $ make -j$(nproc) modules Build device trees only: $ make -j$(nproc) 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
Install kernel modules to temporary directory
Create a temporary directory to install the modules:
Optional: delete any old installation from previous builds: $ rm -rf $WORKDIR/rootfs Create new directory: $ mkdir -p $WORKDIR/rootfs
Install the modules to the temporary rootfs:
$ cd ${WORKDIR}/linux-2.6-imx && \ make ARCH=arm \ INSTALL_MOD_STRIP=1 \ INSTALL_MOD_PATH=$WORKDIR/rootfs \ modules_install
Notes:
Install the built kernel images, modules, and device trees 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-VAR6UL and the rootfs partition is mounted on /media/user/rootfs:
Install the kernel image and modules: $ cd ${WORKDIR}/linux-2.6-imx $ cp arch/arm/boot/zImage /media/user/BOOT-VAR6UL $ sudo cp $WORKDIR/rootfs/* /media/user/rootfs Install the device trees: $ sudo cp arch/arm/boot/dts/imx6ul*var*.dtb /media/user/BOOT-VAR6UL
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.