7.2. Run command at the end of BusyBox init
Use the --eval-after
option is for you rely on something that BusyBox' init set up for you like /etc/fstab
:
./run --eval-after 'echo asdf;ls /proc;ls /sys;echo qwer'
After the commands run, you are left on an interactive shell.
The above command is basically equivalent to:
./run --kernel-cli-after-dash 'lkmc_eval="insmod hello.ko;./linux/poweroff.out;"'
where the lkmc_eval
option gets evaled by our default rootfs_overlay/etc/init.d/S98 startup script.
Except that --eval-after
is smarter and uses base64
encoding.
Alternatively, you can also add the comamdns to run to a new init.d
entry to run at the end o the BusyBox init:
cp rootfs_overlay/etc/init.d/S98 rootfs_overlay/etc/init.d/S99.gitignore vim rootfs_overlay/etc/init.d/S99.gitignore ./build-buildroot ./run
and they will be run automatically before the login prompt.
Scripts under /etc/init.d
are run by /etc/init.d/rcS
, which gets called by the line ::sysinit:/etc/init.d/rcS
in /etc/inittab
.