How Flashing Now Works with Debian

1,278 views
Skip to first unread message

Louis Thiery

unread,
Mar 21, 2014, 1:51:55 PM3/21/14
to beagl...@googlegroups.com
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.


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

Robert Nelson

unread,
Mar 21, 2014, 3:11:08 PM3/21/14
to Beagle Board
On Fri, Mar 21, 2014 at 12:51 PM, Louis Thiery <lo...@apitronics.com> wrote:
> 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.

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:

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh

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:

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L110

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:

https://github.com/RobertCNelson/boot-scripts/blob/master/tools/beaglebone-black-eMMC-flasher.sh#L39

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Louis Thiery

unread,
Mar 21, 2014, 3:22:15 PM3/21/14
to beagl...@googlegroups.com
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...

Louis Thiery

unread,
Mar 21, 2014, 3:23:10 PM3/21/14
to beagl...@googlegroups.com
Oops - just saw your reply. Will study what you describe

Robert Nelson

unread,
Mar 21, 2014, 3:26:11 PM3/21/14
to Beagle Board
On Fri, Mar 21, 2014 at 2:22 PM, Louis Thiery <lo...@apitronics.com> wrote:
> 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...

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..

Louis Thiery

unread,
Mar 21, 2014, 4:59:24 PM3/21/14
to beagl...@googlegroups.com
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"

Louis Thiery

unread,
Mar 22, 2014, 12:48:18 PM3/22/14
to beagl...@googlegroups.com
Ah got everything working nicely :) 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

pa...@panos.me.uk

unread,
Jul 14, 2014, 1:29:26 PM7/14/14
to beagl...@googlegroups.com
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.

Robert Nelson

unread,
Jul 14, 2014, 1:50:20 PM7/14/14
to Beagle Board
On Mon, Jul 14, 2014 at 12:29 PM, <pa...@panos.me.uk> wrote:
> 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..

pa...@panos.me.uk

unread,
Jul 17, 2014, 5:05:34 AM7/17/14
to beagl...@googlegroups.com
Thank you Nelson, everything worked perfectly!
You have been a great help!

Joshua S

unread,
Sep 21, 2016, 7:54:07 PM9/21/16
to BeagleBoard
THANKS!!!! The git pull saved me ! I couldn't get the correct loader files to save my life.
Reply all
Reply to author
Forward
0 new messages