Skip to content

Commit 0a1a600

Browse files
committed
exec cli strings as commands on init
1 parent fc168d6 commit 0a1a600

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

getting-started.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,15 @@ When debugging a module, it becomes tedious to wait for build and re-type:
132132

133133
every time.
134134

135-
Instead, you can add your test commands to:
135+
Instead, you can either run them from a minimal init:
136+
137+
./run -e 'init=/eval.sh - lkmc_eval="insmod /hello.ko;/poweroff.out"' -n
138+
139+
or run them at the end of the BusyBox init, which does things like setting up networking:
140+
141+
./run -e '- lkmc_eval="insmod /hello.ko;wget -S google.com;poweroff.out;"'
142+
143+
or add them to a new `init.d` entry:
136144

137145
cp rootfs_overlay/etc/init.d/S98 rootfs_overlay/etc/init.d/S99
138146
vim S99

rootfs_overlay/etc/init.d/S98

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
2-
# For temparary test commands, first copy this file to to
3-
# S99 which is already gitignored.
42
echo 'S98'
53
# insmod /hello.ko
4+
if [ -n "$lkmc_eval" ]; then
5+
eval "$lkmc_eval"
6+
fi
67
exit 0

rootfs_overlay/eval.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
eval "$lkmc_eval"

0 commit comments

Comments
 (0)