summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/mkefidisk.sh
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2014-07-16 14:15:59 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-19 00:09:00 +0100
commit88045c9db784d56cfd9e9d002af3c94d2a25defe (patch)
tree8b91fb07f49d09835072833245fbf76202b46df5 /scripts/contrib/mkefidisk.sh
parent7f595ea8966b17c08b0770b3af472238a62f598a (diff)
downloadpoky-88045c9db784d56cfd9e9d002af3c94d2a25defe.tar.gz
mkefidisk.sh: Add gummiboot support
Fixes [YOCTO 6295] Add gummiboot support for images built using: EFI_PROVIDER="gummiboot" Add conditional configuration for GRUB and gummiboot. Provide some messaging about which is being performed. (From OE-Core rev: b0c86d8149dffd72d0dbd2451031f30953e36dc7) Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/mkefidisk.sh')
-rwxr-xr-xscripts/contrib/mkefidisk.sh53
1 files changed, 41 insertions, 12 deletions
diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 0d0674b4c2..9b130416a1 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -265,31 +265,60 @@ umount $HDDIMG_ROOTFS_MNT
265echo "Preparing boot partition..." 265echo "Preparing boot partition..."
266EFIDIR="$BOOTFS_MNT/EFI/BOOT" 266EFIDIR="$BOOTFS_MNT/EFI/BOOT"
267mkdir -p $EFIDIR 267mkdir -p $EFIDIR
268GRUBCFG="$EFIDIR/grub.cfg"
269 268
270cp $HDDIMG_MNT/vmlinuz $BOOTFS_MNT 269cp $HDDIMG_MNT/vmlinuz $BOOTFS_MNT
271# Copy the efi loader and config (booti*.efi and grub.cfg) 270# Copy the efi loader and configs (booti*.efi and grub.cfg if it exists)
272cp $HDDIMG_MNT/EFI/BOOT/* $EFIDIR 271cp $HDDIMG_MNT/EFI/BOOT/* $EFIDIR
272# Silently ignore a missing gummiboot loader dir (we might just be a GRUB image)
273cp -r $HDDIMG_MNT/loader $BOOTFS_MNT 2> /dev/null
273 274
274# Update grub config for the installed image 275# Update the boot loaders configurations for an installed image
275# Delete the install entry
276sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
277# Delete the initrd lines
278sed -i "/initrd /d" $GRUBCFG
279# Delete any LABEL= strings
280sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
281# Remove any existing root= kernel parameters and: 276# Remove any existing root= kernel parameters and:
282# o Add a root= parameter with the target rootfs 277# o Add a root= parameter with the target rootfs
283# o Specify ro so fsck can be run during boot 278# o Specify ro so fsck can be run during boot
284# o Specify rootwait in case the target media is an asyncronous block device 279# o Specify rootwait in case the target media is an asyncronous block device
285# such as MMC or USB disks 280# such as MMC or USB disks
286# o Specify "quiet" to minimize boot time when using slow serial consoles 281# o Specify "quiet" to minimize boot time when using slow serial consoles
287sed -i "s@ root=[^ ]*@ @" $GRUBCFG 282
288sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait quiet @" $GRUBCFG 283# Look for a GRUB installation
284GRUB_CFG="$EFIDIR/grub.cfg"
285if [ -e "$GRUB_CFG" ]; then
286 echo "Configuring GRUB"
287 # Delete the install entry
288 sed -i "/menuentry 'install'/,/^}/d" $GRUB_CFG
289 # Delete the initrd lines
290 sed -i "/initrd /d" $GRUB_CFG
291 # Delete any LABEL= strings
292 sed -i "s/ LABEL=[^ ]*/ /" $GRUB_CFG
293
294 sed -i "s@ root=[^ ]*@ @" $GRUB_CFG
295 sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait quiet @" $GRUB_CFG
296fi
297
298# Look for a gummiboot installation
299GUMMI_ENTRIES="$BOOTFS_MNT/loader/entries"
300GUMMI_CFG="$GUMMI_ENTRIES/boot.conf"
301if [ -d "$GUMMI_ENTRIES" ]; then
302 echo "Configuring Gummiboot"
303 # remove the install target if it exists
304 rm $GUMMI_ENTRIES/install.conf &> /dev/null
305
306 if [ ! -e "$GUMMI_CFG" ]; then
307 echo "ERROR: $GUMMI_CFG not found"
308 fi
309
310 sed -i "s@ root=[^ ]*@ @" $GUMMI_CFG
311 sed -i "s@options *LABEL=boot @options LABEL=Boot root=$TARGET_ROOTFS ro rootwait quiet @" $GUMMI_CFG
312fi
313
314# Ensure we have at least one EFI bootloader configured
315if [ ! -e $GRUB_CFG ] && [ ! -e $GUMMI_CFG ]; then
316 echo "ERROR: No EFI bootloader configuration found"
317fi
289 318
290umount $BOOTFS_MNT 319umount $BOOTFS_MNT
291umount $HDDIMG_MNT 320umount $HDDIMG_MNT
292rm -rf $TMPDIR 321rm -rf $TMPDIR
293sync 322sync
294 323
295echo "Installation complete." 324echo "Installation complete"