summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/files/init-install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initrdscripts/files/init-install.sh')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh45
1 files changed, 24 insertions, 21 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