1. Download the img file from official website (https://debix.io/Software/downloadn.html). For example, download a Debix-Model-A.img file.
2. Copy it to the ubuntu system.
3. Remount command:
$ mkdir root boot
$ sudo losetup -f --show Debix-Model-A.img
[sudo] password for debix:
/dev/loop0 --ps. Loop0 is return point
$ sudo kpartx -va /dev/loop0
$ sudo mount /dev/mapper/loop0p2 root/
$ sudo mount /dev/mapper/loop0p1 boot/
NOTE:boot partition stores the kernel file
root partition stores the file system
4. Flash uboot to img.
sudo dd if=imx-boot-imx8mpevk-sd.bin-flash_evk of=/dev/loop0 bs=1k seek=32 conv=fsync
5. Copy the kernel file.
a. Copy the Image and dtb files to the boot partition
b. Copy modules to root/lib/modules
6. Copy the custom img to the root partition.
7. Unmount.
$ sudo umount root boot
$ sudo kpartx -d /dev/loop0
$ sudo losetup -d /dev/loop0