-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some additions with initram and pysh
- Loading branch information
1 parent
2f9e4c9
commit 56ae132
Showing
294 changed files
with
1,333 additions
and
2 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
39.2 |
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 @@ | ||
usr/bin |
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,4 @@ | ||
MODULES=(btrfs) | ||
BINARIES=(/usr/bin/btrfs) | ||
FILES=() | ||
HOOKS=(base udev autodetect keyboard keymap modconf block filesystems fsck) |
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,6 @@ | ||
MODULES="btrfs" | ||
EARLYHOOKS="udev" | ||
HOOKS="udev keymap" | ||
LATEHOOKS="" | ||
CLEANUPHOOKS="udev" | ||
EMERGENCYHOOKS="" |
Empty file.
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 @@ | ||
1 |
Empty file.
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 @@ | ||
../usr/lib/os-release |
Binary file not shown.
Empty file.
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 @@ | ||
../proc/self/mounts |
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 @@ | ||
../usr/lib/os-release |
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,23 @@ | ||
#!/usr/bin/ash | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
run_hook() { | ||
local mode ctrl | ||
|
||
if [ -e /keymap.bin ]; then | ||
msg -n ':: Loading keymap...' | ||
if [ -f /keymap.utf8 ]; then | ||
mode='-u' | ||
ctrl='G' | ||
else | ||
mode='-a' | ||
ctrl='@' | ||
fi | ||
kbd_mode "$mode" -C /dev/console | ||
printf "\033%%$ctrl" >>/dev/console | ||
loadkmap </keymap.bin | ||
msg 'done.' | ||
fi | ||
} | ||
|
||
# vim: set ft=sh ts=4 sw=4 et: |
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,30 @@ | ||
#!/usr/bin/ash | ||
|
||
run_earlyhook() { | ||
local quiet | ||
kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf | ||
systemd-tmpfiles --prefix=/dev --create --boot | ||
quiet="$(getarg quiet)" | ||
if [ "${quiet}" = "y" ]; then | ||
/usr/lib/systemd/systemd-udevd --daemon --resolve-names=never >/dev/null 2>&1 | ||
else | ||
/usr/lib/systemd/systemd-udevd --daemon --resolve-names=never | ||
fi | ||
# used externally by poll_device() | ||
# shellcheck disable=SC2034 | ||
udevd_running=1 | ||
} | ||
|
||
run_hook() { | ||
msg ":: Triggering uevents..." | ||
udevadm trigger --action=add --type=subsystems | ||
udevadm trigger --action=add --type=devices | ||
udevadm settle | ||
} | ||
|
||
run_cleanuphook() { | ||
udevadm control --exit | ||
udevadm info --cleanup-db | ||
} | ||
|
||
# vim: set ft=sh ts=4 sw=4 et: |
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,112 @@ | ||
#!/usr/bin/ash | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
export PATH='/usr/local/sbin:/usr/local/bin:/usr/bin' | ||
|
||
udevd_running=0 | ||
mount_handler=default_mount_handler | ||
init=/boot/init | ||
rd_logmask=0 | ||
|
||
. /init_functions | ||
|
||
mount_setup | ||
|
||
# parse the kernel command line | ||
parse_cmdline </proc/cmdline | ||
|
||
# setup logging as early as possible | ||
rdlogger_start | ||
|
||
disablehooks="$(getarg disablehooks)" | ||
# busybox ash supports string replacements | ||
# shellcheck disable=SC3060 | ||
for d in ${disablehooks//,/ }; do | ||
[ -e "/hooks/$d" ] && chmod 644 "/hooks/$d" | ||
done | ||
|
||
# shellcheck disable=SC1091 | ||
. /config | ||
|
||
# We rely on word splitting | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_earlyhook' 'early hook' $EARLYHOOKS | ||
|
||
if [ -n "$earlymodules$MODULES" ]; then | ||
# busybox ash supports string replacements | ||
# shellcheck disable=SC3060,SC2086 | ||
modprobe -qab ${earlymodules//,/ } $MODULES | ||
fi | ||
|
||
# We rely on word splitting | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_hook' 'hook' $HOOKS | ||
|
||
# honor the old behavior of break=y as a synonym for break=premount | ||
break="$(getarg break)" | ||
if [ "${break}" = "y" ] || [ "${break}" = "premount" ]; then | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_emergencyhook' 'emergency hook' $EMERGENCYHOOKS | ||
echo ":: Pre-mount break requested, type 'exit' to resume operation" | ||
launch_interactive_shell | ||
fi | ||
|
||
if rootdev="$(resolve_device "$root")"; then | ||
# If the tag is supported by util-linux mount, pass it as is. | ||
# Otherwise, use the resolved device path. | ||
case "$root" in | ||
'UUID='* | 'LABEL='* | 'PARTUUID='* | 'PARTLABEL='*) : ;; | ||
*) root="$rootdev" ;; | ||
esac | ||
fi | ||
unset rootdev | ||
|
||
fsck_root | ||
|
||
# Mount root at /new_root | ||
"$mount_handler" /new_root | ||
|
||
# We rely on word splitting | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_latehook' 'late hook' $LATEHOOKS | ||
|
||
# We rely on word splitting | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_cleanuphook' 'cleanup hook' $CLEANUPHOOKS | ||
|
||
if [ "$(stat -c %D /)" = "$(stat -c %D /new_root)" ]; then | ||
# Nothing got mounted on /new_root. This is the end, we don't know what to do anymore | ||
# We fall back into a shell, but the shell has now PID 1 | ||
# This way, manual recovery is still possible. | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_emergencyhook' 'emergency hook' $EMERGENCYHOOKS | ||
err "Failed to mount the real root device." | ||
echo "Bailing out, you are on your own. Good luck." | ||
echo | ||
launch_interactive_shell --exec | ||
elif [ ! -x "/new_root${init}" ]; then | ||
# Successfully mounted /new_root, but ${init} is missing | ||
# The same logic as above applies | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_emergencyhook' 'emergency hook' $EMERGENCYHOOKS | ||
err "Root device mounted successfully, but ${init} does not exist." | ||
echo "Bailing out, you are on your own. Good luck." | ||
echo | ||
launch_interactive_shell --exec | ||
fi | ||
|
||
if [ "${break}" = "postmount" ]; then | ||
# shellcheck disable=SC2086 | ||
run_hookfunctions 'run_emergencyhook' 'emergency hook' $EMERGENCYHOOKS | ||
echo ":: Post-mount break requested, type 'exit' to resume operation" | ||
launch_interactive_shell | ||
fi | ||
|
||
# this should always be the last thing we do before the switch_root. | ||
rdlogger_stop | ||
|
||
exec env -i \ | ||
"TERM=$TERM" \ | ||
/usr/bin/switch_root /new_root "$init" "$@" | ||
|
||
# vim: set ft=sh ts=4 sw=4 et: |
Oops, something went wrong.