- mount -t tmpfs tmpfs /android
- cd /android
- zcat /mnt/$SRC/ramdisk.img | cpio -id > /dev/null
- if [ -e /mnt/$SRC/system.sfs ]; then
- mount -o loop /mnt/$SRC/system.sfs /sfs
- mount -o loop /sfs/system.img system
- else
- mount -o loop /mnt/$SRC/system.img system
- fi
- mkdir cache sdcard
- mount -t tmpfs tmpfs cache
- echo " found at $device"
- break
+ elif [ -e /mnt/$SRC/system.img ]; then
+ remount_rw
+ mount -o loop,noatime /mnt/$SRC/system.img system
+ elif [ -s /mnt/$SRC/system/build.prop ]; then
+ remount_rw
+ mount --bind /mnt/$SRC/system system
+ elif [ -z "$SRC" -a -s /mnt/build.prop ]; then
+ mount --bind /mnt system
+ else
+ rm -rf *
+ return 1
+ fi
+ mkdir -p mnt
+ echo " found at $1"
+ rm /sbin/mke2fs
+ hash -r
+}
+
+remount_rw()
+{
+ # "foo" as mount source is given to workaround a Busybox bug with NFS
+ # - as it's ignored anyways it shouldn't harm for other filesystems.
+ mount -o remount,rw foo /mnt
+}
+
+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
+ fi
+}
+
+echo -n Detecting Android-x86...
+
+[ -z "$SRC" -a -n "$BOOT_IMAGE" ] && SRC=`dirname $BOOT_IMAGE`
+[ -z "$RAMDISK" ] && RAMDISK=ramdisk.img || RAMDISK=${RAMDISK##/dev/}
+
+for c in `cat /proc/cmdline`; do
+ case $c in
+ iso-scan/filename=*)
+ SRC=iso
+ eval `echo $c | cut -b1-3,18-`
+ ;;
+ *)
+ ;;
+ esac
+done
+
+mount -t tmpfs tmpfs /android
+cd /android
+while :; do
+ for device in ${ROOT:-/dev/[hmnsv][dmrv][0-9a-z]*}; do
+ check_root $device && break 2
+ mountpoint -q /mnt && umount /mnt