run-init.c 1.1 KB

123456789101112131415161718192021222324252627
  1. /*
  2. * run-init implementation for busybox
  3. *
  4. * Copyright (c) 2017 Denys Vlasenko <vda.linux@gmail.com>
  5. *
  6. * Licensed under GPLv2, see file LICENSE in this source tree.
  7. */
  8. //config:config RUN_INIT
  9. //config: bool "run-init (7.5 kb)"
  10. //config: default y
  11. //config: select PLATFORM_LINUX
  12. //config: help
  13. //config: The run-init utility is used from initramfs to select a new
  14. //config: root device. Under initramfs, you have to use this instead of
  15. //config: pivot_root.
  16. //config:
  17. //config: Booting with initramfs extracts a gzipped cpio archive into rootfs
  18. //config: (which is a variant of ramfs/tmpfs). Because rootfs can't be moved
  19. //config: or unmounted, pivot_root will not work from initramfs. Instead,
  20. //config: run-init deletes everything out of rootfs (including itself),
  21. //config: does a mount --move that overmounts rootfs with the new root, and
  22. //config: then execs the specified init program.
  23. //config:
  24. //config: util-linux has a similar tool, switch-root.
  25. //config: run-init differs by also having a "-d CAPS_TO_DROP" option.
  26. /* applet and kbuild hooks are in switch_root.c */