chiark / gitweb /
stage 2 & 3 inits.
authorJonathan Amery <jdamery+zgit@ysolde.ucam.org>
Thu, 11 Jun 2015 14:18:32 +0000 (15:18 +0100)
committerJonathan Amery <jdamery+zgit@ysolde.ucam.org>
Thu, 11 Jun 2015 14:19:45 +0000 (15:19 +0100)
for-debian-chroot/etc/stage2init.sh [new file with mode: 0644]
for-debian-chroot/etc/stage3init.sh [new file with mode: 0644]

diff --git a/for-debian-chroot/etc/stage2init.sh b/for-debian-chroot/etc/stage2init.sh
new file mode 100644 (file)
index 0000000..4d12473
--- /dev/null
@@ -0,0 +1,47 @@
+#!/sbin/busybox sh
+
+# initramfs pre-boot init script
+# Initial version copied from http://whiteboard.ping.se/Android/Debian
+
+#
+# Delayed Debian environment boot init script
+# Not really init (not pid 1) but a fork of it.
+# The real init is right now executing in Android chroot
+#
+
+/sbin/busybox echo "`/sbin/busybox date` Debian init stage2 started"
+
+# Wait for Android init to set up everything
+# wait for dev to be mounted by Android init
+/sbin/busybox echo "`/sbin/busybox date` Waiting on Android to mount /dev"
+while [ ! -e /android/dev/.coldboot_done ]; do
+   /sbin/busybox sleep 1
+done
+# wait for Android init to signal all done
+/sbin/busybox echo "`/sbin/busybox date` Waiting on Android init to finish"
+while [ -e /android/dev/.booting ]; do
+   /sbin/busybox sleep 1
+done
+
+# Mount the /proc, /sys etc filesystems
+/sbin/busybox echo "`/sbin/busybox date` Mounting /proc /sys and /dev"
+/sbin/busybox mount -t proc none /proc
+/sbin/busybox mount -t sysfs none /sys
+
+# Mount /dev from the Android world
+/sbin/busybox mount -o bind /android/dev /dev
+/sbin/busybox mount -o bind /android/dev/pts /dev/pts
+/sbin/busybox mount -o bind /android/dev/socket /dev/socket
+
+# All done, now we can start stuff
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+/sbin/busybox echo "`/sbin/busybox date` Running /etc/stage3init.sh"
+
+# Start selected servers
+/etc/stage3init.sh
+
+/sbin/busybox echo "`/sbin/busybox date` All done"
+
+exit 0
diff --git a/for-debian-chroot/etc/stage3init.sh b/for-debian-chroot/etc/stage3init.sh
new file mode 100644 (file)
index 0000000..4ce1230
--- /dev/null
@@ -0,0 +1,7 @@
+#!/sbin/busybox sh
+
+# Start services here.
+service hostname.sh start
+service ssh start
+
+exit 0