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
https://github.com/RobertCNelson/boot-scripts/blob/master/tools/beaglebone-black-eMMC-flasher.sh

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

Any help appreciated.

Thanxs

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/version.sh

and you partition layout;

lsblk

Regards,

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

root@beaglebone:/opt/scripts/tools# ./version.sh
git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
eeprom:[A335BNLT00C00515BBBK153B]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
UBOOT: Booted Device-Tree:[am335x-boneblack.dts]
kernel:[5.10.87]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20200403.0-0rcnee0~buster+20200403]
pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
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: 4a334000.pru is available
[   72.491942] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   72.421692] remoteproc remoteproc1: 4a334000.pru is available
[   72.491942] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pinctrl-single
[    3.849818] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END
root@beaglebone:/opt/scripts/tools#

Interesting! You’ve done a few modifications to the “[BeagleBoard.org 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

Regards,

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
/home/philippe/Beagleboard/ldd/source/linux-5.10/arch/arm/boot/uImage
/home/philippe/Beagleboard/ldd/source/linux-5.10/arch/arm/boot/dts/am335x-boneblack.dtb

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…

Regards,