diff options
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-install.sh | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh index 298ea8d529..9957c15ccf 100644 --- a/meta/recipes-core/initrdscripts/files/init-install.sh +++ b/meta/recipes-core/initrdscripts/files/init-install.sh | |||
@@ -196,8 +196,17 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root | |||
196 | echo "Copying rootfs files..." | 196 | echo "Copying rootfs files..." |
197 | cp -a /src_root/* /tgt_root | 197 | cp -a /src_root/* /tgt_root |
198 | if [ -d /tgt_root/etc/ ] ; then | 198 | if [ -d /tgt_root/etc/ ] ; then |
199 | echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab | 199 | if [ $grub_version -ne 0 ] ; then |
200 | echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab | 200 | boot_uuid=$(blkid -o value -s UUID ${device}2) |
201 | swap_part_uuid=$(blkid -o value -s PARTUUID ${device}4) | ||
202 | bootdev="UUID=$boot_uuid" | ||
203 | swapdev=/dev/disk/by-partuuid/$swap_part_uuid | ||
204 | else | ||
205 | bootdev=${device}2 | ||
206 | swapdev=${device}4 | ||
207 | fi | ||
208 | echo "$swapdev swap swap defaults 0 0" >> /tgt_root/etc/fstab | ||
209 | echo "$bootdev /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab | ||
201 | # We dont want udev to mount our root device while we're booting... | 210 | # We dont want udev to mount our root device while we're booting... |
202 | if [ -d /tgt_root/etc/udev/ ] ; then | 211 | if [ -d /tgt_root/etc/udev/ ] ; then |
203 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist | 212 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist |
@@ -209,22 +218,24 @@ umount /src_root | |||
209 | # Handling of the target boot partition | 218 | # Handling of the target boot partition |
210 | mount $bootfs /boot | 219 | mount $bootfs /boot |
211 | echo "Preparing boot partition..." | 220 | echo "Preparing boot partition..." |
212 | if [ -f /etc/grub.d/00_header ] ; then | 221 | if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then |
213 | echo "Preparing custom grub2 menu..." | 222 | echo "Preparing custom grub2 menu..." |
223 | root_part_uuid=$(blkid -o value -s PARTUUID /dev/${device}3) | ||
224 | boot_uuid=$(blkid -o value -s UUID /dev/${device}2) | ||
214 | GRUBCFG="/boot/grub/grub.cfg" | 225 | GRUBCFG="/boot/grub/grub.cfg" |
215 | mkdir -p $(dirname $GRUBCFG) | 226 | mkdir -p $(dirname $GRUBCFG) |
216 | cat >$GRUBCFG <<_EOF | 227 | cat >$GRUBCFG <<_EOF |
217 | menuentry "Linux" { | 228 | menuentry "Linux" { |
218 | set root=(hd0,2) | 229 | search --no-floppy --fs-uuid $boot_uuid --set root |
219 | linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet | 230 | linux /vmlinuz root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet |
220 | } | 231 | } |
221 | _EOF | 232 | _EOF |
222 | chmod 0444 $GRUBCFG | 233 | chmod 0444 $GRUBCFG |
223 | fi | 234 | fi |
224 | grub-install /dev/${device} | 235 | grub-install /dev/${device} |
225 | echo "(hd0) /dev/${device}" > /boot/grub/device.map | ||
226 | 236 | ||
227 | if [ $grub_version -eq 0 ] ; then | 237 | if [ $grub_version -eq 0 ] ; then |
238 | echo "(hd0) /dev/${device}" > /boot/grub/device.map | ||
228 | echo "Preparing custom grub menu..." | 239 | echo "Preparing custom grub menu..." |
229 | echo "default 0" > /boot/grub/menu.lst | 240 | echo "default 0" > /boot/grub/menu.lst |
230 | echo "timeout 30" >> /boot/grub/menu.lst | 241 | echo "timeout 30" >> /boot/grub/menu.lst |