Debian Build Release Flexbuild: Difference between revisions
No edit summary |
No edit summary |
||
Line 99: | Line 99: | ||
== Boot the board with a bootable SD card == | == Boot the board with a bootable SD card == | ||
=== Setting the Boot Mode === | === Setting the Boot Mode === | ||
{{#lst:Yocto_Platform_Customization|{{#var:YOCTO_BOOT_BOARD_SECTION}}}} | |||
== More Info About Flexbuild == | == More Info About Flexbuild == |
Revision as of 20:42, 29 May 2025
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.
With flex-installer, users can also easily install various distros to the target storage device (SD/eMMC card or USB/SATA disk) on the target board or on a host machine.
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 Usage
$ cd flexbuild $ . setup.env (in host environment) $ bld docker (create or attach to docker) $ . setup.env (in docker environment) $ bld host-dep (install host dependent packages)
Build Desktop Debian Image
After the FlexBuild setup, you can skip the full setup and just run:
$ 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
Using the default configuration, this will produce an output to the build folder of "./build_lsdk2412/linux/linux/arm64/IMX/var-recovery-image-imx8mm-var-dart.img.zst" that can be flashed to the SD card.
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 entire image)
zstdcat ./flexbuild/build_lsdk2412/images/var-recovery-image-imx8mm-var-dart.img.zst
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.
SW7 0 : Boot from SD card 1 : Boot from eMMC
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: