Steinar
Steinar

Reputation: 187

Initiating system restart from kernel space

I have a custom embedded board running linux with an interrupt in a driver monitoring it's 24V power source. If the source goes down battery power takes over and a IRQ fires off. I want to initiate a reboot after 30 seconds running on the battery which powers the board down gracefully.

Currently

emergency_sync();
kernel_restart(NULL);

Does work but it just brings the system down suddenly after about half a minute after the call to kernel_restart is made. There is no announcement of restart and the system seems to run normally until it happens. Can i initiate a "init 6" or restart with an announcement which shuts down everything orderly (like running reboot on the commandline) from kernel space in some nice manner ?

Upvotes: 2

Views: 1471

Answers (1)

pdw
pdw

Reputation: 8851

I think the function ctrl_alt_del() does what you want. It sends a signal to init to start the normal reboot sequence.

Upvotes: 1

Related Questions