mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
exec cli strings as commands on init
This commit is contained in:
@@ -132,7 +132,15 @@ When debugging a module, it becomes tedious to wait for build and re-type:
|
|||||||
|
|
||||||
every time.
|
every time.
|
||||||
|
|
||||||
Instead, you can add your test commands to:
|
Instead, you can either run them from a minimal init:
|
||||||
|
|
||||||
|
./run -e 'init=/eval.sh - lkmc_eval="insmod /hello.ko;/poweroff.out"' -n
|
||||||
|
|
||||||
|
or run them at the end of the BusyBox init, which does things like setting up networking:
|
||||||
|
|
||||||
|
./run -e '- lkmc_eval="insmod /hello.ko;wget -S google.com;poweroff.out;"'
|
||||||
|
|
||||||
|
or add them to a new `init.d` entry:
|
||||||
|
|
||||||
cp rootfs_overlay/etc/init.d/S98 rootfs_overlay/etc/init.d/S99
|
cp rootfs_overlay/etc/init.d/S98 rootfs_overlay/etc/init.d/S99
|
||||||
vim S99
|
vim S99
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# For temparary test commands, first copy this file to to
|
|
||||||
# S99 which is already gitignored.
|
|
||||||
echo 'S98'
|
echo 'S98'
|
||||||
# insmod /hello.ko
|
# insmod /hello.ko
|
||||||
|
if [ -n "$lkmc_eval" ]; then
|
||||||
|
eval "$lkmc_eval"
|
||||||
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
2
rootfs_overlay/eval.sh
Executable file
2
rootfs_overlay/eval.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
eval "$lkmc_eval"
|
||||||
Reference in New Issue
Block a user