barebox hooks in userspace
Gerz Burak LCPF-CH
Burak.Gerz at mt.com
Mon Dec 5 08:34:55 PST 2022
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 at 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?
Regards
More information about the barebox
mailing list