Skip to content

Debian Bookworm 12.5 Based on NXP FlexBuild LSDK 24.12 with NXP BSP L6.6.52_2.2.2

FlexBuild Overview

FlexBuild is a component-oriented build system and integration platform used to build Debian-based root filesystems, Linux, U-Boot, BSP components, firmware, and userspace packages.

This Debian Bookworm release uses FlexBuild instead of the legacy Debian Bullseye debian-var build flow.

Build Environment

The following flows are supported:

  • Cross-build in a Debian Docker container hosted on x86 Ubuntu or another Docker-capable distribution for a 32-bit Arm target.
  • Cross-build on an x86 host machine running Debian 12 for a 32-bit Arm target.
  • Native-build on an Arm board running Debian for a 32-bit Arm target.

Host System Requirements

FlexBuild uses a Docker container. Most host operating systems capable of running Docker can build FlexBuild.

NXP documents Debian 12, Ubuntu 22.04, and Ubuntu 24.04 as supported hosts:

The following steps were tested by Variscite on a fresh Ubuntu 24.04 installation.

Install required packages:

sudo apt install docker.io git make

Give the current user permission to run Docker without sudo:

sudo usermod -aG docker ${USER}

Log out and log in again for the permission change to take effect.

Supported Target Distribution

  • Debian-based userland for a 32-bit Arm target: desktop and server images.

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
bld docker

Inside the Docker environment:

. setup.env
bld host-dep

Build Desktop Debian Image

After FlexBuild is set up, build the desktop image:

var_build_image imx7-var-som debian:desktop "uboot linux"

Common examples:

var_build_image imx7-var-som debian:desktop "uboot linux"
var_build_image imx7-var-som debian:desktop --clean
var_build_image --cleanall

Supported Debian distributions:

  • debian:server - Debian with server packages.
  • debian:desktop - Debian with desktop environment.

Build Result

The Debian image files can be found in the output directory: build_lsdk2412/images/.

Image Name Description
var-recovery-image-imx7-var-som.img.zst Recovery image for SD card boot and installation to the SOM internal storage.
rootfs_lsdk2412_debian_desktop_arm32.tar.zst Rootfs tarball. It can be used to create an NFS root filesystem on the host. See Debian Setup TFTP/NFS for details.

The kernel build artifacts can be found in: build_lsdk2412/linux/linux/arm32/IMX/.

File Name Description
zImage Linux kernel image.
imx7d-var-som-emmc*.dtb Device tree blobs for eMMC configurations.
imx7d-var-som-nand*.dtb Device tree blobs for NAND flash configurations.

The bootloader image can be found in: build_lsdk2412/bsp/u-boot/imx7-var-som/output/mx7dvar_som_defconfig/.

File Name Description
u-boot-with-spl.imx U-Boot built for SD card, eMMC, or NAND boot.

Create a Bootable SD Card

The output directory contains:

  • var-recovery-image-imx7-var-som.img.zst
  • var-recovery-image-imx7-var-som.img.bmap

Install the image using bmaptool:

sudo bmaptool copy ./flexbuild/build_lsdk2412/images/var-recovery-image-imx7-var-som.img.zst /dev/sdX

Or use dd:

zstdcat ./flexbuild/build_lsdk2412/images/var-recovery-image-imx7-var-som.img.zst | sudo dd of=/dev/sdX bs=1M status=progress conv=fsync

Replace /dev/sdX with the correct SD card device node.

Extend the SD Card Size

Flashing the default FlexBuild image creates a rootfs partition that does not use the entire SD card. To extend it on the host, insert the flashed SD card and replace /dev/sdX below with the actual device node.

Use fdisk to delete and recreate the rootfs partition with the same start sector, then write the partition table:

sudo fdisk /dev/sdX

Use the following input sequence:

d
n


16384

N
p
w

Resize the filesystem:

sudo e2fsck -f /dev/sdX1
sudo resize2fs /dev/sdX1
sync

Boot the Board with a Bootable SD Card

Make sure the carrier board boot-mode switches are configured for SD card boot before powering on the board.

Automatic Device Tree Selection in U-Boot

The U-Boot environment selects fdt_file based on the detected hardware.

To enable automatic device tree selection:

setenv fdt_file undefined
saveenv

To disable automatic selection, set the device tree manually:

setenv fdt_file YOUR_DTB_FILE
saveenv

To list files in the SD card boot partition from U-Boot:

ls mmc 0:1

Flashing Image to Internal Storage

The flashing scripts are located on the SD card at /usr/bin/:

install_debian.sh

Run install_debian.sh from the booted recovery SD card and follow the usage instructions to flash Debian to the SOM internal storage.

More Info About FlexBuild