[PATCH 7/7] defaultenv-2: add boot sequence

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 28 06:48:46 EDT 2012


On Thu, Sep 13, 2012 at 07:40:23PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Boot will boot run sequentially the script in /env/boot.d
> 
> drop global.boot.default as we start the boot sequence by default
> 
> update the current board using the defaultenv-2 at the sametime
> 

I'm going to drop this one in its current form.

The way it is written is just too confusing. We have a sequence=[y|n]
which is set in multiple places, then after evaluating 60 lines of
shell code the script eventually may call itself, which again sets
sequence to other values.

Currently my babbage board (which appearantly does not have links in
/env/boot.d comes up with:

> WARNING: boot sequence: none
> booting
> /env/boot/ or /env/boot.d/ does not exist. Valid choices:
> initrd net
> 
> boot sequence:
> none

This gives not much clue what is wrong and what has to be done next.

The recursive call to itself makes the script unmaintainable and error
prone.

The boot sequence feature per se is ok and it's good to have, but the
implementation currently is not good.

It would be much better to separate the boot script from a script
running a boot sequence. That way the boot script can have a clear set
of parameters and is responsible for only booting a single source. Then
a boot-sequence script again can have a clear set of options and has the
only responsibility of iterating over the available sources.

I think many usecases do not require a boot sequence. For example if
I want to boot from network it won't help me if the board boots from
flash instead due to some network error. That's why I think users
not wanting a boot sequence should be bothered with this as little
as possible. This could be solved by keeping the boot script like
it is and move the sequence stuff out to another script.

Look at documenting what the script does:

boot [method]: Boot a system using /env/boot/[method]
boot-sequence: Boot a system by iterating over /env/boot.d/* until
               one succeeds.

Now with both combined in a single script:

boot [method]: If called without method, it will iterate over
               /env/boot.d/*. If that directory does not exist,
               it will fall back to a single boot source, which you
               haven't specified, so the script will complain. If you
               give [method], that will be one of /env/boot/[method]
               or /env/boot.d/[method]. If [method] exists in both
               directories, the behaviour will be unspecified.

Another thing is that I do not have a good feeling about putting soft
links into the repository. I can't really give any concrete problems
with it, it just don't feels good to use such a feature which other
version control systems or filesystems do not support

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list