U-boot is an open-source boot loader used in embedded devices such as the Beaglebone Black. Like many other boot loaders, it can be configured to have different behaviors. However, saving the configuration may not be as straightforward as it seems. In this article, the issues I encountered and the corresponding solutions are documented, hopefully they can be helpful for others.
The u-boot that came with the board is compiled to save its configurations to the SD card, regardless of the availability. Thus, running saveenv without one will generate a "Card did not respond to voltage selected" error. This problem can be solved by adding an SD card or flashing the firmware. The second solution can be found on Bootlin's github: https://github.com/bootlin/training-materials/tree/master/lab-data/common/bootloader/beaglebone-black The first solution is introduced below.
Beaglebone Black development board, PC running on Ubuntu (ver 20.04)
Serial to USB cable, USB type A to mini-B cable, micro SD card (SDHC) and adapter
Find the name of your card by running lsblk / fdisk -l / dmesg or checking under /dev.
Wipe out the data from the card:
dd if=/dev/zero of=/dev/$name-of-your-card$ bs=$size-dependent$ count=$size-dependent$
Create a GPT partition table with:
parted /dev/$name-of-your-card$ --script -- mklabel gpt
Create one EXT4 partition that takes all the space:
parted /dev/$name-of-your-card$ --script -- mkpart primary ext4 0% 100%
Format the partition:
mkfs.ext4 -F /dev/$name-of-your-card$
Create a file named uEnv.txt in the SD card with the following content:
mmcdev=1
bootpart=1:2
mmcroot=/dev/mmcblk1p2 ro
optargs=quiet
In the /etc/fstab file of your board, add:
/dev/mmcblk0p1 /media/data auto rw 0 0
U-boot is not compatible with checksum, thus it has to be disabled.
First, validate your card with:
fsck /dev/$name-of-your-card-partition$
Then disable checksum with:
tune2fs -O ^metadata_csum /dev/$name-of-your-card-partition$
U-boot reads and writes the configuration file to /boot directory, if it does not exist, an "Invalid path" error will be generated.
Create /boot directory in your SD card with:
mkdir boot
Now, the saveenv command should be able to complete without error, and the configuration will be saved to the SD card.
- https://forum.digikey.com/t/question-for-card-did-not-respond-to-voltage-select/2763
- https://forum.beagleboard.org/t/strip-down-beaglebone-ai-to-save-costs/31517/6
- https://www.ti.com/lit/ds/symlink/am3359.pdf
- https://forum.beagleboard.org/t/surely-a-faq-but-i-cant-find-the-answer-maximum-sd-card-size-for-bbb/533
- https://groups.google.com/g/beagleboard/c/rK3y2ih1kig
- https://linuxize.com/post/how-to-format-usb-sd-card-linux/
- https://superuser.com/questions/923744/unable-to-format-partitioned-32-gb-micro-sd-card
- https://ext4.wiki.kernel.org/index.php/Ext4_Metadata_Checksums
- https://elinux.org/Beagleboard:MicroSD_As_Extra_Storage
- https://stackoverflow.com/questions/30857575/using-sd-card-as-external-storage-for-beaglebone-black