- 17 Jan 2025
- 3 Minutes to read
- Print
- DarkLight
- PDF
How to build and deplay Debian using flexbuild
- Updated on 17 Jan 2025
- 3 Minutes to read
- Print
- DarkLight
- PDF
Build Debian using flexbuild
Github page for tn_debian_flexbuild
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
Get source code
$ git clone https://github.com/TechNexion/tn_debian_flexbuild.git
$ cd tn_debian_flexbuild
Setup docker for build env
Host:
$ . setup.env
$ bld docker (create or attach to docker)
in docker:
( check if the prompt is [root@fbdebian tn_debian_flexbuild]
)
$ . setup.env
$ bld host-dep (install docker dependent packages)
Select one of the following:
A. build debian12 of target board automatically
===EDM-G-IMX8MP===
$ bld -m imx8mp-edm-g
===EDM-G-IMX8MM===
$ bld -m imx8mm-edm-g
B. step by step build debian12
Use -p IMX
will build all platforms of the i.MX.
Swap -p IMX
to -m <machine>
to contain only that machine's components.
General RootFS
- download RootFS
- build NXP-specific components(apps)
- merge
- pack RootFS
# create general rootfs with NXP-specific components all IMX platforms
$ bld rfs -p IMX # create rootfs with debian desktop, for other rootfs: [-r debian:server | -r debian:base | -r poky:tiny ]
$ bld apps -p IMX # create NXP-specific components(apps) for all IMX platforms, depends on rootfs created above
$ bld merge-apps -p IMX # merge NXP-specific components(apps) to rootfs.
$ bld packrfs -p IMX # pack rootfs to 'build_lsdk2412>/images/'
Boot partition
# create all boot image for all IMX platforms
$ bld boot -p IMX # create boot partitions for all IMX pltforms to 'build_lsdk2412>/images/'
Bootable firmware
# create all firmware image for all IMX platforms
$ bld fwall -p IMX # create all fw for all IMX platforms to 'build_lsdk2412>/images/'
C. using others build command:
Check in Github page
Deploy (flex-installer) into device:
( flex-installer
is in PATH when running $ . setenv
.
If you don't, need to swap flex-installer
to ./flex-installer
)
Each debian image in flexbuild contain 3 files, all of them presents in build_lsdk2412/images/
if you follow the build step above.
- bootable firmware (
firmware_<machine>_sdboot.img
) - boot partition (
boot_IMX_arm64_<machine>_lts_6.6.52.tar.zst
) - General RootFS (
rootfs_lsdk2412_debian_desktop_arm64.tar.zst
)
For different flexbuild version, some of the name would changes.
Please adjust name by following rules:
2412
stands for flexbuild-v24.12.boot_IMX_arm64
is the name of debian12.6.6.52
is the kernel version.desktop
is default distro(desktop | server | base)
Or follow the github page guide.
Go to build image folder
$ cd build_lsdk2412/images/
Flash directly to block device(/dev/sd):
Format block device
$ flex-installer -i pf -d /dev/sd<x>
== For EDM-G-IMX8MP ==
$ flex-installer -m imx8mp-edm-g -d /dev/sd<X> -b boot_IMX_arm64_imx8mp-edm-g_lts_6.6.52 -f firmware_imx8mp-edm-g_sdboot.img -r rootfs_lsdk2412_debian_desktop_arm64.tar.zst
== For EDM-G-IMX8MM ==
$ flex-installer -m imx8mm-edm-g -d /dev/sd<X> -b boot_IMX_arm64_imx8mm-edm-g_lts_6.6.52 -f firmware_imx8mm-edm-g_sdboot.img -r rootfs_l2412_debian_desktop_arm64.tar.zst
Create sdcard image (8GB size image named sdcard.wic):
== For EDM-G-IMX8MP ==
$ flex-installer -m imx8mp-edm-g -i mkwic -b boot_IMX_arm64_imx8mp-edm-g_lts_6.6.52 -f firmware_imx8mp-edm-g_sdboot.img -r rootfs_lsdk2412_debian_desktop_arm64.tar.zst
== For EDM-G-IMX8MM ==
$ flex-installer -m imx8mm-edm-g -i mkwic -b boot_IMX_arm64_imx8mm-edm-g_lts_6.6.52 -f firmware_imx8mm-edm-g_sdboot.img -r rootfs_lsdk2412_debian_desktop_arm64.tar.zst
Swap the uboot/ kernel
Modify the config file:
$ vim configs/technexion.yml
Change the repository(url:
) and version (tag:
or branch:
or commit:
)
Delete the previous repository and build result if needed:
# linux
$ bld clean-linux -p IMX
$ rm -rf build_lsdk2412/images/boot_IMX_arm64_*
$ rm -rf components_lsdk2412/linux/linux/
# uboot
$ bld clean-bsp -p IMX
$ rm -rf build_lsdk2412/images/firmware_*
$ rm -rf components_lsdk2412/bsp/uboot/
modify the patches if needed
When you change the kernel/uboot, you might face the patch conflict issue.
You might need to adjust or remove the patches in these folder:
$ ls -la patch/linux/
$ ls -la patch/uboot/
Trouble shooting
Custom board can't boot into uboot
Might facing the nameing check in src/bsp/imx_mkimage.mk
cause generate flash.bin
not correctly.
Build failed for machine learning(ml) components
As for ml Makefile, NXP does not fully isolated the build environment.
Leads to build failed in some of the computers.
For now, disable the ml by applying this patch:
$ wget https://ftp.technexion.com/development_resources/NXP/debian/0001-flexbuild-disable-ml-component.patch
$ git am 0001-flexbuild-disable-ml-component.patch
For most use case, login using debian
is enough.
root
does not able to access the desktop session.
debian
user has root
permission, but some of the command still need to add sudo
prefix.