Debian Bookworm 12.5 based on NXP FlexBuild LSDK 24.12 with NXP BSP L6.6.52_2.2.0¶
FlexBuild Overview¶
FlexBuild is a component-oriented lightweight build system and integration platform with capabilities of flexible, easy-to-use, scalable system build and distro deployment.
Users can use FlexBuild to easily build Debian-based RootFS, Linux kernel, BSP components and miscellaneous userspace applications (e.g. graphics, multimedia, networking, connectivity, security, AI/ML, robotics, etc) against Debian-based library dependencies to streamline the system build with efficient CI/CD.
Build Environment¶
- Cross-build in Debian Docker container hosted on x86 Ubuntu or any other distro for arm32 target
- Cross-build on x86 host machine running Debian 12 for arm32 target
- Native-build on ARM board running Debian for arm32 target
Host System Requirements¶
FlexBuild is built using a docker container. Most host operating systems capable of running docker should be able to build FlexBuild.
Officially, NXP supports using Debian 12, Ubuntu 22.04, and Ubuntu 24.04 in their official documentation:
The following steps were tested in a fresh Ubuntu 24.04 installation by Variscite.
Install required packages:
Give the current user permissions to run docker without sudo:
Log out, and log in again for the user permissions to take effect.
Supported Distro for Target (arm32)¶
- Debian-based userland (desktop, server)
FlexBuild Setup and Usage¶
git clone https://github.com/varigit/flexbuild.git -b LSDK-24.12_DEBIAN-12_LF-6.6.36-arm32_var01
cd flexbuild
. setup.env # in the host environment
bld docker # create or attach to the container
. setup.env # in the container
bld host-dep # install host dependencies
Build Desktop Debian Image¶
After the FlexBuild setup, you can skip the full setup and just run:
Example usage:¶
Usage: var_build_image <machine> <distro> <components> [options]
Options:
--clean Clean the specified distribution
--cleanall Clean all build environments
--config Specify custom config file (default: sdk-var.yml)
Supported Debian distributions:
debian:server - Debian with server packages
debian:desktop - Debian with desktop environment
Examples:
var_build_image imx6ul-var-dart debian:desktop "uboot linux"
var_build_image imx6ul-var-dart debian:desktop --clean
var_build_image --cleanall
Build Result¶
The Debian image files can be found in the output directory: build_lsdk2412/images/.
|
Image Name
|
Description
|
|---|---|
| var-recovery-image-imx6ul-var-dart.img.zst |
This image is intended for
SD card boot and eMMC installation
.
It should be flashed to an SD card, which will then be used to boot your system. Once booted, follow the steps below to install the system image onto the eMMC . |
| rootfs_lsdk2412_debian_desktop_arm32.tar.zst |
Tarball with rootfs files.
Can be used to create an NFS root file system on the host. See the Debian Setup TFTP/NFS section for more info. |
The kernel build artifacts can be found in the output directory: build_lsdk2412/linux/linux/arm32/IMX/.
The bootloader image can be found in the output directory: build_lsdk2412/bsp/u-boot/imx6ul-var-dart/.
|
File Name
|
Description
|
|---|---|
| u-boot-with-spl.imx | U-Boot built for SD card boot or eMMC boot. |
Create a bootable SD card¶
The output directory contains the following recovery image files:
var-recovery-image-imx6ul-var-dart.img.zstvar-recovery-image-imx6ul-var-dart.img.bmap
You can install the image using one of the following methods:
Using bmaptool (recommended)¶
sudo bmaptool copy ./flexbuild/build_lsdk2412/images/var-recovery-image-imx6ul-var-dart.img.zst /dev/sdX
Using dd (slower, writes the full image byte-by-byte)¶
zstdcat ./flexbuild/build_lsdk2412/images/var-recovery-image-imx6ul-var-dart.img.zst | sudo dd of=/dev/sdX bs=1M status=progress conv=fsync
Note: Replace /dev/sdX with the correct device node for your target storage (e.g., /dev/sdb).
Extending the SD Card Size¶
The recovery image has two partitions:
| Partition | File System | Label | Purpose |
|---|---|---|---|
/dev/sdX1 | FAT32 | boot | Kernel and device trees |
/dev/sdX2 | ext4 | rootfs | Root filesystem |
Replace /dev/sdX with the SD card device, not a partition. For an MMC
device such as /dev/mmcblk0, the partitions are /dev/mmcblk0p1 and
/dev/mmcblk0p2.
On the host, install the tools and inspect the flashed card:
sudo apt install parted e2fsprogs
lsblk -o NAME,FSTYPE,LABEL,SIZE,MOUNTPOINTS /dev/sdX
sudo parted /dev/sdX unit s print
Confirm that partition 1 is the boot partition and partition 2 is the ext4 rootfs. Record both starting sectors. Unmount every mounted partition on the card before continuing. Do not delete or format either partition.
Extend only partition 2 to the end of the card, then reread the table:
Verify that partition 1 is unchanged and partition 2 retains its original starting sector. If the kernel cannot reread the partition table, remove and reinsert the card before proceeding. Recheck the device name and unmount any automatically mounted partitions.
Check and expand the unmounted ext4 rootfs, not the FAT boot partition:
Proceed only if the filesystem check completes without unresolved errors:
The rootfs now uses the remaining card space while the boot partition is preserved. Eject the card before removing it.
Boot the board with a bootable SD card¶
Setting the Boot Mode¶
Make sure the BOOT SELECT DIP switch on the carrier board is set correctly before you power on the board.
Automatic device tree selection in U-Boot¶
We have different kernel device trees corresponding to our various hardware configurations. A script implemented in U-Boot's environment sets the fdt_file environment variable based on the detected hardware.
Enable/Disable automatic device tree selection¶
To enable the automatic device tree selection in U-Boot (already enabled by default):
To disable the automatic device tree selection in U-Boot, set the device tree file manually:
Useful example: To list all files in the boot partition (where the dtb files are by default) of an SD card:
Flashing image to eMMC/internal storage¶
The flashing scripts are located on the SD card at /usr/bin/:
More Info About FlexBuild¶
Please refer to the following resources:
Internal Documentation:
Kernel Provider¶
The default provider is fslc-imx (Linux 6.6.157). To select it explicitly:
To build the NXP imx provider (Linux 6.6.52), use a separate checkout.
Exit the current Flexbuild container to return to the host shell:
Run the following commands on the host, not inside the container:
cd "$HOME"
git clone -b LSDK-24.12_DEBIAN-12_LF-6.6.36-arm32_var01 https://github.com/varigit/flexbuild.git flexbuild-6ul-imx
cd flexbuild-6ul-imx
git checkout --detach 8a3c959381d3de730d1e3150b81489bdc8ebb874
. setup.env
bld docker
Inside the new container, initialize the environment, install host
dependencies, and build with the imx provider:
. setup.env
bld host-dep
export KERNEL_PROVIDER=imx
var_build_image imx6ul-var-dart debian:desktop "uboot linux"
The separate checkout has its own source and build directories. To return to
the fslc-imx build, exit the container, return to the original checkout,
run . setup.env and bld docker, then run . setup.env and set
KERNEL_PROVIDER=fslc-imx inside that container before building.
Keep each kernel with its matching DTBs. Flexbuild selects the SoM Wi-Fi DTBs for the chosen provider. CI artifact names include the built kernel version and provider.