summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2012-05-01 17:21:59 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-31 21:15:12 +0100
commita74fb01b6b15cfa69fd507eb083cca26d2685867 (patch)
treeb1f819a071bc85a91ff485f0e023856542a2a997 /meta
parentc003c045905ae068aae9b9a62662b20b1d14068a (diff)
downloadpoky-a74fb01b6b15cfa69fd507eb083cca26d2685867.tar.gz
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. (From OE-Core rev: 36634e16c0a0c80674bacf20f9841e3b042bd5fd) Signed-off-by: Darren Hart <dvhart@linux.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
16found="no" 16found="no"
17 17
18echo "Searching for a hard drive..." 18echo "Searching for a hard drive..."
19for device in 'hda' 'hdb' 'sda' 'sdb' 19for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1'
20 do 20 do
21 if [ -e /sys/block/${device}/removable ]; then 21 if [ -e /sys/block/${device}/removable ]; then
22 if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then 22 if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
@@ -62,13 +62,7 @@ rm -f /etc/udev/scripts/mount*
62# 62#
63# Unmount anything the automounter had mounted 63# Unmount anything the automounter had mounted
64# 64#
65umount /dev/${device} 2> /dev/null || /bin/true 65umount /dev/${device}* 2> /dev/null || /bin/true
66umount /dev/${device}1 2> /dev/null || /bin/true
67umount /dev/${device}2 2> /dev/null || /bin/true
68umount /dev/${device}3 2> /dev/null || /bin/true
69umount /dev/${device}4 2> /dev/null || /bin/true
70umount /dev/${device}5 2> /dev/null || /bin/true
71umount /dev/${device}6 2> /dev/null || /bin/true
72 66
73if [ ! -b /dev/sda ] ; then 67if [ ! -b /dev/sda ] ; then
74 mknod /dev/sda b 8 0 68 mknod /dev/sda b 8 0
@@ -94,14 +88,23 @@ rootfs_start=$((boot_size + 1))
94rootfs_end=$((rootfs_start+rootfs_size)) 88rootfs_end=$((rootfs_start+rootfs_size))
95swap_start=$((rootfs_end+1)) 89swap_start=$((rootfs_end+1))
96 90
97bootfs=/dev/${device}1 91# MMC devices are special in a couple of ways
98rootfs=/dev/${device}2 92# 1) they use a partition prefix character 'p'
99swap=/dev/${device}3 93# 2) they are detected asynchronously (need rootwait)
94rootwait=""
95part_prefix=""
96if [ ! "${device#mmcblk}" = "${device}" ]; then
97 part_prefix="p"
98 rootwait="rootwait"
99fi
100bootfs=/dev/${device}${part_prefix}1
101rootfs=/dev/${device}${part_prefix}2
102swap=/dev/${device}${part_prefix}3
100 103
101echo "*****************" 104echo "*****************"
102echo "Boot partition size: $boot_size MB (/dev/${device}1)" 105echo "Boot partition size: $boot_size MB ($bootfs)"
103echo "Rootfs partition size: $rootfs_size MB (/dev/${device}2)" 106echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
104echo "Swap partition size: $swap_size MB (/dev/${device}3)" 107echo "Swap partition size: $swap_size MB ($swap)"
105echo "*****************" 108echo "*****************"
106echo "Deleting partition table on /dev/${device} ..." 109echo "Deleting partition table on /dev/${device} ..."
107dd if=/dev/zero of=/dev/${device} bs=512 count=2 110dd 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
109echo "Creating new partition table on /dev/${device} ..." 112echo "Creating new partition table on /dev/${device} ..."
110parted /dev/${device} mklabel msdos 113parted /dev/${device} mklabel msdos
111 114
112echo "Creating boot partition on /dev/${device}1" 115echo "Creating boot partition on $bootfs"
113parted /dev/${device} mkpart primary 1 $boot_size 116parted /dev/${device} mkpart primary 1 $boot_size
114 117
115echo "Creating rootfs partition on /dev/${device}2" 118echo "Creating rootfs partition on $rootfs"
116parted /dev/${device} mkpart primary $rootfs_start $rootfs_end 119parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
117 120
118echo "Creating swap partition on /dev/${device}3" 121echo "Creating swap partition on $swap"
119parted /dev/${device} mkpart primary $swap_start $disk_size 122parted /dev/${device} mkpart primary $swap_start $disk_size
120 123
121parted /dev/${device} print 124parted /dev/${device} print
122 125
123echo "Formatting /dev/${device}1 to ext2..." 126echo "Formatting $bootfs to ext2..."
124mkfs.ext3 $bootfs 127mkfs.ext3 $bootfs
125 128
126echo "Formatting /dev/${device}2 to ext3..." 129echo "Formatting $rootfs to ext3..."
127mkfs.ext3 $rootfs 130mkfs.ext3 $rootfs
128 131
129echo "Formatting swap partition...(/dev/${device}3)" 132echo "Formatting swap partition...($swap)"
130mkswap $swap 133mkswap $swap
131 134
132mkdir /ssd 135mkdir /ssd
@@ -150,7 +153,7 @@ fi
150 153
151if [ -f /ssd/etc/grub.d/40_custom ] ; then 154if [ -f /ssd/etc/grub.d/40_custom ] ; then
152 echo "Preparing custom grub2 menu..." 155 echo "Preparing custom grub2 menu..."
153 sed -i "s@__ROOTFS__@$rootfs@g" /ssd/etc/grub.d/40_custom 156 sed -i "s@__ROOTFS__@$rootfs $rootwait@g" /ssd/etc/grub.d/40_custom
154 sed -i "s/__VIDEO_MODE__/$3/g" /ssd/etc/grub.d/40_custom 157 sed -i "s/__VIDEO_MODE__/$3/g" /ssd/etc/grub.d/40_custom
155 sed -i "s/__VGA_MODE__/$4/g" /ssd/etc/grub.d/40_custom 158 sed -i "s/__VGA_MODE__/$4/g" /ssd/etc/grub.d/40_custom
156 mount $bootfs /bootmnt 159 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"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4SRC_URI = "file://init-install.sh" 4SRC_URI = "file://init-install.sh"
5 5
6PR = "r6" 6PR = "r7"
7 7
8RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs" 8RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
9 9