package/petitboot: properly shut down before kexec
It's good practice to unmount filesystems and gracefully terminate
running services before running "kexec -e". So when a boot option has
been chosen from the petitboot menu, poke init to shut the system down
and kexec the new kernel.
One benefit to us in particular is that when pb-console is killed, it
notifies the user that we're booting:
trap 'reset; echo "SIGTERM received, booting..."; sleep 2' SIGTERM
This terminal reset is also useful, exiting the ncurses visual mode so
subsequent boot output is raw rather than being confined to the window
set up for the petitboot menu.
Currently we assume busybox init (using the bb-kexec-reboot script
included with petitboot), but do not add an accompanying entry
in the inittab to run kexec, so things aren't working.
Add a new script kexec-restart that does the right thing for all init
systems that Buildroot supports (busybox, sysv, openrc, systemd). OpenRC
and systemd have an upstream way to do a kexec-shutdown. For busybox and
sysv, we add a line to inittab that does kexec -f -e (after the shutdown
scripts have run). Finally, for other cases (where there is no
recognized init system) directly use kexec -f -e.
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
[Arnout:
- install kexec-restart in /usr/libexec/petitboot, where it was before;
- determine init system statically based on config instead of dynamically.
]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2024-02-08 01:51:33 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
@KEXEC_COMMAND@
|
|
|
|
|
|
|
|
while :
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
done
|