summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initrdscripts')
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh23
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
196echo "Copying rootfs files..." 196echo "Copying rootfs files..."
197cp -a /src_root/* /tgt_root 197cp -a /src_root/* /tgt_root
198if [ -d /tgt_root/etc/ ] ; then 198if [ -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
210mount $bootfs /boot 219mount $bootfs /boot
211echo "Preparing boot partition..." 220echo "Preparing boot partition..."
212if [ -f /etc/grub.d/00_header ] ; then 221if [ -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
217menuentry "Linux" { 228menuentry "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
223fi 234fi
224grub-install /dev/${device} 235grub-install /dev/${device}
225echo "(hd0) /dev/${device}" > /boot/grub/device.map
226 236
227if [ $grub_version -eq 0 ] ; then 237if [ $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