summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2012-05-01 21:14:18 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-06 09:54:46 +0100
commitbf403680d72e360c7382f540ea25cfdcbe77b4e5 (patch)
treedc3bc4cd2fcf9787d36b009d5791434090791a4a /meta
parent2b93ed90736ed08c25561e24343a5ef2b8f7dbef (diff)
downloadopenembedded-core-bf403680d72e360c7382f540ea25cfdcbe77b4e5.tar.gz
openembedded-core-bf403680d72e360c7382f540ea25cfdcbe77b4e5.tar.bz2
openembedded-core-bf403680d72e360c7382f540ea25cfdcbe77b4e5.zip
initrdscripts: Update install.sh to work with mmc devices
Fixes [YOCTO #2385] The installer only searches for hd[ab] sd[ab]. Some newer BSPs have mmcblk devices that should be used as the install target. These devices also have a partition prefix (mmcblk0p1 instead of mmcblk01). As they are detected asynchronously, it is necessary to add the rootwait kernel parameter to avoid a race condition trying to mount the root device. As BSPs like the FRI2 and the sys940x have mmc devices and will have a 1.2 release, we should push this to 1.2.1. The changes are perfectly contained and easily verified. Test for an mmcblk device and add the p partition prefix if necessary. Add the rootwait kernel parameter when an mmcblk device is detected. Replace the series of explicit umount commands with a single umount using a wildcard. This will find all the partitions and will not try to unmount non-existant devices. Avoid copy and paste errors by replacing /dev/${device}${pX} references with the previously assigned rootfs, bootfs, and swap variables. These changes have been tested on the FRI2 Sato image which installed to /dev/mmcblk0 as well as the N450 Sato image which installed to /dev/sda. Both were successful. Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh45
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb2
2 files changed, 25 insertions, 22 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 90978dd36a..01ff82926a 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -16,7 +16,7 @@ swap_ratio=5
found="no"
echo "Searching for a hard drive..."
-for device in 'hda' 'hdb' 'sda' 'sdb'
+for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1'
do
if [ -e /sys/block/${device}/removable ]; then
if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
@@ -62,13 +62,7 @@ rm -f /etc/udev/scripts/mount*
#
# Unmount anything the automounter had mounted
#
-umount /dev/${device} 2> /dev/null || /bin/true
-umount /dev/${device}1 2> /dev/null || /bin/true
-umount /dev/${device}2 2> /dev/null || /bin/true
-umount /dev/${device}3 2> /dev/null || /bin/true
-umount /dev/${device}4 2> /dev/null || /bin/true
-umount /dev/${device}5 2> /dev/null || /bin/true
-umount /dev/${device}6 2> /dev/null || /bin/true
+umount /dev/${device}* 2> /dev/null || /bin/true
if [ ! -b /dev/sda ] ; then
mknod /dev/sda b 8 0
@@ -94,14 +88,23 @@ rootfs_start=$((boot_size + 1))
rootfs_end=$((rootfs_start+rootfs_size))
swap_start=$((rootfs_end+1))
-bootfs=/dev/${device}1
-rootfs=/dev/${device}2
-swap=/dev/${device}3
+# MMC devices are special in a couple of ways
+# 1) they use a partition prefix character 'p'
+# 2) they are detected asynchronously (need rootwait)
+rootwait=""
+part_prefix=""
+if [ ! "${device#mmcblk}" = "${device}" ]; then
+ part_prefix="p"
+ rootwait="rootwait"
+fi
+bootfs=/dev/${device}${part_prefix}1
+rootfs=/dev/${device}${part_prefix}2
+swap=/dev/${device}${part_prefix}3
echo "*****************"
-echo "Boot partition size: $boot_size MB (/dev/${device}1)"
-echo "Rootfs partition size: $rootfs_size MB (/dev/${device}2)"
-echo "Swap partition size: $swap_size MB (/dev/${device}3)"
+echo "Boot partition size: $boot_size MB ($bootfs)"
+echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
+echo "Swap partition size: $swap_size MB ($swap)"
echo "*****************"
echo "Deleting partition table on /dev/${device} ..."
dd if=/dev/zero of=/dev/${device} bs=512 count=2
@@ -109,24 +112,24 @@ dd if=/dev/zero of=/dev/${device} bs=512 count=2
echo "Creating new partition table on /dev/${device} ..."
parted /dev/${device} mklabel msdos
-echo "Creating boot partition on /dev/${device}1"
+echo "Creating boot partition on $bootfs"
parted /dev/${device} mkpart primary 1 $boot_size
-echo "Creating rootfs partition on /dev/${device}2"
+echo "Creating rootfs partition on $rootfs"
parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
-echo "Creating swap partition on /dev/${device}3"
+echo "Creating swap partition on $swap"
parted /dev/${device} mkpart primary $swap_start $disk_size
parted /dev/${device} print
-echo "Formatting /dev/${device}1 to ext2..."
+echo "Formatting $bootfs to ext2..."
mkfs.ext3 $bootfs
-echo "Formatting /dev/${device}2 to ext3..."
+echo "Formatting $rootfs to ext3..."
mkfs.ext3 $rootfs
-echo "Formatting swap partition...(/dev/${device}3)"
+echo "Formatting swap partition...($swap)"
mkswap $swap
mkdir /ssd
@@ -150,7 +153,7 @@ fi
if [ -f /ssd/etc/grub.d/40_custom ] ; then
echo "Preparing custom grub2 menu..."
- sed -i "s@__ROOTFS__@$rootfs@g" /ssd/etc/grub.d/40_custom
+ sed -i "s@__ROOTFS__@$rootfs $rootwait@g" /ssd/etc/grub.d/40_custom
sed -i "s/__VIDEO_MODE__/$3/g" /ssd/etc/grub.d/40_custom
sed -i "s/__VGA_MODE__/$4/g" /ssd/etc/grub.d/40_custom
mount $bootfs /bootmnt
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 793a4b799b..ac73ef80aa 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -3,7 +3,7 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "file://init-install.sh"
-PR = "r6"
+PR = "r7"
RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"