mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Gerz Burak LCPF-CH <Burak.Gerz@mt.com>
To: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: barebox hooks in userspace
Date: Mon, 5 Dec 2022 16:34:55 +0000	[thread overview]
Message-ID: <DB3PR0302MB8966A4A44D35F989B46B88B0E7189@DB3PR0302MB8966.eurprd03.prod.outlook.com> (raw)

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





             reply	other threads:[~2022-12-05 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 16:34 Gerz Burak LCPF-CH [this message]
2022-12-06  7:18 ` Sascha Hauer
2022-12-06 20:17   ` Trent Piepho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB3PR0302MB8966A4A44D35F989B46B88B0E7189@DB3PR0302MB8966.eurprd03.prod.outlook.com \
    --to=burak.gerz@mt.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox