initrdscripts: fix mmc device as install target

Installing from USB to an internal SD Card did not work with Linux 4.4 in Yocto jethro. With this patch, consistent names are used for the paritions.

(From OE-Core rev: 00a45d2e50c4f044ee4099940dd7d13ca44f7187)

Signed-off-by: Urs Fässler <urs.fassler@bbv.ch>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Urs Fässler
2016-02-08 13:31:58 +01:00
committed by Richard Purdie
parent c3ef2bb0bd
commit 7edea7c0a4

View File

@@ -141,7 +141,7 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait) # 2) they are detected asynchronously (need rootwait)
rootwait="" rootwait=""
part_prefix="" part_prefix=""
if [ ! "${device#mmcblk}" = "${device}" ]; then if [ ! "${device#/dev/mmcblk}" = "${device}" ]; then
part_prefix="p" part_prefix="p"
rootwait="rootwait" rootwait="rootwait"
fi fi
@@ -211,13 +211,13 @@ echo "Copying rootfs files..."
cp -a /src_root/* /tgt_root cp -a /src_root/* /tgt_root
if [ -d /tgt_root/etc/ ] ; then if [ -d /tgt_root/etc/ ] ; then
if [ $grub_version -ne 0 ] ; then if [ $grub_version -ne 0 ] ; then
boot_uuid=$(blkid -o value -s UUID ${device}2) boot_uuid=$(blkid -o value -s UUID ${bootfs})
swap_part_uuid=$(blkid -o value -s PARTUUID ${device}4) swap_part_uuid=$(blkid -o value -s PARTUUID ${swap})
bootdev="UUID=$boot_uuid" bootdev="UUID=$boot_uuid"
swapdev=/dev/disk/by-partuuid/$swap_part_uuid swapdev=/dev/disk/by-partuuid/$swap_part_uuid
else else
bootdev=${device}2 bootdev=${bootfs}
swapdev=${device}4 swapdev=${swap}
fi fi
echo "$swapdev swap swap defaults 0 0" >> /tgt_root/etc/fstab echo "$swapdev swap swap defaults 0 0" >> /tgt_root/etc/fstab
echo "$bootdev /boot ext3 defaults 1 2" >> /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..." echo "Preparing boot partition..."
if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then
echo "Preparing custom grub2 menu..." echo "Preparing custom grub2 menu..."
root_part_uuid=$(blkid -o value -s PARTUUID ${device}3) root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
boot_uuid=$(blkid -o value -s UUID ${device}2) boot_uuid=$(blkid -o value -s UUID ${bootfs})
GRUBCFG="/boot/grub/grub.cfg" GRUBCFG="/boot/grub/grub.cfg"
mkdir -p $(dirname $GRUBCFG) mkdir -p $(dirname $GRUBCFG)
cat >$GRUBCFG <<_EOF cat >$GRUBCFG <<_EOF