/* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. */ /* * reboot2 MODE -- restart now and hand MODE to the kernel * (LINUX_REBOOT_CMD_RESTART2), whose reboot-mode driver writes it where * the bootloader reads it: "bootloader" (fastboot), "recovery". The modes * a phone knows are the mode-* properties of its reboot-mode node in the * DT (e.g. pon@800, qcom-pon.c). * * No unmounting: called last in runit's stage 3 * (/etc/runit/shutdown.d/95-reboot-mode.sh, after 80-filesystems), the way * Void's 90-kexec.sh calls kexec -e. Users run reboot-mode(1) instead. * * Built by tools/mkrootimg.sh with the device's cross compiler, static, * into /usr/libexec/makronix/reboot2: no shell, perl or python on Void * can make this system call, and its reboot(8) takes no argument. */ #include #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, "usage: reboot2 MODE\n"); return 2; } sync(); syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, argv[1]); perror("reboot2"); return 1; }