diff options
Diffstat (limited to 'yocto-poky/meta/recipes-core/initrdscripts/files')
4 files changed, 23 insertions, 28 deletions
diff --git a/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh index 7a0b4d440..b56210915 100644 --- a/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh +++ b/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh @@ -69,7 +69,7 @@ umount /dev/${device}* 2> /dev/null || /bin/true mkdir -p /tmp cat /proc/mounts > /etc/mtab -disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") +disk_size=$(parted /dev/${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") testfs_size=$((disk_size*testfs_ratio/100)) rootfs_size=$((disk_size-boot_size-testfs_size)) diff --git a/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh index 0443a9d11..d58826a24 100644 --- a/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/yocto-poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh @@ -120,7 +120,7 @@ if [ ! -e /etc/mtab ]; then cat /proc/mounts > /etc/mtab fi -disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") +disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") swap_size=$((disk_size*swap_ratio/100)) rootfs_size=$((disk_size-boot_size-swap_size)) @@ -217,7 +217,7 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then # Delete any LABEL= strings sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG # Delete any root= strings - sed -i "s/ root=[^ ]*/ /" $GRUBCFG + sed -i "s/ root=[^ ]*/ /g" $GRUBCFG # Add the root= and other standard boot options sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG fi diff --git a/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh b/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh index f9e9768e4..c5623eeb2 100644 --- a/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh +++ b/yocto-poky/meta/recipes-core/initrdscripts/files/init-install.sh @@ -116,7 +116,7 @@ if [ ! -L /etc/mtab ]; then cat /proc/mounts > /etc/mtab fi -disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//") +disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//") grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/') @@ -141,7 +141,7 @@ swap_start=$((rootfs_end)) # 2) they are detected asynchronously (need rootwait) rootwait="" part_prefix="" -if [ ! "${device#mmcblk}" = "${device}" ]; then +if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then part_prefix="p" rootwait="rootwait" fi @@ -211,13 +211,13 @@ echo "Copying rootfs files..." cp -a /src_root/* /tgt_root if [ -d /tgt_root/etc/ ] ; then if [ $grub_version -ne 0 ] ; then - boot_uuid=$(blkid -o value -s UUID ${device}2) - swap_part_uuid=$(blkid -o value -s PARTUUID ${device}4) + boot_uuid=$(blkid -o value -s UUID ${bootfs}) + swap_part_uuid=$(blkid -o value -s PARTUUID ${swap}) bootdev="UUID=$boot_uuid" swapdev=/dev/disk/by-partuuid/$swap_part_uuid else - bootdev=${device}2 - swapdev=${device}4 + bootdev=${bootfs} + swapdev=${swap} fi echo "$swapdev swap swap defaults 0 0" >> /tgt_root/etc/fstab echo "$bootdev /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab @@ -234,8 +234,8 @@ mount $bootfs /boot echo "Preparing boot partition..." if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then echo "Preparing custom grub2 menu..." - root_part_uuid=$(blkid -o value -s PARTUUID ${device}3) - boot_uuid=$(blkid -o value -s UUID ${device}2) + root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs}) + boot_uuid=$(blkid -o value -s UUID ${bootfs}) GRUBCFG="/boot/grub/grub.cfg" mkdir -p $(dirname $GRUBCFG) cat >$GRUBCFG <<_EOF diff --git a/yocto-poky/meta/recipes-core/initrdscripts/files/init-live.sh b/yocto-poky/meta/recipes-core/initrdscripts/files/init-live.sh index d852c5737..09fb47991 100644 --- a/yocto-poky/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/yocto-poky/meta/recipes-core/initrdscripts/files/init-live.sh @@ -2,7 +2,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin -ROOT_MOUNT="/rootfs/" +ROOT_MOUNT="/rootfs" ROOT_IMAGE="rootfs.img" MOUNT="/bin/mount" UMOUNT="/bin/umount" @@ -169,8 +169,8 @@ mount_and_boot() { # determine which unification filesystem to use union_fs_type="" - if grep -q -w "overlayfs" /proc/filesystems; then - union_fs_type="overlayfs" + if grep -q -w "overlay" /proc/filesystems; then + union_fs_type="overlay" elif grep -q -w "aufs" /proc/filesystems; then union_fs_type="aufs" else @@ -179,14 +179,15 @@ mount_and_boot() { # make a union mount if possible case $union_fs_type in - "overlayfs") + "overlay") mkdir -p /rootfs.ro /rootfs.rw if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then rm -rf /rootfs.ro /rootfs.rw fatal "Could not move rootfs mount point" else mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw - mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT + mkdir -p /rootfs.rw/upperdir /rootfs.rw/work + mount -t overlay overlay -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw/upperdir,workdir=/rootfs.rw/work" $ROOT_MOUNT mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw @@ -214,11 +215,7 @@ mount_and_boot() { boot_live_root } -case $label in - boot) - mount_and_boot - ;; - install|install-efi) +if [ "$label" != "boot" -a -f $label.sh ] ; then if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params else @@ -226,10 +223,8 @@ case $label in fi # If we're getting here, we failed... - fatal "Installation image failed" - ;; - *) - # Not sure what boot label is provided. Try to boot to avoid locking up. - mount_and_boot - ;; -esac + fatal "Target $label failed" +fi + +mount_and_boot + |