From: Jonathan Amery Date: Thu, 11 Jun 2015 14:17:20 +0000 (+0100) Subject: Stuff X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~jdamery/git?p=debdroid;a=commitdiff_plain;h=d2867f0289ab5f208c550dbf2a7b6dd1b0e2dc0d Stuff --- diff --git a/debinit.sh b/debinit.sh index aabda59..142d35c 100644 --- a/debinit.sh +++ b/debinit.sh @@ -1,6 +1,7 @@ #!/sbin/busybox sh # initramfs pre-boot init script +# Initial version copied from http://whiteboard.ping.se/Android/Debian # Mount the /proc and /sys filesystems /sbin/busybox mount -t proc none /proc @@ -13,13 +14,31 @@ # Populate /dev /sbin/busybox mdev -s -# Mount the root filesystem, second partition on micro SDcard -/sbin/busybox mount -t ext4 -o noatime,nodiratime,errors=panic /dev/mmcblk1p2 /mnt/root +# Mount the Debian root filesystem, third partition on micro SDcard +# We don't care if this fails, we'll handle that later +/sbin/busybox mount -t ext4 -o noatime,nodiratime,errors=panic /dev/mmcblk1p3 /debian/ + +# This directory exists in both the initramfs and the Debian fs +/sbin/busybox mount -t ramfs ramfs /debian/android + +# Copy from the initramfs into the new android root +cd /debian/android +/sbin/busybox gunzip -c < /initrd.img | /sbin/busybox cpio -i + +exec >>/debian/android/log/boot-wrapper.log 2>&1 + +/sbin/busybox echo "`/sbin/busybox date` Booting" + +/sbin/busybox [ -x /debian/etc/stage2init.sh ] && /sbin/busybox chroot /debian/ /debian/etc/stage2init.sh + +/sbin/busybox echo "`/sbin/busybox date` Cleaning up boot mounts" # Clean up /sbin/busybox umount /proc /sbin/busybox umount /sys /sbin/busybox umount /dev -# Transfer root to SDcard -exec /sbin/busybox switch_root /mnt/root /etc/init +/sbin/busybox echo "`/sbin/busybox date` Starting Android's init" + +# Chroot into /debian/android/ and start Android's init +exec /sbin/busybox chroot /debian/android/ /init "$*"