summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2013-08-16 17:38:10 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-20 15:31:25 +0100
commit059db226a096198801174a4d6e73d8101996ee5e (patch)
treecf5756da3da34349d0bc6e472f4cc9fb1fcbf207 /meta
parentd9e7fbad52844ec18cf74b3be27bdd9f98b140b2 (diff)
downloadpoky-059db226a096198801174a4d6e73d8101996ee5e.tar.gz
init-install.sh: fix to handle the boot partition correctly
Previously, the boot partition was created for the target hard drive but there was no corresponding entry for it in /etc/fstab. Besides, even if the boot partition was mounted, it would just result in odd directory hierarchy like /boot/boot/grub. However, what we really need is /boot/grub. This patch fixes this problem. Besides, for future maintance work, this patch also renames some of the intermediate directories. It uses more descriptive names like /tgt_root and /src_root. The name of /ssd is dropped. [YOCTO #5018] (From OE-Core rev: aa67b1333b4774e1845f562085f7048df65a644f) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/recipes-bsp/grub/grub-2.00/40_custom2
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh62
2 files changed, 30 insertions, 34 deletions
diff --git a/meta/recipes-bsp/grub/grub-2.00/40_custom b/meta/recipes-bsp/grub/grub-2.00/40_custom
index ba488308b6..f891b02779 100755
--- a/meta/recipes-bsp/grub/grub-2.00/40_custom
+++ b/meta/recipes-bsp/grub/grub-2.00/40_custom
@@ -5,5 +5,5 @@ exec tail -n +3 $0
5# the 'exec tail' line above. 5# the 'exec tail' line above.
6menuentry "Linux" { 6menuentry "Linux" {
7 set root=(hd0,1) 7 set root=(hd0,1)
8 linux /boot/vmlinuz root=__ROOTFS__ rw __CONSOLE__ __VIDEO_MODE__ __VGA_MODE__ quiet 8 linux /vmlinuz root=__ROOTFS__ rw __CONSOLE__ __VIDEO_MODE__ __VGA_MODE__ quiet
9} 9}
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index c892075145..8e433d5eda 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -145,29 +145,32 @@ mkfs.ext3 $rootfs
145echo "Formatting swap partition...($swap)" 145echo "Formatting swap partition...($swap)"
146mkswap $swap 146mkswap $swap
147 147
148mkdir /ssd 148mkdir /tgt_root
149mkdir /rootmnt 149mkdir /src_root
150mkdir /bootmnt 150mkdir -p /boot
151
152mount $rootfs /ssd
153mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
154 151
152# Handling of the target root partition
153mount $rootfs /tgt_root
154mount -o rw,loop,noatime,nodiratime /media/$1/$2 /src_root
155echo "Copying rootfs files..." 155echo "Copying rootfs files..."
156cp -a /rootmnt/* /ssd 156cp -a /src_root/* /tgt_root
157 157if [ -d /tgt_root/etc/ ] ; then
158if [ -d /ssd/etc/ ] ; then 158 echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab
159 echo "$swap swap swap defaults 0 0" >> /ssd/etc/fstab 159 echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab
160
161 # We dont want udev to mount our root device while we're booting... 160 # We dont want udev to mount our root device while we're booting...
162 if [ -d /ssd/etc/udev/ ] ; then 161 if [ -d /tgt_root/etc/udev/ ] ; then
163 echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist 162 echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
164 fi 163 fi
165fi 164fi
165umount /tgt_root
166umount /src_root
166 167
168# Handling of the target boot partition
169mount $bootfs /boot
170echo "Preparing boot partition..."
167if [ -f /etc/grub.d/40_custom ] ; then 171if [ -f /etc/grub.d/40_custom ] ; then
168 echo "Preparing custom grub2 menu..." 172 echo "Preparing custom grub2 menu..."
169 GRUBCFG="/bootmnt/boot/grub/grub.cfg" 173 GRUBCFG="/boot/grub/grub.cfg"
170 mount $bootfs /bootmnt
171 mkdir -p $(dirname $GRUBCFG) 174 mkdir -p $(dirname $GRUBCFG)
172 cp /etc/grub.d/40_custom $GRUBCFG 175 cp /etc/grub.d/40_custom $GRUBCFG
173 sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG 176 sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG
@@ -177,31 +180,24 @@ if [ -f /etc/grub.d/40_custom ] ; then
177 sed -i "/#/d" $GRUBCFG 180 sed -i "/#/d" $GRUBCFG
178 sed -i "/exec tail/d" $GRUBCFG 181 sed -i "/exec tail/d" $GRUBCFG
179 chmod 0444 $GRUBCFG 182 chmod 0444 $GRUBCFG
180 umount /bootmnt
181fi 183fi
182 184grub-install /dev/${device}
183umount /ssd 185echo "(hd0) /dev/${device}" > /boot/grub/device.map
184umount /rootmnt
185
186echo "Preparing boot partition..."
187mount $bootfs /ssd
188grub-install --root-directory=/ssd /dev/${device}
189
190echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
191 186
192# If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst 187# If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst
193if [ ! -f /ssd/boot/grub/grub.cfg ] ; then 188if [ ! -f /boot/grub/grub.cfg ] ; then
194 echo "Preparing custom grub menu..." 189 echo "Preparing custom grub menu..."
195 echo "default 0" > /ssd/boot/grub/menu.lst 190 echo "default 0" > /boot/grub/menu.lst
196 echo "timeout 30" >> /ssd/boot/grub/menu.lst 191 echo "timeout 30" >> /boot/grub/menu.lst
197 echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst 192 echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
198 echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst 193 echo "root (hd0,0)" >> /boot/grub/menu.lst
199 echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst 194 echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
200fi 195fi
201 196
202cp /media/$1/vmlinuz /ssd/boot/ 197cp /media/$1/vmlinuz /boot/
198
199umount /boot
203 200
204umount /ssd
205sync 201sync
206 202
207echo "Remove your installation media, and press ENTER" 203echo "Remove your installation media, and press ENTER"