How to flash custom BBB image created with Buildroot into eMMC?

Hi,

I’ve created custom BBB image with the Buildroot.

My build:

Buildroot: 2017.02-rc1
Toolchain: gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf
Kernel: 4.8.11 (omap2plus + modified em335x-boneblack.dtb)
U-boot: 2017.03-rc2 + patch: //rcn-ee.com/repos/git/u-boot-patches/v2017.03-rc2/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
=> MLO + uImage.img copied to SD card with the following commands

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

My build is working just fine when booted from a SD card.

My problem:
The next step would be to flash the image into eMMC but I do not know how to do it.

I have tried to find a simple tool that could be used to flash/copy image into eMMC - so far no success.

  1. I have found the flashing script “bbb-eMMC-flasher-eewiki-ext4.sh” by Robert C Nelson.

Only problem is that there is the following requirement:
#This script assumes, these packages are installed, as network may not be setup
#dosfstools initramfs-tools rsync u-boot-tools

I’m able to find all packages except the “initramsfs-tools” from the Buildroot. As a Linux noob I do not know how to install the “initramfs-tools” to my RFS image => cannot use the script.

  1. Then I’ve found the “Beagle Bone Black Linux Flash System” from here: http://ungureanuvladvictor.github.io/BBBlfs/
    But, I have not managed to get it build. The Bbblfs seems to be quite old (2013) so I do not know would it even work any more?

So folks, are suggestions/hints how to flash custom image into eMMC of BBB/BBG?

  • hints how to install initramfs-tools to custom image?
  • hints about steps needed to get the Bbbfls to build?
  • something else?

BR
-timo-

Update

I managed to get BBBfls running and tried it ( http://ungureanuvladvictor.github.io/BBBlfs/) - “option 2”

  • xz image created with buildroot. Image is booting fine from SD card (based on latest Buildroot Beaglebone_defconfig)

End result was fail, unfortunately.

The BBBlfs complains about bad magic blocks. But, before flashing the eMMC contained well working debian image.
Copied below printout of the flash_script.sh

timo@L450:~/BBBlfs/bin$ ./flash_script.sh …/…/bldr_lab/bbb/images/rootfs.tar.xz

We are flashing this all mighty BeagleBone Black with the image from …/…/bldr_lab/bbb/images/rootfs.tar.xz!
Please do not insert any USB Sticks or mount external hdd during the procedure.

When the BeagleBone Black is connected in USB Boot mode press [yY].y

Putting the BeagleBone Black into flashing mode!

SPL has started!

U-Boot has started! Sending now the FIT image!

Waiting for the BeagleBone Black to be mounted…
Are you sure the BeagleBone Black is mounted at /dev/sdb?[yY]y
umount: /dev/sdb2: not mounted
Flashing now, be patient. It will take ~5 minutes!

0+23396 records in
0+23396 records out
191928320 bytes (192 MB, 183 MiB) copied, 29,5878 s, 6,5 MB/s

Resizing partitons now, just as a saefty measure if you flash 2GB image on 4GB board!
No partition is defined yet!
Could not delete partition 1
2: unknown command
e2fsck 1.42.13 (17-May-2015)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks…
e2fsck: Bad magic number in super-block while trying to open /dev/sdb2

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193
or
e2fsck -b 32768

resize2fs 1.42.13 (17-May-2015)
resize2fs: Bad magic number in super-block while trying to open /dev/sdb2
Couldn’t find valid filesystem superblock.

Please remove power from your board and plug it again. You will boot in the new OS!

-timo-

perjantai 24. helmikuuta 2017 15.44.59 UTC+2 Timo Välimäki kirjoitti: