Skip to content

Instantly share code, notes, and snippets.

@Gnurou
Last active October 31, 2018 08:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gnurou/7190563 to your computer and use it in GitHub Desktop.
Save Gnurou/7190563 to your computer and use it in GitHub Desktop.
A minimal /init script for a Busybox initramfs that mounts a loopback device file from SHIELD's data partition as root and continue booting from it. It allows to have a non-intrusive Linux installation along with Android on SHIELD.
#!/bin/sh
mkdir /proc
mkdir /sys
mkdir /d
/bin/mount /proc
/bin/mount /sys
echo /sbin/mdev >/proc/sys/kernel/hotplug
mdev -s
mkdir /roothost
mkdir /newroot
# Wait for block devices to be detected
sleep 5
mount /dev/mmcblk0p12 /roothost
mount -oloop /roothost/media/0/alarm-fs.img /newroot
mkdir -p /newroot/mnt/userdata
mount --move /roothost /newroot/mnt/userdata
exec switch_root /newroot /sbin/init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment