U-BOOT flashing for bare metal BeagleBone Black

Hi,

The bare metal debian image is flashed through micro usb. I believe the uboot flashing is a separate process. I really haven’t studied this much. I am wandering what’s the easiest way to flash into eMMC ( I assume it is in the eMMC).

Thank you,

David

Hi @dzhou , that procedure exports the eMMC as an emulated “usb flash” drive. If you run lsblk you should see a new device. Then just write the two u-boot binaries like normal.

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

https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSDcard

Regards,

Robert,

Appreciated.

Best Regards,

David

Hi Robert,

u-boot is flashed without any problems. Thank you very much.

I am also wandering that debian image (e.g. bone-debian-10.4-iot…img.xz) shall be able to flash into eMMC using dd instead of using Etcher program. if so, could you provide with dd command settings, such as count, seek, bs, etc. I think Etcher may be slower then dd, and it seems to be mandatory for verifying the flashing step. I am not sure verifying the flashing is necessary.

Best Regards,
David

Oh Etcher is way faster then dd. :wink: Just use dd in it’s default mode:

xzcat bone-*.img.xz | sudo dd of=/dev/sdX

Regards,

Hi Robert,

The u-boot is flashed into eMMC. I am not sure where is the u-boot environment data stored in the eMMC? NXP IMX SOMs has environment a separate partition (using UBI format for flash partitions). I still don’t have full picture of environment/u-boot under ti-BBB platform. I hope you can give me a quick guide (or good links of resources) to shed some light on this subject.

Regards,

David

Hi @dzhou , by default:

CONFIG_ENV_IS_IN_EXT4=y
CONFIG_ENV_EXT4_INTERFACE="mmc"
CONFIG_ENV_EXT4_DEVICE_AND_PART="0:1"
CONFIG_ENV_EXT4_FILE="/boot/uboot.env"

Device 0, Partition 1, ext4 file system, file: /boot/uboot.env

Off the top of my head, i don’t remember if device 0 is microSD or eMMC…

Regards,

Robert,

Thank you. Somehow, I think I remember the eMMC and microSD device number is in reverse order ( eMMC dev as 1, micro SD dev as 0) on BBB. I thought it is a little odd default to that way, so I had it remembered.

Regards,
David

Hi Robert,

I try to mount u-boot.img. Here is what I used:

/sbin/fdisk -l u-boot.img
Disk u-boot.img: 760 KiB, 778240 bytes, 1520 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

$ sudo mount -t ext3 -o loop,offset=0 u-boot.img /mnt/tmp
mount: /mnt/tmp: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

I was wandering what is the file system for the generated u-boot.img or is it possible that u-boot.img can be mounted and edited.

Thank you,
David

In the case of this project, the *.img in u-boot.img does not reference a archive “image”. In the scope of the U-Boot Project, u-boot.img is simply “A U-Boot image with a mkimage header prepended.” commonly generated from u-boot.bin, which is known as “The raw U-Boot image”.

You can use the mkimage tool to read the header off of u-boot.img:

mkimage -l u-boot.img 
Image Name:   U-Boot 2019.04-dirty for am335x 
Created:      Wed Jul 22 15:02:21 2020
Image Type:   ARM U-Boot Firmware (uncompressed)
Data Size:    474208 Bytes = 463.09 KiB = 0.45 MiB
Load Address: 80800000
Entry Point:  00000000

Regards,

Hi Robert,

I am wandering there is a way to flash u-boot using BalenaEtcher tool instead of the commands above as you posted.

Thank you for your support,

David

Hi @dzhou, So BalenaEtcher needs to see a raw usb flash drive. So first you’ll need to get u-boot up and running on the device. Then have the device export the storage medium over usb to the PC running BalenaEtcher.

Regards,

Hi Robert,

I guess it may be not easy thing to do. The raw usb flash drive is instantiated ( as rootfs). The device /dev/[sdb] is for u-boot and /dev/[sdb1] is rootfs partition, I believe. But

  1. the BalenaEtcher only selects rootfs (currently). There is no option for
    /dev/sdb ?
  2. How to import image files [MLO and u-boot.img] into BalenaEtcher?
    Or is there a way to combine and convert image format for Etcher?

Best Regards,

David