]> code.ossystems Code Review - openembedded-core.git/commitdiff
initrdscripts: fix for /run/media
authorChen Qi <Qi.Chen@windriver.com>
Thu, 15 May 2014 09:36:17 +0000 (17:36 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 20 May 2014 13:53:00 +0000 (14:53 +0100)
mount.sh in udev-extraconf was modified to use /run/media instead
of /media. Unfortunately, our scripts in initrdscripts have some
dependency on the auto-mounting mechanism proviced by udev-extraconf.
So these scripts should also be fixed to use /run/media instead /media,
otherwise, our live image cannot work correctly.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
meta/recipes-core/initrdscripts/files/init-install-efi.sh
meta/recipes-core/initrdscripts/files/init-install-testfs.sh
meta/recipes-core/initrdscripts/files/init-install.sh
meta/recipes-core/initrdscripts/files/init-live.sh

index 2fea7610f9721f01cff27efd327d89153f9ffda7..7a0b4d4406b5e82e296895ca5ab0b35d38b36ba7 100644 (file)
@@ -128,7 +128,7 @@ mkdir /rootmnt
 mkdir /bootmnt
 
 mount $rootfs /ssd
-mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /rootmnt
 
 echo "Copying rootfs files..."
 cp -a /rootmnt/* /ssd
@@ -150,13 +150,13 @@ mount $bootfs /ssd
 
 EFIDIR="/ssd/EFI/BOOT"
 mkdir -p $EFIDIR
-cp /media/$1/vmlinuz /ssd
+cp /run/media/$1/vmlinuz /ssd
 # Copy the efi loader
-cp /media/$1/EFI/BOOT/*.efi $EFIDIR
+cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
 
-if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
+if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
     GRUBCFG="$EFIDIR/grub.cfg"
-    cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
+    cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
     # Update grub config for the installed image
     # Delete the install entry
     sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
@@ -170,10 +170,10 @@ if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
     sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
 fi
 
-if [ -d /media/$1/loader ]; then
+if [ -d /run/media/$1/loader ]; then
     GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
     # copy config files for gummiboot
-    cp -dr /media/$1/loader /ssd
+    cp -dr /run/media/$1/loader /ssd
     # delete the install entry
     rm -f /ssd/loader/entries/install.conf
     # delete the initrd lines
index ed3221b0a6f34a91380be30795ca55b919bee948..8bd70251cdd910b36053ce2b14d6bb2f8b6e0dd0 100644 (file)
@@ -128,7 +128,7 @@ mkdir /rootmnt
 mkdir /bootmnt
 
 mount $rootfs /ssd
-mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /rootmnt
 
 echo "Copying rootfs files..."
 cp -a /rootmnt/* /ssd
@@ -150,13 +150,13 @@ mount $bootfs /ssd
 
 EFIDIR="/ssd/EFI/BOOT"
 mkdir -p $EFIDIR
-cp /media/$1/vmlinuz /ssd
+cp /run/media/$1/vmlinuz /ssd
 # Copy the efi loader
-cp /media/$1/EFI/BOOT/*.efi $EFIDIR
+cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
 
-if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
+if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
     GRUBCFG="$EFIDIR/grub.cfg"
-    cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
+    cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
     # Update grub config for the installed image
     # Delete the install entry
     sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
@@ -170,10 +170,10 @@ if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
     sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
 fi
 
-if [ -d /media/$1/loader ]; then
+if [ -d /run/media/$1/loader ]; then
     GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
     # copy config files for gummiboot
-    cp -dr /media/$1/loader /ssd
+    cp -dr /run/media/$1/loader /ssd
     # delete the install entry
     rm -f /ssd/loader/entries/install.conf
     # delete the initrd lines
index d2f2420498ff73458ec36e0002d9771860896ca6..26e1fb3dd20f35b180cf1f227dedc24965f10820 100644 (file)
@@ -151,7 +151,7 @@ mkdir -p /boot
 
 # Handling of the target root partition
 mount $rootfs /tgt_root
-mount -o rw,loop,noatime,nodiratime /media/$1/$2 /src_root
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
 echo "Copying rootfs files..."
 cp -a /src_root/* /tgt_root
 if [ -d /tgt_root/etc/ ] ; then
@@ -197,7 +197,7 @@ if [ ! -f /boot/grub/grub.cfg ] ; then
     echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
 fi
 
-cp /media/$1/vmlinuz /boot/
+cp /run/media/$1/vmlinuz /boot/
 
 umount /boot
 
index 8e433d5eda815002cba9bbc02d2642847f2e8d6e..b1600030f5a34897e296f0928b357e5e86ebd663 100644 (file)
@@ -151,7 +151,7 @@ mkdir -p /boot
 
 # Handling of the target root partition
 mount $rootfs /tgt_root
-mount -o rw,loop,noatime,nodiratime /media/$1/$2 /src_root
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
 echo "Copying rootfs files..."
 cp -a /src_root/* /tgt_root
 if [ -d /tgt_root/etc/ ] ; then
@@ -194,7 +194,7 @@ if [ ! -f /boot/grub/grub.cfg ] ; then
     echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
 fi
 
-cp /media/$1/vmlinuz /boot/
+cp /run/media/$1/vmlinuz /boot/
 
 umount /boot
 
index 0bc38b776ede1c095eed2e280c8ae26aa65dc7c8..0be9b6fb488e010e5e969c489c47bd4e97825b64 100644 (file)
@@ -82,9 +82,9 @@ boot_live_root() {
 
     # Move the mount points of some filesystems over to
     # the corresponding directories under the real root filesystem.
-    for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
-        mkdir -p  ${ROOT_MOUNT}/$dir
-        mount -n --move $dir ${ROOT_MOUNT}/$dir
+    for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
+        mkdir -p  ${ROOT_MOUNT}/media/${dir##*/}
+        mount -n --move $dir ${ROOT_MOUNT}/media/${dir##*/}
     done
     mount -n --move /proc ${ROOT_MOUNT}/proc
     mount -n --move /sys ${ROOT_MOUNT}/sys
@@ -113,11 +113,11 @@ echo "Waiting for removable media..."
 C=0
 while true
 do
-  for i in `ls /media 2>/dev/null`; do
-      if [ -f /media/$i/$ROOT_IMAGE ] ; then
+  for i in `ls /run/media 2>/dev/null`; do
+      if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
                found="yes"
                break
-         elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
+         elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
                found="yes"
                ISOLINUX="isolinux"
                break   
@@ -135,7 +135,7 @@ do
            mount | grep media
            echo "Available block devices"
            cat /proc/partitions
-           fatal "Cannot find $ROOT_IMAGE file in /media/* , dropping to a shell "
+           fatal "Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell "
       fi
       C=$(( C + 1 ))
   fi
@@ -150,7 +150,7 @@ mount_and_boot() {
     mkdir $ROOT_MOUNT
     mknod /dev/loop0 b 7 0 2>/dev/null
 
-    if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+    if ! mount -o rw,loop,noatime,nodiratime /run/media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
        fatal "Could not mount rootfs image"
     fi
 
@@ -211,7 +211,7 @@ case $label in
        mount_and_boot
        ;;
     install|install-efi)
-       if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
+       if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
            ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
        else
            fatal "Could not find $label script"