I have an SD card with a standard Beaglebone Debian image. I also have the MLO
and u-boot.img
files from building u-boot. I'd like to install the new u-boot on the SD card and then flash the modified image to MMC on a Beaglebone Black.
I can flash onboard MMC from the SD card just fine. I can also connect to the board over serial and stop in u-boot.
What I don't know how to do is write the new u-boot to the SD card correctly. I've tried a few things:
These elinux instructions are for erasing the SD card and creating a new bootable partition. I didn't actually try this because I want to install the new u-boot to an existing image.
$ echo -e "o\nn\np\n1\n\n+64M\na\n1\nt\nc\nw\n" | sudo fdisk /dev/MYDISK ; sudo fdisk /dev/MYDISK -l $ sudo mount /dev/MYDISK /mnt $ sudo cp MLO /mnt $ sudo cp u-boot.img /mnt $ sudo sync $ sudo umount /mnt
These digikey instructions are a different version of the same thing. I tried writing MLO and u-boot.img in this way, without erasing the disk, but the board still boots using the original u-boot instead of the new one.
$ sudo dd if=/dev/zero of=${DISK} bs=1M count=10 $ sudo dd if=./u-boot/MLO of=${DISK} count=1 seek=1 bs=128k $ sudo dd if=./u-boot/u-boot.img of=${DISK} count=2 seek=1 bs=384k
These beyondlogic instructions have a slightly different pair of dd commands. I tried these as well, but again the board still boot susing the original u-boot.
$ sudo dd if=MLO of=/dev/sdb bs=512 seek=256 count=256 conv=notrunc $ sudo dd if=u-boot.img of=/dev/sdb bs=512 seek=768 count=1024 conv=notrunc $ sudo blockdev --flushbufs /dev/sdb
Someone suggested that I write the new u-boot to MMC using tftp. Can I use the same procedure to write to the SD card? If so, how do I find the start addresses? And how to I load and write the files? I tried searching, but I didn't find what I needed.
- boot into u-boot - discover the existing MLO and uboot.img start addresses - load the new MLO and uboot.img into RAM using tftp - write the new MLO and uboot.img to the correct location in MMC
Additional Notes
- Ideally, I would like to write the new u-boot to the SD card and test it without flashing. Supposedly the beaglebone will boot the SD card u-boot (instead of the MMC u-boot) if you press S2 when you supply power, but I'm not sure if that is working. How can I tell which u-boot is loaded?
- However, I can write the MMC image to an SD card, so it would also work to write the new u-boot to MMC and test that.
- Lastly, I'm willing to erase the SD card, write u-boot with one of the above methods, and manually setup/write the partitions if I have to. Is that the only way to do this?
SD Card / Image
The SD card contains the Debian 7.9 2015-11-12 firmware image from beagleboard latest images.
This is the partition table.
Model: Generic- USB3.0 CRW -SD (scsi)
Disk /dev/sdb: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 102MB 101MB primary fat16 boot, lba
2 102MB 3565MB 3463MB primary ext4
The boot partition does not contain MLO or u-boot.img files to replace:
total 96
drwxr-xr-x 2 root root 2048 Nov 12 2015 App
-rwxr-xr-x 1 root root 288 Nov 12 2015 autorun.inf
drwxr-xr-x 4 root root 2048 Nov 12 2015 Docs
drwxr-xr-x 5 root root 2048 Nov 12 2015 Drivers
-rwxr-xr-x 1 root root 40 Nov 12 2015 ID.txt
-rwxr-xr-x 1 root root 41174 Nov 12 2015 LICENSE.txt
-rwxr-xr-x 1 root root 1008 Nov 12 2015 nfs-uEnv.txt
-rwxr-xr-x 1 root root 16838 Nov 12 2015 README.htm
-rwxr-xr-x 1 root root 428 Nov 12 2015 README.md
drwxr-xr-x 2 root root 2048 Nov 12 2015 scripts
-rwxr-xr-x 1 root root 16838 Nov 12 2015 START.htm
-rwxr-xr-x 1 root root 1179 Nov 12 2015 uEnv.txt