mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* barebox hooks in userspace
@ 2022-12-05 16:34 Gerz Burak LCPF-CH
  2022-12-06  7:18 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Gerz Burak LCPF-CH @ 2022-12-05 16:34 UTC (permalink / raw)
  To: barebox

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?

Regards





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-06 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 16:34 barebox hooks in userspace Gerz Burak LCPF-CH
2022-12-06  7:18 ` Sascha Hauer
2022-12-06 20:17   ` Trent Piepho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox