chiark / gitweb /
Make sure that directory exists!
[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 mkdir -pv /debian/android/log/
29 exec >>/debian/android/log/boot-wrapper.log 2>&1
30
31 /sbin/busybox echo "`/sbin/busybox date` Booting"
32
33 /sbin/busybox [ -x /debian/etc/stage2init.sh ] && /sbin/busybox chroot /debian/ /debian/etc/stage2init.sh
34
35 /sbin/busybox echo "`/sbin/busybox date` Cleaning up boot mounts"
36
37 # Clean up
38 /sbin/busybox umount /proc
39 /sbin/busybox umount /sys
40 /sbin/busybox umount /dev
41
42 /sbin/busybox echo "`/sbin/busybox date` Starting Android's init"
43
44 # Chroot into /debian/android/ and start Android's init
45 exec /sbin/busybox chroot /debian/android/ /init "$*"