Advertisement
fspkwon

initramfs-test

Sep 2nd, 2024
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/bin/busybox sh
  2.  
  3. # Mount the /proc and /sys filesystems.
  4. mount -t proc none /proc
  5. mount -t sysfs none /sys
  6. mount -t devtmpfs none /dev
  7.  
  8. # mdev support:
  9. echo /sbin/mdev > /proc/sys/kernel/hotplug
  10. mdev -s
  11.  
  12. # Do your stuff here.
  13. echo "This script just mounts and boots the rootfs, nothing else!"
  14.  
  15. rescue_shell() {
  16. echo "Something went wrong. Dropping to a shell."
  17. exec sh
  18. }
  19.  
  20. # Mount the root filesystem.
  21. mount -o ro $(findfs UUID=1a7b58fa-e84e-43cc-8743-149f35bea830) /mnt/root || rescue_shell
  22.  
  23. # Clean up.
  24. umount /dev
  25. umount /proc
  26. umount /sys
  27.  
  28. # Boot the real thing.
  29. exec switch_root /mnt/root /sbin/init
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement