OSDN Git Service

Add a script to run Android-x86 in QEMU
[android-x86/bootable-newinstaller.git] / initrd / scripts / 2-mount
index d5d7a60..9cce018 100644 (file)
@@ -1,6 +1,6 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2010/12/19
+# Last updated 2017/04/23
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
 mount_data()
 {
        mountpoint -q data && return
-       if [ -b "$DATA" ]; then
-               mount $DATA data
-       elif [ -b "/dev/$DATA" ]; then
-               mount /dev/$DATA data
+       if [ -n "$DATA" ]; then
+               blk=`basename $DATA`
+               if [ -b "/dev/$blk" ]; then
+                       [ ! -e /dev/block/$blk ] && ln /dev/$blk /dev/block
+                       mount -o noatime /dev/block/$blk data
+               elif [ "$DATA" = "9p" ]; then
+                       modprobe 9pnet_virtio
+                       mount -t 9p -o trans=virtio data data -oversion=9p2000.L,posixacl,cache=loose
+               else
+                       remount_rw
+                       mkdir -p /mnt/$SRC/$DATA
+                       mount --bind /mnt/$SRC/$DATA data
+               fi
        elif [ -d /mnt/$SRC/data ]; then
                remount_rw
                mount --bind /mnt/$SRC/data data
        elif [ -f /mnt/$SRC/data.img ]; then
                remount_rw
-               mount -o loop /mnt/$SRC/data.img data
+               mount -o loop,noatime /mnt/$SRC/data.img data
        else
                device_mount_data || mount -t tmpfs tmpfs data
        fi
@@ -29,10 +38,12 @@ mount_sdcard()
 {
        mountpoint -q sdcard && return
        if [ -n "$SDCARD" -a -e /mnt/$SRC$SDCARD ]; then
-               remount_rw
-               sddir=`dirname $SDCARD`
-               mkdir /android$sddir
-               mount --bind /mnt/$SRC$sddir /android$sddir
+               if [ ! -e /android$SDCARD ]; then
+                       remount_rw
+                       sddir=`dirname $SDCARD`
+                       mkdir /android$sddir
+                       mount --bind /mnt/$SRC$sddir /android$sddir
+               fi
        elif [ "$SDCARD" = "premount" ]; then
        # WARNING: premount the sdcard is deprecated since froyo-x86.
        # It is left only for backward compatibility and may be removed