7.1.1. poweroff.out
Just using BusyBox' poweroff
at the end of the init
does not work and the kernel panics:
./run --eval poweroff
because BusyBox' poweroff
tries to do some fancy stuff like killing init, likely to allow userland to shutdown nicely.
But this fails when we are init
itself!
BusyBox' poweroff
works more brutally and effectively if you add -f
:
./run --eval 'poweroff -f'
but why not just use our minimal ./linux/poweroff.out
and be done with it?
./run --eval './linux/poweroff.out'
Source: userland/linux/poweroff.c
This also illustrates how to shutdown the computer from C: https://stackoverflow.com/questions/28812514/how-to-shutdown-linux-using-c-or-qt-without-call-to-system