OSDN Git Service

init: support Xen hypervisor device
[android-x86/bootable-newinstaller.git] / initrd / init
index fac5485..b204c27 100755 (executable)
@@ -3,8 +3,6 @@
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
 # and Thorsten Glaser <tg@mirbsd.org>
 #
-# Last updated 2018/01/26
-#
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
 # with Android-x86 project.
@@ -65,7 +63,8 @@ try_mount()
        RW=$1; shift
        if [ "${ROOT#*:/}" != "$ROOT" ]; then
                # for NFS roots, use nolock to avoid dependency to portmapper
-               RW="nolock,$RW"
+               mount -o $RW,noatime,nolock $@
+               return $?
        fi
        case $(blkid $1) in
                *TYPE=*ntfs*)
@@ -95,7 +94,6 @@ check_root()
                mount --move /mnt /iso
                mkdir /mnt/iso
                mount -o loop /iso/$iso /mnt/iso
-               SRC=iso
        fi
        if [ -e /mnt/$SRC/$RAMDISK ]; then
                zcat /mnt/$SRC/$RAMDISK | cpio -id > /dev/null
@@ -110,10 +108,10 @@ check_root()
        elif [ -e /mnt/$SRC/system.img ]; then
                remount_rw
                mount -o loop,noatime /mnt/$SRC/system.img system
-       elif [ -d /mnt/$SRC/system ]; then
+       elif [ -s /mnt/$SRC/system/build.prop ]; then
                remount_rw
                mount --bind /mnt/$SRC/system system
-       elif [ -e /mnt/build.prop ]; then
+       elif [ -z "$SRC" -a -s /mnt/build.prop ]; then
                mount --bind /mnt system
        else
                rm -rf *
@@ -137,6 +135,7 @@ debug_shell()
        if [ -x system/bin/sh ]; then
                echo Running MirBSD Korn Shell...
                USER="($1)" system/bin/sh -l 2>&1
+               [ $? -ne 0 ] && /bin/sh 2>&1
        else
                echo Running busybox ash...
                sh 2>&1
@@ -151,6 +150,7 @@ echo -n Detecting Android-x86...
 for c in `cat /proc/cmdline`; do
        case $c in
                iso-scan/filename=*)
+                       SRC=iso
                        eval `echo $c | cut -b1-3,18-`
                        ;;
                *)
@@ -161,7 +161,7 @@ done
 mount -t tmpfs tmpfs /android
 cd /android
 while :; do
-       for device in ${ROOT:-/dev/[hmnsv][dmrv][0-9a-z]*}; do
+       for device in ${ROOT:-/dev/[hmnsvx][dmrv][0-9a-z]*}; do
                check_root $device && break 2
                mountpoint -q /mnt && umount /mnt
        done
@@ -177,8 +177,8 @@ if [ -n "$INSTALL" ]; then
        zcat /src/install.img | ( cd /; cpio -iud > /dev/null )
 fi
 
-if [ -x system/bin/ln -a \( -n "$DEBUG" -o -n "$BUSYBOX" \) ]; then
-       mv /bin /lib .
+if [ -x system/bin/ln -a -n "$BUSYBOX" ]; then
+       mv -f /bin /lib .
        sed -i 's|\( PATH.*\)|\1:/bin|' init.environ.rc
        rm /sbin/modprobe
        busybox mv /sbin/* sbin
@@ -193,7 +193,10 @@ for s in `ls /scripts/* /src/scripts/*`; do
 done
 
 # ensure keyboard driver is loaded
-[ -n "$INSTALL" -o -n "$DEBUG" ] && auto_detect &
+if [ -n "$INSTALL" -o -n "$DEBUG" ]; then
+       busybox modprobe -a atkbd hid-apple
+       auto_detect &
+fi
 
 if [ 0$DEBUG -gt 0 ]; then
        echo -e "\nType 'exit' to continue booting...\n"