How Flashing Now Works with Debian

Hello,

I’m trying to leverage the flashing process included in the new Debian images to move my own distribution over but I’m confused on the current mechanics.

I did find this page: http://elinux.org/Beagleboard:Updating_The_Software

but perhaps that explains how flashing used to work with Angstrom? I wasn’t able to see the same architecture happening over on the new Debian images which works in 15 minutes instead of 45 minutes.

I did find /opt/scripts/tools/beaglebone-black-eMMC-flasher.sh but I’m not particularly sure of the mechanics.

It seems to me that when the boot button is pressed, the BBB mounts and boots from the eMMC-flasher partition. Somehow this script is executed (I couldn’t find the relevant systemd process) and it copies over everything on that same partition over to the eMMC and then powers off.

Next time, I boot from the eMMC, how does the script knows to not execute, seeing as it can’t really copy the eMMC to the eMMC… How does all this work?

Thanks,
Louis

Hello,

I'm trying to leverage the flashing process included in the new Debian
images to move my own distribution over but I'm confused on the current
mechanics.

I did find this page: Beagleboard:Updating The Software - eLinux.org

but perhaps that explains how flashing used to work with Angstrom? I wasn't
able to see the same architecture happening over on the new Debian images
which works in 15 minutes instead of 45 minutes.

yeah, totally different. Angstrom extracted a tar.gz into the new
eMMC. Whereas i'm just using rsync to sync microSD -> eMMC.

I did find /opt/scripts/tools/beaglebone-black-eMMC-flasher.sh but I'm not
particularly sure of the mechanics.

It seems to me that when the boot button is pressed, the BBB mounts and
boots from the eMMC-flasher partition. Somehow this script is executed (I
couldn't find the relevant systemd process) and it copies over everything on
that same partition over to the eMMC and then powers off.

It's actually a classic init script. systemd runs it just fine.

You can view it here:
https://github.com/beagleboard/image-builder/blob/master/target/init_scripts/generic-debian.sh

It's stored here: /etc/init.d/boot_scripts.sh

This script takes care of a few generic tasks, setting the clock,
regenerating ssh keys, before calling a board specific script.
(referenced from /boot/uboot/SOC.sh)

This is the board specific script:

It's stored here: /opt/scripts/boot/am335x_evm.sh

It takes care of flashing blank eeprom, getting the mac address,
setting up the gadget drivers, enablng the local dhcp server, calling
the flasher.sh script, and finishing the microSD resize when needed.

Next time, I boot from the eMMC, how does the script knows to not execute,
seeing as it can't really copy the eMMC to the eMMC... How does all this
work?

That depends:

If the flasher "microSD" is still installed, it WILL flash the eMMC "again"..

If you re-add the "trigger" file:

It will attempt the flash the "other" media..

If you look closely, the flasher script doesn't care if it's microSD
or eMMC, it's designed to flash the "other" media:

Regards,

Just to see if it would “just work”, I tried to run the script from my distribution and the scrip is unhappy:

/bin/bash /opt/scripts/beaglebone-black-eMMC-flasher.sh
Error: script halting, system unrecognized…

Oops - just saw your reply. Will study what you describe

The "script" assumes a few things, so i have a couple quick system
checks, that make it stop if it doesn't recognize the system..

Regards,

Cool - I don’t think I’ve ever played with such structured scripts before!

I’ve gotten up to the board specific script and I get the following:

Valid EEPROM header found
sed: can’t read /etc/default/udhcpd: No such file or directory
cat: /etc/udhcpd.conf: No such file or directory
/opt/scripts/boot/am335x_evm.sh: line 85: /etc/udhcpd.conf: Read-only file system
/opt/scripts/boot/am335x_evm.sh: line 86: /etc/udhcpd.conf: Read-only file system
/opt/scripts/boot/am335x_evm.sh: line 87: /etc/udhcpd.conf: Read-only file system
/opt/scripts/boot/am335x_evm.sh: line 88: /etc/udhcpd.conf: Read-only file system
/opt/scripts/boot/am335x_evm.sh: line 89: /etc/udhcpd.conf: Read-only file system
/opt/scripts/boot/am335x_evm.sh: line 91: /etc/init.d/udhcpd: No such file or directory
SIOCSIFADDR: No such device
usb0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
/opt/scripts/boot/am335x_evm.sh: line 94: /usr/sbin/udhcpd: No such file or directory
Device “usb0” does not exist.
Device “wlan0” does not exist.
sed: couldn’t open temporary file /etc/sedXOJqCd: Read-only file system
/opt/scripts/boot/am335x_evm.sh: line 103: /etc/issue: Read-only file system

It seems that the main issue is that the partition that I’m running is read-only… I don’t know when I set it as such and chmod’ing the whole thing didn’t seem to resolve.

I guess I’ll built my distro over again and try to find out at which point I made it “read-only”

Ah got everything working nicely :slight_smile: Thanks for much for the help, Nelson.

I especially like the script located at: /opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh

Hi,

I am getting as well the “Error: script halting, system unrecognized.” when executing beaglebone-black-eMMC-flasher.sh.
The image I have flashed is from here http://elinux.org/BeagleBoardDebian#Flasher https://rcn-ee.net/deb/flasher/wheezy/BBB-eMMC-flasher-debian-7.5-console-armhf-2014-07-06-2gb.img.xz.
When I check with “LC_ALL=C lsblk -l” the mountpoint “/boot/uboot” is missing.

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk1boot0 179:16 0 1M 1 disk
mmcblk1boot1 179:24 0 1M 1 disk
mmcblk0 179:0 0 7.4G 0 disk
mmcblk1 179:8 0 1.8G 0 disk
mmcblk1p1 179:9 0 96M 0 part
mmcblk1p2 179:10 0 1.7G 0 part /

Is there anything that I can do?
What I want to do is clone a beaglebone black to multiple others, is beaglebone-black-eMMC-flasher.sh the best way to do that?
Thanks in advance.

So in, 2014-07-06 i rewrote a lot of things...

First, make sure you run:

cd /opt/scripts/tools/
git pull

Next open: /boot/uEnv.txt

Uncomment this line:

#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v2.sh

At this point your microSD card is set to flash the eMMC.. so shutdown
(sudo halt) and get ready to flash stuff..

Regards,

Thank you Nelson, everything worked perfectly!
You have been a great help!

THANKS!!! The git pull saved me ! I couldn’t get the correct loader files to save my life.