Build Linux from source code¶
Toolchain installation for out of Flexbuild builds¶
To install the toolchain, follow the Debian Flexbuild Toolchain installation guide.
Setup the environment:¶
Set up a working directory
Define the cross-compiler and the architecture:
Build Linux out of Flexbuild tree¶
Fetch linux-imx source code:¶
$ cd $WORKDIR
$ git clone https://github.com/varigit/linux-imx.git -b lf-6.6.y_6.6.52-2.2.0_var01 linux-imx
Build Kernel, Modules, and DTBs:¶
Clean and prepare the kernel:
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.MX6ULL SOC, eMMC and SD card:
$ make -j4 imx6ull-var-dart-6ulcustomboard-emmc-sd-card.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ull-var-dart-6ulcustomboard-emmc-sd-card-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, eMMC and WiFi iw61x:
$ make -j4 imx6ull-var-dart-6ulcustomboard-emmc-wifi-iw61x.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, eMMC and WiFi BRCM:
$ make -j4 imx6ull-var-dart-6ulcustomboard-emmc-wifi-brcm.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, eMMC, WM8731 and WiFi BRCM:
$ make -j4 imx6ull-var-dart-6ulcustomboard-emmc-wifi-brcm-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash and SD card:
$ make -j4 imx6ull-var-dart-6ulcustomboard-nand-sd-card.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ull-var-dart-6ulcustomboard-nand-sd-card-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash and WiFi iw61x:
$ make -j4 imx6ull-var-dart-6ulcustomboard-nand-wifi-iw61x.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash and WiFi BRCM:
$ make -j4 imx6ull-var-dart-6ulcustomboard-nand-wifi-brcm.dtb
Build only the device tree for DART-6UL with i.MX6ULL SOC, NAND flash, WM8731 and WiFi BRCM:
$ make -j4 imx6ull-var-dart-6ulcustomboard-nand-wifi-brcm-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC and SD card:
$ make -j4 imx6ul-var-dart-6ulcustomboard-emmc-sd-card.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ul-var-dart-6ulcustomboard-emmc-sd-card-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC and WiFi iw61x:
$ make -j4 imx6ul-var-dart-6ulcustomboard-emmc-wifi-iw61x.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC and WiFi BRCM:
$ make -j4 imx6ul-var-dart-6ulcustomboard-emmc-wifi-brcm.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, eMMC, WM8731 and WiFi BRCM:
$ make -j4 imx6ul-var-dart-6ulcustomboard-emmc-wifi-brcm-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash and SD card:
$ make -j4 imx6ul-var-dart-6ulcustomboard-nand-sd-card.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ul-var-dart-6ulcustomboard-nand-sd-card-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash and WiFi iw61x:
$ make -j4 imx6ul-var-dart-6ulcustomboard-nand-wifi-iw61x.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash and WiFi BRCM:
$ make -j4 imx6ul-var-dart-6ulcustomboard-nand-wifi-brcm.dtb
Build only the device tree for DART-6UL with i.MX6UL SOC, NAND flash, WM8731 and WiFi BRCM:
$ make -j4 imx6ul-var-dart-6ulcustomboard-nand-wifi-brcm-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, eMMC and SD card:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-emmc-sd-card.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-emmc-sd-card-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, eMMC and WiFi iw61x:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-emmc-wifi-iw61x.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, eMMC and WiFi BRCM:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-emmc-wifi-brcm.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, eMMC, WM8731 and WiFi BRCM:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-emmc-wifi-brcm-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, NAND flash and SD card:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-nand-sd-card.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-nand-sd-card-wm8731.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, NAND flash and WiFi iw61x:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-nand-wifi-iw61x.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, NAND flash and WiFi BRCM:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-nand-wifi-brcm.dtb
Build only the device tree for DART-6UL with i.MX6ULZ SOC, NAND flash, WM8731 and WiFi BRCM:
$ make -j4 imx6ulz-var-dart-6ulcustomboard-nand-wifi-brcm-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, eMMC and SD card:
$ make -j4 imx6ull-var-som-concerto-board-emmc-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ull-var-som-concerto-board-emmc-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, eMMC and WiFi:
$ make -j4 imx6ull-var-som-concerto-board-emmc-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, eMMC, WM8731 and WiFi:
$ make -j4 imx6ull-var-som-concerto-board-emmc-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, NAND flash and SD card:
$ make -j4 imx6ull-var-som-concerto-board-nand-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ull-var-som-concerto-board-nand-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, NAND flash and WiFi:
$ make -j4 imx6ull-var-som-concerto-board-nand-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULL SOC, NAND flash, WM8731 and WiFi:
$ make -j4 imx6ull-var-som-concerto-board-nand-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, eMMC and SD card:
$ make -j4 imx6ul-var-som-concerto-board-emmc-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ul-var-som-concerto-board-emmc-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, eMMC and WiFi:
$ make -j4 imx6ul-var-som-concerto-board-emmc-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, eMMC, WM8731 and WiFi:
$ make -j4 imx6ul-var-som-concerto-board-emmc-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, NAND flash and SD card:
$ make -j4 imx6ul-var-som-concerto-board-nand-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ul-var-som-concerto-board-nand-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, NAND flash and WiFi:
$ make -j4 imx6ul-var-som-concerto-board-nand-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6UL SOC, NAND flash, WM8731 and WiFi:
$ make -j4 imx6ul-var-som-concerto-board-nand-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, eMMC and SD card:
$ make -j4 imx6ulz-var-som-concerto-board-emmc-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ulz-var-som-concerto-board-emmc-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, eMMC and WiFi:
$ make -j4 imx6ulz-var-som-concerto-board-emmc-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, eMMC, WM8731 and WiFi:
$ make -j4 imx6ulz-var-som-concerto-board-emmc-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, NAND flash and SD card:
$ make -j4 imx6ulz-var-som-concerto-board-nand-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ulz-var-som-concerto-board-nand-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, NAND flash and WiFi:
$ make -j4 imx6ulz-var-som-concerto-board-nand-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Concerto board with i.MX6ULZ SOC, NAND flash, WM8731 and WiFi:
$ make -j4 imx6ulz-var-som-concerto-board-nand-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, eMMC and SD card:
$ make -j4 imx6ull-var-som-symphony-board-emmc-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ull-var-som-symphony-board-emmc-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, eMMC and WiFi:
$ make -j4 imx6ull-var-som-symphony-board-emmc-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, eMMC, WM8731 and WiFi:
$ make -j4 imx6ull-var-som-symphony-board-emmc-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, NAND flash and SD card:
$ make -j4 imx6ull-var-som-symphony-board-nand-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ull-var-som-symphony-board-nand-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, NAND flash and WiFi:
$ make -j4 imx6ull-var-som-symphony-board-nand-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULL SOC, NAND flash, WM8731 and WiFi:
$ make -j4 imx6ull-var-som-symphony-board-nand-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, eMMC and SD card:
$ make -j4 imx6ul-var-som-symphony-board-emmc-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ul-var-som-symphony-board-emmc-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, eMMC and WiFi:
$ make -j4 imx6ul-var-som-symphony-board-emmc-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, eMMC, WM8731 and WiFi:
$ make -j4 imx6ul-var-som-symphony-board-emmc-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, NAND flash and SD card:
$ make -j4 imx6ul-var-som-symphony-board-nand-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ul-var-som-symphony-board-nand-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, NAND flash and WiFi:
$ make -j4 imx6ul-var-som-symphony-board-nand-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6UL SOC, NAND flash, WM8731 and WiFi:
$ make -j4 imx6ul-var-som-symphony-board-nand-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, eMMC and SD card:
$ make -j4 imx6ulz-var-som-symphony-board-emmc-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, eMMC, WM8731 and SD card:
$ make -j4 imx6ulz-var-som-symphony-board-emmc-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, eMMC and WiFi:
$ make -j4 imx6ulz-var-som-symphony-board-emmc-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, eMMC, WM8731 and WiFi:
$ make -j4 imx6ulz-var-som-symphony-board-emmc-wifi-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, NAND flash and SD card:
$ make -j4 imx6ulz-var-som-symphony-board-nand-sd-card.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, NAND flash, WM8731 and SD card:
$ make -j4 imx6ulz-var-som-symphony-board-nand-sd-card-wm8731.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, NAND flash and WiFi:
$ make -j4 imx6ulz-var-som-symphony-board-nand-wifi.dtb
Build only the device tree for VAR-SOM-6UL on Symphony board with i.MX6ULZ SOC, NAND flash, WM8731 and WiFi:
$ make -j4 imx6ulz-var-som-symphony-board-nand-wifi-wm8731.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=arm \
INSTALL_MOD_STRIP=1 \
INSTALL_MOD_PATH=$WORKDIR/rootfs \
modules_install
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 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/root:
Install the kernel image and modules:
$ cd ${WORKDIR}/linux-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/nxp/imx/imx6ul*var*.dtb /media/user/BOOT-VAR6UL
Notes:
- If you are using our Debian Recovery SD card, and you want the eMMC installation process to be updated as well as the SD card boot itself, you need to also update the /opt/images/Debian directory.
- You should always properly unmount your SD card before physically removing it.