-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fdb660
commit a4e7d48
Showing
4 changed files
with
101 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# License: GPL V2 | ||
# | ||
# [email protected] | ||
# 20211122 | ||
# 20211129 | ||
# | ||
|
||
# If you don't have a "standalone shell" busybox, enable this: | ||
|
@@ -489,13 +489,15 @@ do_housekeeping(){ | |
do_linbo_update(){ | ||
local server="$1" | ||
local rebootflag="/tmp/.linbo.reboot" | ||
local cfg="/cache/boot/grub/custom.cfg" | ||
local cachedev="$(printcache)" | ||
linbo_cmd mount "$cachedev" /cache | ||
[ -e "${cfg}.reboot" ] && mv "${cfg}.reboot" "$cfg" | ||
# start linbo update | ||
linbo_cmd update "$server" "$cachedev" 2>&1 | tee /cache/update.log | ||
# initiate warm start | ||
if [ -e "$rebootflag" -a "$warmstart" != "no" ]; then | ||
if [ -e "$rebootflag" ]; then | ||
echo -n "Local LINBO/GRUB configuration was updated. Initiating linbo warmstart ..." | ||
cd / | ||
/usr/bin/linbo_warmstart | ||
fi | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,57 @@ | ||
#!/bin/sh | ||
# | ||
# linbo_warmstart <kernel> <initrd> | ||
# linbo_warmstart <device> | ||
# [email protected] | ||
# 20211122 | ||
# 20211129 | ||
# | ||
|
||
KEXEC="/sbin/kexec" | ||
LINBO="/cache/linbo64" | ||
LINBOFS="/cache/linbofs64.lz" | ||
|
||
KERNEL="$1" | ||
[ -z "$KERNEL" ] && KERNEL="$LINBO" | ||
if [ ! -s "$KERNEL" ]; then | ||
echo "Kernel $KERNEL not found!" | ||
exit 1 | ||
if [ -n "$1" ]; then | ||
CACHE="$1" | ||
else | ||
CACHE="$(grep -iw ^cache /start.conf | tail -1 | awk -F\= '{print $2}' | awk '{print $1}' | awk -F\# '{print $1}' | awk '{print $1}')" | ||
fi | ||
|
||
INITRD="$2" | ||
[ -z "$INITRD" ] && INITRD="$LINBOFS" | ||
if [ ! -s "$INITRD" ]; then | ||
echo "Initrd $INITRD not found!" | ||
if [ ! -b "$CACHE" ]; then | ||
[ -z "$CACHE" ] && CACHE="<None>" | ||
echo "Cache $CACHE is not a blockdevice!" | ||
exit 1 | ||
fi | ||
|
||
APPEND="$3" | ||
if [ -z "$APPEND" -a "$KERNEL" = "$LINBO" -a "$INITRD" = "$LINBOFS" ]; then | ||
APPEND="$(cat /proc/cmdline)" | ||
fi | ||
if [ -z "$APPEND" ]; then | ||
echo "Kernel append string is empty. Check your parameters!" | ||
exit 1 | ||
fi | ||
KEXEC="/sbin/kexec" | ||
KERNEL="linbo64" | ||
INITRD="linbofs64.lz" | ||
APPEND="$(cat /proc/cmdline)" | ||
CFG="/cache/boot/grub/custom.cfg" | ||
TPL="/usr/share/linbo/warmstart.cfg" | ||
[ -d /sys/firmware/efi/efivars ] && EFI="true" | ||
|
||
# load linbo kernel | ||
if ! $KEXEC --type="bzImage" --append="$APPEND" --initrd="$INITRD" --load "$KERNEL"; then | ||
echo "Failed to load kernel!" | ||
exit 1 | ||
# test for warmstart boot parameter | ||
warmstart="yes" | ||
for i in $APPEND; do case "$i" in warmstart=*) eval $i ;; esac; done | ||
if [ "$warmstart" = "no" ]; then | ||
echo "Skipping kexec'd linbo warmstart, rebooting instead." | ||
fi | ||
|
||
# execute linbo kernel | ||
if ! $KEXEC -e; then | ||
echo "Failed to execute kernel!" | ||
exit 1 | ||
cd / | ||
linbo_cmd mount "$CACHE" /cache | ||
|
||
# cold reboot | ||
if [ -n "$EFI" -o "$warmstart" = "no" ]; then | ||
mv "$CFG" "$CFG".reboot || exit 1 | ||
sed -e "s|@@kopts@@|$APPEND|" "$TPL" > "$CFG" || exit 1 | ||
linbo_cmd start "" "$CACHE" "$KERNEL" "$INITRD" "$APPEND" "$CACHE" | ||
# kexec boot | ||
else | ||
# load linbo kernel | ||
if ! $KEXEC --type="bzImage" --append="$APPEND" --initrd="/cache/$INITRD" --load "/cache/$KERNEL"; then | ||
echo "Failed to load kernel!" | ||
exit 1 | ||
fi | ||
# execute linbo kernel | ||
if ! $KEXEC -e; then | ||
echo "Failed to execute kernel!" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# temporary grub.cfg template for linbo reboot | ||
# [email protected] | ||
# 20211129 | ||
# | ||
|
||
set default=0 | ||
set timeout=0 | ||
|
||
set gfxmode=auto | ||
set gfxpayload=keep | ||
|
||
insmod all_video | ||
insmod png | ||
insmod gfxterm | ||
insmod gfxmenu | ||
insmod minicmd | ||
insmod progress | ||
|
||
terminal_output gfxterm | ||
|
||
background_color 42,68,87 | ||
|
||
set linbo_kernel=/linbo64 | ||
set linbo_initrd=/linbofs64.lz | ||
|
||
# theme settings (modify for custom theme) | ||
set theme=/boot/grub/themes/linbo/theme.txt | ||
export theme | ||
|
||
clear | ||
|
||
# find linbo cache partition | ||
search --file "$linbo_initrd" --set root | ||
|
||
menuentry 'LINBO' --class linbo { | ||
echo -n "Loading $linbo_kernel ..." | ||
linux $linbo_kernel @@kopts@@ | ||
echo | ||
echo -n "Loading $linbo_initrd ..." | ||
initrd $linbo_initrd | ||
boot | ||
} |