Re: barebox hooks in userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 05, 2022 at 04:34:55PM +0000, Gerz Burak LCPF-CH wrote:
> Hi
> 
> I'm thinking of integrating something like a very simple "hook executer" in barebox - so that it can execute scripts which live in the rootfs.
> This would facilitate updating the barebox hooks by a simple RAUC rootfs update.
> Since I have an A/B setup, I do not know which partition will be booted by barebox beforehand - so currently I just execute all scripts twice
> 
> e.g, I have:
> 
> /defaultenv/defaultenv-2-base/init/zzbarebox-hook-exec
> @@ -0,0 +1,18 @@
> #!/bin/sh
> 
> #Execute all scripts found
> #TODO: Get next boot target from bootchooser and execute scripts located
> #      only on one target
> 
> SYSTEM0=${bootsource}${bootsource_instance}.0
> SYSTEM1=${bootsource}${bootsource_instance}.1
> 
> HOOKS_DIR=boot/barebox-hooks/
> 
> for i in /mnt/$SYSTEM0/$HOOKS_DIR/*; do
>         . $i
> done
> 
> for i in /mnt/$SYSTEM1/$HOOKS_DIR/*; do
>         . $i
> done
> 
> I see that bootchooser -i prints the next to be booted system:
> barebox@Juno phyCORE-i.MX6 ULL eMMC SOM:/ bootchooser -i
> Good targets (first will be booted next):
> system0
> ...
> 
> 
> My Question:
> Would it make sense to extend the bootchooser command, e.g. with
> bootchooser -n (get and store next boot target in a global variable),
> so that it can be used by the hush shell?

When do you want to execute the scripts? When you want to execute them
during booting then I think we'll find a better way for this. When you
want to execute them at barebox init time then the way you describe
sounds good to me.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux