Is it possible to change boot device 'programmatically'?

115 views
Skip to first unread message

Chris Green

unread,
Sep 1, 2021, 12:03:36 PM9/1/21
to beagl...@googlegroups.com
If one has a BBB which normally boots from eMMC is it possible to
write a script that will reboot from the microSD card?

What I want to do is allow the eMMC to be cloned to somewhere (across
the network) automatically overnight. If the switch to boot from
microSD is possible this shouldn't be too difficult.

The sequence would be something like:-

Have cron run a script in the small hours.

Script shuts down system on eMMC and reboots from SD card

SD card system clones an image of the emmc to an external system
somewhere.

SD card then shuts down and reboots from eMMC

--
Chris Green
·

Dennis Lee Bieber

unread,
Sep 1, 2021, 1:03:16 PM9/1/21
to Beagleboard

I'm surprised this post even came through. The beagleboard forum
/moved/ to a new web-based-only system (which I have refused to fight with
-- I tried but found it cryptic and unusable for someone accustomed to
newsreader clients which fetch all messages in a batch and permit later
responses to be made; I abhor web-based "fetch one message, make a reply,
send, fetch next message")

The Google Groups forum has been abandoned.

On Wed, 1 Sep 2021 16:50:11 +0100, in gmane.comp.hardware.beagleboard.user
Chris Green <cl-RxdK...@public.gmane.org> wrote:

>If one has a BBB which normally boots from eMMC is it possible to
>write a script that will reboot from the microSD card?
>

On current Beagle systems, it is u-Boot which determines the boot
device dynamically.

That is:

By default the u-Boot in the eMMC starts processing

It then scans for a bootable uSD card

If a valid uSD card is found, it toggles the boot device to be the
uSD card, and proceeds to load the configuration from the uSD card;
otherwise it continues to load the configuration from the eMMC

If there is no u-Boot (and maybe other files) found on the eMMC, the
SoC [hardware] boot sequence is to look for a valid uSD card and load
u-Boot from that card.

The end state: if a bootable uSD card exists, it automatically becomes
the booted image, skipping the rest of the eMMC (u-Boot comes from the
first version found: eMMC then uSD).

Prior to this form of u-Boot, one was required to hold down the
boot-select button on the BBB to force uSD card load. But that form of
u-Boot vanished near the end of the Wheezy era (Debian 7). This was also
the days of kernel loaded device tree overlays -- u-Boot loaded overlays
came in during the Jessie (Debian 8) era. The two u-Boots are totally
INCOMPATIBLE with Debian versions of the other style (Wheezy u-Boot does
not load DTOs, but Jessie and later Debian kernels expect to find the DTOs
already loaded).

I don't know enough about u-Boot and uEnv.txt to know if there is some
way to modify uEnv.txt to /not/ transfer control to the uSD card except
when you want to do you back-up stuff.


--
Dennis L Bieber

Chris Green

unread,
Sep 1, 2021, 3:18:31 PM9/1/21
to beagl...@googlegroups.com
Dennis Lee Bieber <dennis....@gmail.com> wrote:
>
> I'm surprised this post even came through. The beagleboard forum
> /moved/ to a new web-based-only system (which I have refused to fight with

I suspect this will carry on working. :-) Good!
OK, thanks, I suspect it may be rather more difficult than I had hoped.

What I'm aiming for is a Pi/BBB type system that can clone itself
automatically every day or so. That would allow me to have a fairly
quick to implement backup for my Pi (could justas well be a BBB) that
provides DHCP/DNS on my LAN.

--
Chris Green
·

Dennis Lee Bieber

unread,
Sep 1, 2021, 4:04:47 PM9/1/21
to Beagleboard
On Wed, 1 Sep 2021 20:06:49 +0100, in gmane.comp.hardware.beagleboard.user
Chris Green <cl-RxdK...@public.gmane.org> wrote:

>Dennis Lee Bieber <dennis.l.bieber-Re5...@public.gmane.org> wrote:
>>
>> I'm surprised this post even came through. The beagleboard forum
>> /moved/ to a new web-based-only system (which I have refused to fight with
>
>I suspect this will carry on working. :-) Good!
>
But you and I may be the only ones still monitoring it <G>


>OK, thanks, I suspect it may be rather more difficult than I had hoped.
>
>What I'm aiming for is a Pi/BBB type system that can clone itself
>automatically every day or so. That would allow me to have a fairly
>quick to implement backup for my Pi (could justas well be a BBB) that
>provides DHCP/DNS on my LAN.

Mostly I think folks do that with rsync
https://man7.org/linux/man-pages/man1/rsync.1.html


--
Dennis L Bieber

Chris Green

unread,
Sep 2, 2021, 5:03:32 AM9/2/21
to beagl...@googlegroups.com
Dennis Lee Bieber <dennis....@gmail.com> wrote:
I use rsync a lot but getting it to copy the right bits across to a
target is not a straightforward exercise.

I think what one might do is:-

Maintain an up to date image somehow (but how)

Copy the necessary files for dnsmasq across (again, how to select
files)

Trying to maintain the whole thing by copying with rsync doesn't seem
to me to be a good idea.


However, from another mailing list (hurrah!), it has been suggested
that docker may be the answer. Run dnsmasq in docker on one system
and synchronise its files across to another docker image that you
don't run until needed.

--
Chris Green
·

Reply all
Reply to author
Forward
0 new messages