Merge branch 'master' of gitorious.ps3dev.net:ps3linux/livecd
[ps3linux_livecd.git] / init
blob792068e80446963c43ac672a869abd74b10c3927
1 #!/bin/sh
3 # 'usb' or 'cdrom'
4 MODE=usb
6 PATH="/sbin:/bin:/usr/sbin:/usr/bin"
8 busybox mount -t proc proc /proc
9 busybox mount -t sysfs sysfs /sys
11 busybox --install -s
13 mknod /dev/null c 1 3
14 mknod /dev/tty c 5 0
16 if [ -f /etc/modules ]; then
17 depmod -a
18 cat /etc/modules | while read mod; do
19 modprobe $mod
20 done
23 echo /bin/mdev > /proc/sys/kernel/hotplug
24 sleep 5
25 mdev -s
27 if [ "$MODE" = "cdrom" ]; then
28 mkdir /mnt/cdrom
29 mount -t iso9660 /dev/cdrom /mnt/cdrom
30 else
31 mkdir /mnt/usb
32 mount -t vfat /dev/sda1 /mnt/usb
35 mkdir /mnt/newroot_ro
37 if [ "$MODE" = "cdrom" ]; then
38 mount -t squashfs -o loop /mnt/cdrom/debianlive/root.sfs /mnt/newroot_ro
39 else
40 mount -t squashfs -o loop /mnt/usb/debianlive/root.sfs /mnt/newroot_ro
43 mkdir /mnt/newroot_rw
44 mount -t tmpfs -o size=16M tmpfs /mnt/newroot_rw
46 mkdir /mnt/newroot
47 mount -t overlayfs -o lowerdir=/mnt/newroot_ro,upperdir=/mnt/newroot_rw overlayfs /mnt/newroot
49 cd /mnt/newroot
50 mount --move . /
51 exec chroot . /sbin/init 3 </dev/console >/dev/console 2>&1
53 reboot -f