Yocto Build Linux
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=~/imx8mm-var-dart-linux $ mkdir ${WORKDIR}
Build Linux out of Yocto tree
Fetch linux-imx source code:
$ cd $WORKDIR $ git clone https://github.com/varigit/linux-imx.git -b 5.4-2.3.x-imx_var01 $ cd && \ git checkout 5.4-2.3.x-imx_var01 && \ cd ../
Build Kernel, Modules, and DTBs:
Setup the environment:
$ source /opt/fslc-xwayland/3.3/environment-setup-cortexa53-crypto-fslc-linux
$ unset LDFLAGS
Clean and prepare the kernel:
$ cd ${WORKDIR}/linux-imx $ make mrproper $ make imx8_var_defconfig
Customize the kernel configuration (optional step): $ make menuconfig
Build kernel parts:
Build everything: $ make -j$(nproc) Build Image.gz only: $ make -j$(nproc) Image.gz Build modules only: $ make -j$(nproc) modules Build device trees only: $ make -j$(nproc) dtbs
Build only the device tree for DART-MX8M-MINI on DT8MCustomBoard V2.x and above: $ make -j4 freescale/imx8mm-var-dart-dt8mcustomboard.dtb Build only the device tree for DART-MX8M-MINI on with Cortex-M4 DT8MCustomBoard V2.x and above: $ make -j4 freescale/imx8mm-var-dart-dt8mcustomboard-m4.dtb Build only the device tree for DART-MX8M-MINI on DT8MCustomBoard V1.x: $ make -j4 freescale/imx8mm-var-dart-dt8mcustomboard-legacy.dtb Build only the device tree for DART-MX8M-MINI on with Cortex-M4 DT8MCustomBoard V1.x: $ make -j4 freescale/imx8mm-var-dart-dt8mcustomboard-legacy-m4.dtb Build only the device tree for VAR-SOM-MX8M-MINI on Symphony-Board V1.4A and above: $ make -j4 freescale/imx8mm-var-som-symphony.dtb Build only the device tree for VAR-SOM-MX8M-MINI with Cortex-M4 on Symphony-Board V1.4A and above: $ make -j4 freescale/imx8mm-var-som-symphony-m4.dtb Build only the device tree for VAR-SOM-MX8M-MINI on Symphony-Board V1.4 and below: $ make -j4 freescale/imx8mm-var-som-symphony-legacy.dtb Build only the device tree for VAR-SOM-MX8M-MINI with Cortex-M4 on Symphony-Board V1.4 and below: $ make -j4 freescale/imx8mm-var-som-symphony-legacy-m4.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-imx && \ make ARCH=arm64 \ 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 Image.gz and device trees to the SD card boot partition, and install the modules in the SD card rootfs partition.
Assuming the rootfs partition is mounted on /media/user/rootfs:
Install the kernel image and modules: $ cd ${WORKDIR}/linux-imx $ kver=$(strings arch/arm64/boot/Image | grep -i "Linux version" | awk '{print $3}') $ sudo cp arch/arm64/boot/Image.gz /media/user/rootfs/boot/Image.gz-${kver} $ sudo ln -fs /boot/Image.gz-${kver} /media/user/rootfs/boot/Image.gz $ sudo cp $WORKDIR/rootfs/* /media/user/rootfs Install the device trees: $ sudo cp arch/arm64/boot/dts/freescale/*imx*var*.dtb /media/user/rootfs/boot/
Install the built kernel images, modules, and device trees using SSH on a running target
The example below uses ssh to install the kernel on a running device.
First, export a variable with the ip address of your target device:
$ export TARGET_IP=192.168.0.205
Then, copy the kernel image and device trees to the temporary directory, send them to the target using ssh, and install them with the correct user permissions:
$ mkdir -p $WORKDIR/rootfs/boot && \ cp ${WORKDIR}/linux-imx/arch/arm64/boot/dts/freescale/*imx*var*.dtb $WORKDIR/rootfs/boot && \ cp ${WORKDIR}/linux-imx/arch/arm64/boot/Image.gz $WORKDIR/rootfs/boot/ && \ ssh root@${TARGET_IP} 'mkdir /tmp/rootfs' && \ tar czf - -C $WORKDIR/rootfs . | ssh root@${TARGET_IP} 'tar xzf - -C /tmp/rootfs && chown -R root:root /tmp/rootfs && cp -a /tmp/rootfs/* / && rm -r /tmp/rootfs'