barebox hooks in userspace

Gerz Burak LCPF-CH Burak.Gerz at
Mon Dec 5 08:34:55 PST 2022


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:

@@ -0,0 +1,18 @@

#Execute all scripts found
#TODO: Get next boot target from bootchooser and execute scripts located
#      only on one target



for i in /mnt/$SYSTEM0/$HOOKS_DIR/*; do
        . $i

for i in /mnt/$SYSTEM1/$HOOKS_DIR/*; do
        . $i

I see that bootchooser -i prints the next to be booted system:
barebox at Juno phyCORE-i.MX6 ULL eMMC SOM:/ bootchooser -i
Good targets (first will be booted next):

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?


More information about the barebox mailing list