# U-BOOT flashing for bare metal BeagleBone Black

**URL:** <https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511>\
**Category:** Linux Discussions\
**Created:** [July 21, 2020, 8:36pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511 "2020-07-21T20:36:42Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [July 21, 2020, 8:36pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/1 "2020-07-21T20:36:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobertCNelson](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/robertcnelson/32/12_2.png) [@RobertCNelson](https://forum.digikey.com/u/RobertCNelson)\
**Post date:** [July 21, 2020, 8:54pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/2 "2020-07-21T20:54:19Z")

</div>

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.

```auto
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](https://www.digikey.com/eewiki/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSDcard)

Regards,

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [July 21, 2020, 8:57pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/3 "2020-07-21T20:57:50Z")

</div>

Robert,

Appreciated.

Best Regards,

David

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [July 22, 2020, 2:26pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/4 "2020-07-22T14:26:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobertCNelson](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/robertcnelson/32/12_2.png) [@RobertCNelson](https://forum.digikey.com/u/RobertCNelson)\
**Post date:** [July 22, 2020, 2:33pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/5 "2020-07-22T14:33:06Z")

</div>

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

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

```

Regards,

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [July 22, 2020, 4:25pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/6 "2020-07-22T16:25:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobertCNelson](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/robertcnelson/32/12_2.png) [@RobertCNelson](https://forum.digikey.com/u/RobertCNelson)\
**Post date:** [July 22, 2020, 4:30pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/7 "2020-07-22T16:30:37Z")

</div>

Hi @dzhou , by default:

```auto
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,

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [July 22, 2020, 4:37pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/8 "2020-07-22T16:37:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [July 22, 2020, 7:18pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/9 "2020-07-22T19:18:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobertCNelson](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/robertcnelson/32/12_2.png) [@RobertCNelson](https://forum.digikey.com/u/RobertCNelson)\
**Post date:** [July 22, 2020, 8:04pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/10 "2020-07-22T20:04:50Z")

</div>

> [@dzhou](#):
>
> u-boot.img

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:

```auto
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,

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [August 12, 2020, 6:38pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/11 "2020-08-12T18:38:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobertCNelson](https://sea2.discourse-cdn.com/digikey/user_avatar/forum.digikey.com/robertcnelson/32/12_2.png) [@RobertCNelson](https://forum.digikey.com/u/RobertCNelson)\
**Post date:** [August 12, 2020, 7:44pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/12 "2020-08-12T19:44:30Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![dzhou](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@dzhou](https://forum.digikey.com/u/dzhou)\
**Post date:** [August 12, 2020, 8:19pm UTC](https://forum.digikey.com/t/u-boot-flashing-for-bare-metal-beaglebone-black/7511/13 "2020-08-12T20:19:15Z")

</div>

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
