Debian Build Release Flexbuild
This page is using the default release mx8mm-debian-bookworm-6.6.52_24.12-v1.0.
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
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 arm64 target
- Cross-build on x86 host machine running Debian 12 for arm64 target
- Native-build on ARM board running Debian for arm64 target
Host System Requirement
- Docker hosted on Ubuntu LTS host (e.g. 22.04, 20.04) or any other distro. Refer to docker-setup. User can run 'bld docker' to create a Debian docker and build it in docker.
- Debian 12 host. Refer to host_requirement.
Supported Distro for Target (arm64)
- 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_var01 $ cd flexbuild $ . setup.env (in host environment) $ bld docker (create or attach to docker) [root@fbdebian flexbuild]$ . setup.env (in docker environment) [root@fbdebian flexbuild]$ bld host-dep (install host dependent packages)
Build Desktop Debian Image
After the FlexBuild setup, you can skip the full setup and just run:
[root@fbdebian flexbuild]$ var_build_image imx8mm-var-dart debian:desktop "uboot linux"
Example usage:
Usage: var_build_image <machine> <components> <distro> [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:base - Minimal Debian installation debian:server - Debian with server packages debian:desktop - Debian with desktop environment Examples: var_build_image imx8mm-var-dart debian:desktop "uboot linux" var_build_image imx8mm-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-imx8mm-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_arm64.tar.zst | Tarball with rootfs files. Can be used to create an NFS root file system on the host. See the Yocto Setup TFTP/NFS section for more info. |
The kernel build artifacts can be found in the output directory: build_lsdk2412/linux/linux/arm64/IMX/.
File Name |
Description |
---|---|
Image.gz | Linux kernel image, same binary for SD card and eMMC. |
imx8mm-var-dart-1.x-dt8mcustomboard.dtb | Device tree blob for DART-MX8M-MINI V1.x on DT8MCustomBoard |
imx8mm-var-dart-1.x-dt8mcustomboard-m4.dtb | Device tree blob for DART-MX8M-MINI V1.x with Cortex-M4 on DT8MCustomBoard |
imx8mm-var-dart-dt8mcustomboard.dtb | Device tree blob for DART-MX8M-MINI V2.x on DT8MCustomBoard |
imx8mm-var-dart-dt8mcustomboard-m4.dtb | Device tree blob for DART-MX8M-MINI V2.x with Cortex-M4 on DT8MCustomBoard |
imx8mm-var-dart-wbe-dt8mcustomboard.dtb | Device tree blob for DART-MX8M-MINI V2.x with WBE on DT8MCustomBoard |
imx8mm-var-dart-wbe-dt8mcustomboard-m4.dtb | Device tree blob for DART-MX8M-MINI V2.x with Cortex-M4 and WBE on DT8MCustomBoard |
imx8mm-var-som-1.x-symphony.dtb | Device tree blob for VAR-SOM-MX8M-MINI V1.x on Symphony-Board |
imx8mm-var-som-1.x-symphony-m4.dtb | Device tree blob for VAR-SOM-MX8M-MINI V1.x with Cortex-M4 on Symphony-Board |
imx8mm-var-som-symphony.dtb | Device tree blob for VAR-SOM-MX8M-MINI V2.x on Symphony-Board |
imx8mm-var-som-symphony-m4.dtb | Device tree blob for VAR-SOM-MX8M-MINI V2.x with Cortex-M4 on Symphony-Board |
imx8mm-var-som-wbe-symphony.dtb | Device tree blob for VAR-SOM-MX8M-MINI V2.x with WBE on Symphony-Board |
imx8mm-var-som-wbe-symphony-m4.dtb | Device tree blob for VAR-SOM-MX8M-MINI V2.x with WBE and Cortex-M4 on Symphony-Board |
The bootloader image can be found in the output directory: build_lsdk2412/bsp/imx-mkimage/imx8mm-var-dart/.
File Name |
Description |
---|---|
flash.bin | 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-imx8mm-var-dart.img.zst
var-recovery-image-imx8mm-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-imx8mm-var-dart.img.zst /dev/sdX
Using dd
(slower, writes the full image byte-by-byte)
zstdcat ./flexbuild/build_lsdk2412/images/var-recovery-image-imx8mm-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
Flashing the default img.zst images from Flexbuild results in a rootfs that does not utilize the entire SD card. This section explains how the SD card can be extended on the build host after flashing.
Procedure:
Begin with an SD card on which you have previously flashed a Flexbuild img.zst image. Ensure the SD card is inserted and the device present (i.e. /dev/sda, /dev/mmcblk0, etc.)
Start by running fdisk as below and typing "p" and enter to print current partitions. You should see a layout similar to below but numbers may differ depending on card sizes. Note that the partition starts at 16,384 (bytes offset 16384*512) which is to account for the boot content explained above.
$ sudo fdisk /dev/sdX Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sdX: 59.48 GiB, 63864569856 bytes, 124735488 sectors Disk model: MassStorageClass Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5ebf1617 Device Boot Start End Sectors Size Id Type /dev/sdX1 16384 15165439 15149056 7.2G 83 Linux
Next, run the following sequence of commands followed by enter with each step explained with a "-" to the right. Each command/input should be followed by enter:
- d - Delete current partition (1).
- n - Create a new parition.
- - Empty, hit enter only which will leave default response p for primary partition.
- - Empty, hit enter only which will leave default response 1 for first partition.
- 16384 - Enter 16384 to begin partition past bootloader section.
- - Empty, hit enter only which will leave last sector as default which should choose ending size of the SD card.
- N - Answers no to not remove the ext4 signature on the disk
- p - Print output and verify before we write. We should see the starting offset the same and the end expanded to fill the SD card.
- w - Write output to disk
See the full log of the above sequence below:
Command (m for help): d Selected partition 1 Partition 1 has been deleted. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): Using default response p. Partition number (1-4, default 1): First sector (2048-124735487, default 2048): 16384 Last sector, +/-sectors or +/-size{K,M,G,T,P} (16384-124735487, default 124735487): Created a new partition 1 of type 'Linux' and of size 59.5 GiB. Partition #1 contains a ext4 signature. Do you want to remove the signature? [Y]es/[N]o: N Command (m for help): p Disk /dev/sdX: 59.48 GiB, 63864569856 bytes, 124735488 sectors Disk model: MassStorageClass Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos identifier: 0x5ebf1617 Device Boot Start End Sectors Size Id Type /dev/sdX1 16384 124735487 124719104 59.5G 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
Finally, the file system needs to be resized on the disk to fill the now larger partition. Do that as follows:
$ sudo e2fsck -f /dev/sdX1 e2fsck 1.46.5 (30-Dec-2021) root: recovering journal Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information root: 43155/947488 files (0.1% non-contiguous), 674097/1893632 blocks $ sudo resize2fs /dev/sdX1 resize2fs 1.46.5 (30-Dec-2021) Resizing the filesystem on /dev/sdX1 to 15589888 (4k) blocks. The filesystem on /dev/sdX1 is now 15589888 (4k) blocks long. $ sync
Again, numbers and output should differ slightly depending on your card.
Your rootfs image should now fill the entire SD card and is ready to boot.
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):
$ setenv fdt_file undefined $ saveenv
To disable the automatic device tree selection in U-Boot, set the device tree file manually:
$ setenv fdt_file YOUR_DTB_FILE $ saveenv
Useful example: To list all files in the boot partition (where the dtb files are by default) of an SD card:
$ ls mmc 0:1
Flashing image to eMMC/internal storage
The flashing scripts are located on the SD card at /usr/bin/:
install_debian.sh - Flash Debian image into eMMC (Run and follow usage instructions)
More Info About Flexbuild
Please refer to the following resources:
- NXP Debian Linux SDK Distribution for i.MX and Layerscape
- i.MX Debian Linux SDK User's Guide
- Layerscape Debian Linux SDK User's Guide
Internal Documentation: