mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 19:21:35 +01:00
move all our stuff into /lkmc in guest
Motivation: userland is getting several new subdirectories, it would be too insane to just dump all of that in the guest root filesystem. To alleviate the cd pain, .profile puts user inside /lkmc by default.
This commit is contained in:
4
rootfs_overlay/.profile
Normal file
4
rootfs_overlay/.profile
Normal file
@@ -0,0 +1,4 @@
|
||||
# https://github.com/cirosantilli/linux-kernel-module-cheat#busybox-shell-initrc-files
|
||||
echo "hello .profile"
|
||||
export PS1='\w\n\u@\h# '
|
||||
cd /lkmc
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
zcat /proc/config.gz | grep -Ei "${1:-}"
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
# https://github.com/cirosantilli/linux-kernel-module-cheat#init-busybox
|
||||
echo "hello S98"
|
||||
cd "$lkmc_home"
|
||||
if [ -n "$lkmc_eval" ]; then
|
||||
eval "$lkmc_eval"
|
||||
elif [ -n "$lkmc_eval_base64" ]; then
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo "$lkmc_eval"
|
||||
eval "$lkmc_eval"
|
||||
|
||||
# Ideally, this script would do just:
|
||||
#
|
||||
## Get rid of the '-'.
|
||||
#shift
|
||||
#echo "$@"
|
||||
#
|
||||
# However, the kernel CLI parsing is crap, and the 4.14 docs lie.
|
||||
#
|
||||
# In particular, not all that is passed after "-" goes to an argument to init,
|
||||
# e.g. stuff with dots like "- ./poweroff.out" still gets treated specially and
|
||||
# does not go to init.
|
||||
#
|
||||
# This also likely means that the above solution is also unreliable in some cases,
|
||||
# and that in the end you just have to add a script to the root filesystem.
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
eval "$(printf "$lkmc_eval" | base64 -d)"
|
||||
3
rootfs_overlay/lkmc/conf.sh
Executable file
3
rootfs_overlay/lkmc/conf.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# https://github.com/cirosantilli/linux-kernel-module-cheat#find-the-kernel-config
|
||||
zcat /proc/config.gz | grep -Ei "${1:-}"
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Count to infinity with 1 second sleep between each increment.
|
||||
# Generate infinitely many system calls :-)
|
||||
i=0
|
||||
while true; do
|
||||
4
rootfs_overlay/lkmc/eval_base64.sh
Executable file
4
rootfs_overlay/lkmc/eval_base64.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
# https://github.com/cirosantilli/linux-kernel-module-cheat#replace-init
|
||||
cd "$lkmc_home"
|
||||
eval "$(printf "$lkmc_eval" | base64 -d)"
|
||||
3
rootfs_overlay/lkmc/loginroot.sh
Executable file
3
rootfs_overlay/lkmc/loginroot.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# https://github.com/cirosantilli/linux-kernel-module-cheat#tty
|
||||
exec /bin/login root
|
||||
@@ -20,7 +20,7 @@ for test in \
|
||||
; do
|
||||
if ! "${test_dir}/${test}"; then
|
||||
echo "Test failed: ${test}"
|
||||
test_fail.sh
|
||||
./test_fail.sh
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
exec /bin/login root
|
||||
@@ -1,4 +0,0 @@
|
||||
# https://unix.stackexchange.com/questions/176027/ash-profile-configuration-file
|
||||
echo "hello $(pwd)/.profile"
|
||||
# Does not inherit init environment variables.
|
||||
#env
|
||||
Reference in New Issue
Block a user