how to make sd image for BB AI 64

For Uboot, first I download and run “build.sh” from here:
sw/bootloader · main · BeagleBoard.org / BeagleBone AI-64 · GitLab

I got some .bin, u-boot.image… in ./sw/bootloader/deploy folder. Looks no errors

From kernel (I guess) I download and ran “jenkins_build.sh” from here:
Files · 5.10-arm64 · BeagleBoard.org / Linux · GitLab

Looks no error too, a lot of new files generated.

But I am not sure how to make SD image from these files. Is there any script or instruction that allow me to make SD image from what I built?

Many thanks

Hi @caccac268 ,

Assuming microSD = /dev/sdb, mounting as /media/boot/ and /media/rootfs…

Start with the dual partitions:

sudo sfdisk ${DISK} <<-__EOF__
1M,128M,0xC,*
129M,,,-
__EOF__

Format 1st partition, as fat16 for boot rom…

sudo mkfs.vfat -F 16 /dev/sdb1 -n FIRMWARE

Format 2nd Partition as ext4 (rootfs)

sudo mkfs.ext4 /dev/sdb2 -L rootfs

Copy Firmware/U-boot files to boot partition:

cp -v sysfw.itb /media/boot/
cp -v tiboot3.bin /media/boot/
cp -v tispl.bin /media/boot/
cp -v u-boot.img /media/boot/

For the rootfs, grab your favorite linux file system, if you need a base grab:

wget -c https://rcn-ee.net/rootfs/eewiki/minfs/debian-11.4-minimal-arm64-2022-08-05.tar.xz
tar xf debian-11.4-minimal-arm64-2022-08-05.tar.xz

and copy it on the root partition:

sudo tar xfvp ./debian-*-*-arm64-*/arm64-rootfs-*.tar -C /media/rootfs/
sync

Create extlinux.conf in boot partition, this is what tell u-boot what to load… /media/boot/extlinux/extlinux.conf

label Linux microSD
    kernel /Image
    append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
    fdtdir /

The default vmlinuz file created by the kernel builder needs to be uncompressed, save it as “Image”

cat /boot/vmlinuz-${version} | gunzip -d > /media/boot/Image

Next, copy the device tree and overlays, in the boot partition, it should look like this… Used “*” to hide repeats…

debian@BeagleBone:~/$ tree /media/boot/
/media/boot/
├── Image
├── extlinux
│   └── extlinux.conf
├── k3-j721e-*.dtb
├── overlays
│   └── *.dtbo
├── sysfw.itb
├── tiboot3.bin
├── tispl.bin
└── u-boot.img

Regards,

2 Likes

Thanks Robert, the instruction was very clear, so we got boot with custom image.

But when we try to call “sudo apt update”, the system says 30: read-only file system, I guess it could be bad SD card?

image

By the way, does your instructions about installing usb gadget on BBB still work on BB AI 64?

image

did you set /etc/fstab?

/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

Yes, designed to share the same setup.

Regards,

When I tried to add /ete/fstab file

this error happened:

image

I already changed mmcblk0p to mmcblk1p because I think I am on SD, is it correct?

/dev/mmcblk1p2  /  ext4  noatime,errors=remount-ro  0  1
/dev/mmcblk1p1  /boot/firmware vfat defaults 0 0
debugfs  /sys/kernel/debug  debugfs  mode=755,uid=root,gid=gpio,defaults  0  0

Also

sudo mkfs.vfat -F 16 /dev/sdb1 -n FIRMWARE

Should it be :

sudo mkfs.vfat -F 16 /dev/sdb1 -n boot

codepage cp437 not found okay, it’ll convert that into a built-in vs’s a module… So just drop the fat loading in etc/fstab then…

You are correct, /dev/mmcblk0 would be the eMMC…

Regards,

Hi,

I got “sudo apt update” working,

but usb-gadget doesn’t work yet. On BBB I just ran your instructions. Looks like on custom BBAI64 from two links above, there is no usb gadget driver in kernel yet?

Seems I didn’t build kernel modules yet :)).

Once you have the board booted… From the kernel build script just build the *.deb file… Copy it over and install with dpkg, everything will get installed in the correct location…

Regards,

Hi, I got usb eth working by run this command from PC with SD inserted, with the path from where I built kernel.

make INSTALL_MOD_PATH=/media/rootfs   modules_install 

just want to learn more about

Do you mean on BBAI-64 or on host PC? I mean, could you please tell a bit more about the path of *.deb file and path of the script please?

So on the same machine you ran, ./build_kernel.sh, now just run: ./tools/rebuild_deb.sh, let it run, then copy the linux-image*.deb generated under ./deploy/ to the target board, and then run: sudo dpkg -i linux-image*.deb and reboot…

Regards,

Yes, thank you so much!