chiark / gitweb /
142d35cb9cd154a168f1719e73e0bd7d04cdad42
[debdroid] / debinit.sh
1 #!/sbin/busybox sh
2
3 # initramfs pre-boot init script
4 # Initial version copied from http://whiteboard.ping.se/Android/Debian
5
6 # Mount the /proc and /sys filesystems
7 /sbin/busybox mount -t proc none /proc
8 /sbin/busybox mount -t sysfs none /sys
9 /sbin/busybox mount -t tmpfs none /dev
10
11 # Something (what?) needs a few cycles here
12 /sbin/busybox sleep 1
13
14 # Populate /dev
15 /sbin/busybox mdev -s
16
17 # Mount the Debian root filesystem, third partition on micro SDcard
18 # We don't care if this fails, we'll handle that later
19 /sbin/busybox mount -t ext4 -o noatime,nodiratime,errors=panic /dev/mmcblk1p3 /debian/
20
21 # This directory exists in both the initramfs and the Debian fs
22 /sbin/busybox mount -t ramfs ramfs /debian/android
23
24 # Copy from the initramfs into the new android root
25 cd /debian/android
26 /sbin/busybox gunzip -c < /initrd.img | /sbin/busybox cpio -i
27
28 exec >>/debian/android/log/boot-wrapper.log 2>&1
29
30 /sbin/busybox echo "`/sbin/busybox date` Booting"
31
32 /sbin/busybox [ -x /debian/etc/stage2init.sh ] && /sbin/busybox chroot /debian/ /debian/etc/stage2init.sh
33
34 /sbin/busybox echo "`/sbin/busybox date` Cleaning up boot mounts"
35
36 # Clean up
37 /sbin/busybox umount /proc
38 /sbin/busybox umount /sys
39 /sbin/busybox umount /dev
40
41 /sbin/busybox echo "`/sbin/busybox date` Starting Android's init"
42
43 # Chroot into /debian/android/ and start Android's init
44 exec /sbin/busybox chroot /debian/android/ /init "$*"