diff options
author | Darren Hart <dvhart@linux.intel.com> | 2014-07-16 14:15:59 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-19 00:09:00 +0100 |
commit | 88045c9db784d56cfd9e9d002af3c94d2a25defe (patch) | |
tree | 8b91fb07f49d09835072833245fbf76202b46df5 /scripts/contrib | |
parent | 7f595ea8966b17c08b0770b3af472238a62f598a (diff) | |
download | poky-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')
-rwxr-xr-x | scripts/contrib/mkefidisk.sh | 53 |
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 | |||
265 | echo "Preparing boot partition..." | 265 | echo "Preparing boot partition..." |
266 | EFIDIR="$BOOTFS_MNT/EFI/BOOT" | 266 | EFIDIR="$BOOTFS_MNT/EFI/BOOT" |
267 | mkdir -p $EFIDIR | 267 | mkdir -p $EFIDIR |
268 | GRUBCFG="$EFIDIR/grub.cfg" | ||
269 | 268 | ||
270 | cp $HDDIMG_MNT/vmlinuz $BOOTFS_MNT | 269 | cp $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) |
272 | cp $HDDIMG_MNT/EFI/BOOT/* $EFIDIR | 271 | cp $HDDIMG_MNT/EFI/BOOT/* $EFIDIR |
272 | # Silently ignore a missing gummiboot loader dir (we might just be a GRUB image) | ||
273 | cp -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 | ||
276 | sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG | ||
277 | # Delete the initrd lines | ||
278 | sed -i "/initrd /d" $GRUBCFG | ||
279 | # Delete any LABEL= strings | ||
280 | sed -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 |
287 | sed -i "s@ root=[^ ]*@ @" $GRUBCFG | 282 | |
288 | sed -i "s@vmlinuz @vmlinuz root=$TARGET_ROOTFS ro rootwait quiet @" $GRUBCFG | 283 | # Look for a GRUB installation |
284 | GRUB_CFG="$EFIDIR/grub.cfg" | ||
285 | if [ -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 | ||
296 | fi | ||
297 | |||
298 | # Look for a gummiboot installation | ||
299 | GUMMI_ENTRIES="$BOOTFS_MNT/loader/entries" | ||
300 | GUMMI_CFG="$GUMMI_ENTRIES/boot.conf" | ||
301 | if [ -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 | ||
312 | fi | ||
313 | |||
314 | # Ensure we have at least one EFI bootloader configured | ||
315 | if [ ! -e $GRUB_CFG ] && [ ! -e $GUMMI_CFG ]; then | ||
316 | echo "ERROR: No EFI bootloader configuration found" | ||
317 | fi | ||
289 | 318 | ||
290 | umount $BOOTFS_MNT | 319 | umount $BOOTFS_MNT |
291 | umount $HDDIMG_MNT | 320 | umount $HDDIMG_MNT |
292 | rm -rf $TMPDIR | 321 | rm -rf $TMPDIR |
293 | sync | 322 | sync |
294 | 323 | ||
295 | echo "Installation complete." | 324 | echo "Installation complete" |