logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://anongit.hacktivis.me/git/bootstrap-initrd.git/

reboot-stub.c (423B)


  1. // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  2. // SPDX-License-Identifier: MPL-2.0
  3. #define _GNU_SOURCE
  4. #include <linux/reboot.h> // LINUX_REBOOT_*
  5. #include <sys/syscall.h> // SYS_*
  6. #include <unistd.h> // syscall
  7. #include <stdio.h> // perror
  8. int
  9. main(void)
  10. {
  11. syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART);
  12. perror("reboot");
  13. return 1;
  14. }