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:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent 42f8de774a
commit 146e568db8
63 changed files with 369 additions and 338 deletions

4
rootfs_overlay/.profile Normal file
View 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

View File

@@ -1,2 +0,0 @@
#!/bin/sh
zcat /proc/config.gz | grep -Ei "${1:-}"

View File

@@ -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

View File

@@ -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.

View File

@@ -1,2 +0,0 @@
#!/bin/sh
eval "$(printf "$lkmc_eval" | base64 -d)"

3
rootfs_overlay/lkmc/conf.sh Executable file
View 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:-}"

View File

@@ -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

View 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)"

View File

@@ -0,0 +1,3 @@
#!/bin/sh
# https://github.com/cirosantilli/linux-kernel-module-cheat#tty
exec /bin/login root

View File

@@ -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

View File

@@ -1,2 +0,0 @@
#!/bin/sh
exec /bin/login root

View File

@@ -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