Transfer SD to eMMC from command line ?

Doing an online course, i’ve kinda screw up my MBR on my BBB eMMC and i’m unable to restore it.

I’ve managed to build a 5.10 kernel that boots fine from SD card.
I know there used to be a script that can be run manually from BBB shell that ‘copy’ the SD boot and rootFS to the eMMC but can’t seem to find it.

I have not managed yet to build a ‘flasher’ image, i would like to learn to do it from command line.

I tried this script

root@beaglebone:/mnt# ./
: invalid option

Any help appreciated.


HI @philippe-brodeur, there are a lot of small details to take in consideration…

What image are you working with?

Please report iether:

 sudo beagle-version

or the other older:

sudo /opt/scripts/tools/

and you partition layout;



Here is the output of the old command (the new is not found):

root@beaglebone:/opt/scripts/tools# ./
dogtag:[ Debian Buster IoT Image 2020-04-06]
UBOOT: Booted Device-Tree:[am335x-boneblack.dts]
/boot/uEnv.txt Settings:
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlyprintk mem=512M]
dmesg | grep remote
[   34.956044] remoteproc remoteproc0: wkup_m3 is available
[   35.192603] remoteproc remoteproc0: powering up wkup_m3
[   35.215325] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   35.255587] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   72.421692] remoteproc remoteproc1: is available
[   72.491942] remoteproc remoteproc2: is available
dmesg | grep pru
[   72.421692] remoteproc remoteproc1: is available
[   72.491942] remoteproc remoteproc2: is available
dmesg | grep pinctrl-single
[    3.849818] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Interesting! You’ve done a few modifications to the “[ Debian Buster IoT Image 2020-04-06]”… First i don’t see you version of u-boot, your kernel 5.10.87 doesn’t need the overlays and they didn’t load… Your rootfs is on mmcblk0p2, i stopped doing that a few years back…

Yeah, sorry, the built-in scripts are NOT going to help you move that from SD → eMMC…

I don’t want to risk breaking your system with my scripts, it would best to just use “DD”

dd if=/dev/mmcblk0 of=/dev/mmcblk1


Okay, i did not get very creative, i started with a blank SD card, formatted 2 partitions one for BOOT and one for ROOTFS, and i simply did these commands to build my kernel directly from the repository 5.10:

make ARCH=arm bb.org_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage dtbs LOADADDR=0x80008000 -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules -j4

then copy to SD card:
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/philippe/ROOTFS/ modules_install

1 Like

The kernel install is fine… (no reason to build uImage anymore…)

the built-in flashing scripts assume a specific boot-loader and partition setup…