AI-64 omap-image-builder | SD-Card to eMMC write error

Hello,
I have generated a boot image for Beaglebone AI-64 using omap-image-builder.
Following commands are executed for generating the boot image (SD-Card Image):

./RootStock-NG.sh -c bb.org-debian-bullseye-xfce-edgeai-v5.10-ti-arm64.conf

cd deploy/debian-11.4-xfce-edgeai-arm64-2022-07-29/

sudo ./setup_sdcard.sh --img-10gb bbai64-debian-11.4-yantrr-2022-07-29 --dtb hwpack/j721e-evm.conf --distro-bootloader --hostname yantrr

On booting with above SD-card boot image, I tried to flash it on eMMC using command beagle-flasher but getting following output with error and eMMC flashing is failed.

--------------------------------------------------------------------------------
Version: [1.20220112.0: add cleanup grow_partition.service and beagle-flasher-init-shutdown.service...]
--------------------------------------------------------------------------------
cat /etc/default/beagle-flasher:
--------------------------------------------------------------------------------
source=/dev/mmcblk1
destination=/dev/mmcblk0
rfs_partition=dual
rfs_boot_startmb=1
rfs_boot_size_mb=128
bootloader=/opt/u-boot/bb-u-boot-beagleboneai64/install-emmc.sh
flash_back=bbai64-emmc-to-microsd
extlinux=/opt/u-boot/bb-u-boot-beagleboneai64/emmc-extlinux.conf
--------------------------------------------------------------------------------
INFO: [lsblk -i]
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0      179:0    0 14.6G  0 disk 
|-mmcblk0p1  179:1    0  128M  0 part 
`-mmcblk0p2  179:2    0 14.5G  0 part 
mmcblk0boot0 179:256  0    4M  1 disk 
mmcblk0boot1 179:512  0    4M  1 disk 
mmcblk1      179:768  0 29.7G  0 disk 
|-mmcblk1p1  179:769  0  128M  0 part /boot/firmware
`-mmcblk1p2  179:770  0 29.6G  0 part /
--------------------------------------------------------------------------------
INFO: copying [/dev/mmcblk1] -> [/dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: [source=/dev/mmcblk1] is a valid block device
INFO: [destination=/dev/mmcblk0] is a valid block device
INFO: [/boot/config-5.10.120-ti-arm64-r55]
INFO: Generating: [/boot/initrd.img-5.10.120-ti-arm64-r55]
update-initramfs: Generating /boot/initrd.img-5.10.120-ti-arm64-r55
W: Possible missing firmware /lib/firmware/xc3028L-v36.fw for built-in driver tuner_xc2028
W: Possible missing firmware /lib/firmware/xc3028-v27.fw for built-in driver tuner_xc2028
W: Possible missing firmware /lib/firmware/dvb-fe-xc4000-1.4.fw for built-in driver xc4000
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Erasing: [/dev/mmcblk0]
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: [dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=148 status=progress]
148+0 records in
148+0 records out
155189248 bytes (155 MB, 148 MiB) copied, 7.21949 s, 21.5 MB/s
--------------------------------------------------------------------------------
INFO: [dd if=/dev/mmcblk0 of=/dev/null bs=1M count=148 status=progress]
148+0 records in
148+0 records out
155189248 bytes (155 MB, 148 MiB) copied, 0.875302 s, 177 MB/s
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Erasing: [/dev/mmcblk0] complete
--------------------------------------------------------------------------------
INFO: [/bin/bash /opt/u-boot/bb-u-boot-beagleboneai64/install-emmc.sh]
Changing ext_csd[BOOT_BUS_CONDITIONS] from 0x02 to 0x02
H/W Reset is already permanently enabled on /dev/mmcblk0
Clearing eMMC boot0
dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k
32+0 records in
32+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.545392 s, 7.7 MB/s
dd if=/opt/u-boot/bb-u-boot-beagleboneai64/tiboot3.bin of=/dev/mmcblk0boot0 bs=128k
2+1 records in
2+1 records out
283940 bytes (284 kB, 277 KiB) copied, 1.13096 s, 251 kB/s
--------------------------------------------------------------------------------
INFO: Partitioning: /dev/mmcblk0
INFO: /sbin/sfdisk: [sfdisk from util-linux 2.36.1]
INFO: /sbin/sfdisk: [/sbin/sfdisk --force /dev/mmcblk0]
INFO: /sbin/sfdisk: [1M,128M,0xc,*]
INFO: /sbin/sfdisk: [129M,,,-]
--------------------------------------------------------------------------------
Checking that no-one is using this disk right now ... OK

Disk /dev/mmcblk0: 14.6 GiB, 15678308352 bytes, 30621696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Created a new DOS disklabel with disk identifier 0x15723759.
/dev/mmcblk0p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 128 MiB.
/dev/mmcblk0p2: Created a new partition 2 of type 'Linux' and of size 14.5 GiB.
/dev/mmcblk0p3: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x15723759

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *      2048   264191   262144  128M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      264192 30621695 30357504 14.5G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Formatting: /dev/mmcblk0
/sbin/mkfs.vfat -F 16 /dev/mmcblk0p1 -n FIRMWARE
mkfs.fat 4.2 (2021-01-31)
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
/sbin/mkfs.ext4  /dev/mmcblk0p2 -L rootfs
mke2fs 1.46.2 (28-Feb-2021)
Discarding device blocks: done                            
Creating filesystem with 3794688 4k blocks and 950272 inodes
Filesystem UUID: 77d47938-a59f-4afb-920f-c72d3d006f34
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done   

--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Formatting: /dev/mmcblk0 complete
--------------------------------------------------------------------------------
Copying: /dev/mmcblk1p1 -> /dev/mmcblk0p1
rsync: /boot/firmware/ -> /tmp/boot/
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: [/boot/extlinux/extlinux.conf]
'/opt/u-boot/bb-u-boot-beagleboneai64/emmc-extlinux.conf' -> '/tmp/boot/extlinux/extlinux.conf'
INFO: [cat /tmp/boot/extlinux/extlinux.conf]
label Linux eMMC
    kernel /Image
    append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait net.ifnames=0
    fdtdir /
    initrd /initrd.img
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Copying: /dev/mmcblk1p2 -> /dev/mmcblk0p2
INFO: [mount /dev/mmcblk0p2 /tmp/rootfs/ -o async,noatime]
INFO: /usr/bin/rsync: [/ -> /tmp/rootfs/]
          9.20G  99%   19.61MB/s    0:07:27 (xfr#160739, to-chk=0/187310)   
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Copying: Kernel modules
INFO: /usr/bin/rsync: /lib/modules/5.10.120-ti-arm64-r55/ -> /tmp/rootfs/lib/modules/5.10.120-ti-arm64-r55/
         31.06M 100%   14.26MB/s    0:00:02 (xfr#2468, to-chk=0/2917)   
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: Generating: /etc/fstab
INFO: [cat /tmp/rootfs/etc/fstab]
# /etc/fstab: static file system information.
#
/dev/mmcblk0p2  /  ext4  noatime,errors=remount-ro  0  1
/dev/mmcblk0p1  /boot/firmware vfat defaults 0 0
debugfs  /sys/kernel/debug  debugfs  mode=755,uid=root,gid=gpio,defaults  0  0
--------------------------------------------------------------------------------
INFO: [cp -v /etc/beagle-flasher/bbai64-emmc-to-microsd /tmp/rootfs/etc/default/beagle-flasher]
'/etc/beagle-flasher/bbai64-emmc-to-microsd' -> '/tmp/rootfs/etc/default/beagle-flasher'
--------------------------------------------------------------------------------
INFO: [cat /tmp/rootfs/etc/default/generic-sys-mods]
#This file is sourced by /usb/bin/bb-growpart
ROOT_DRIVE=/dev/mmcblk0
ROOT_PARTITION=2
--------------------------------------------------------------------------------
Copying: /dev/mmcblk1p2 -> /dev/mmcblk0p2 complete
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
INFO: [umount /tmp/rootfs/ || umount -l /tmp/rootfs/ || write_failure]
--------------------------------------------------------------------------------
INFO: Force writeback of eMMC buffers by Syncing: /dev/mmcblk0
INFO: [dd if=/dev/mmcblk0 of=/dev/null count=100000 status=progress]
100000+0 records in
100000+0 records out
51200000 bytes (51 MB, 49 MiB) copied, 0.345683 s, 148 MB/s
--------------------------------------------------------------------------------
INFO: flush_cache: [blockdev --flushbufs /dev/mmcblk0]
--------------------------------------------------------------------------------
/usr/sbin/beagle-flasher: line 89: echo: write error: Invalid argument
root@yantrr:~# 

Did I miss any step while generating boot image using omap-image-builder?
Any solution to resolve this issue?

Hi @Vaibhav i fixed that last night:

The script was actually done, the last thing it does is reset the led’s back to default before dumping you back to user-space…

ps: you can pass --enable-extlinux-flasher to ./setup_sdcard.sh to create a flasher *.img file…

Regards,

Hi @RobertCNelson
Thanks for quick response. The issue got resolved after pulling the latest updates.