[yocto] Customize live grub entries

Alvaro Garcia maxpowel at gmail.com
Fri Apr 7 05:04:54 PDT 2017


This works but when the image is installed, it cannot boot because there a
not configuration for grub (grub prompt is shown). But I found the reason.
It is because I'm using EFI boot and the installer
poky/meta/recipes-core/initrdscripts/files/init-install-efi.sh uses the
live grub config and then modify it:

if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
    root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
    GRUBCFG="$EFIDIR/grub.cfg"
    cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
   # Update grub config for the installed image
    # Delete the install entry
    sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
    # Delete the initrd lines
    sed -i "/initrd /d" $GRUBCFG
    # Delete any LABEL= strings
    sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
    # Delete any root= strings
    sed -i "s/ root=[^ ]*/ /g" $GRUBCFG
    # Add the root= and other standard boot options
    sed -i "s at linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid
rw $rootwait quiet @" $GRUBCFG
fi


I modified this script and everythig is working as I want.

Thank you!

2017-04-07 13:12 GMT+02:00 Chris Trobridge <christrobridge at hotmail.com>:

> > From: yocto-bounces at yoctoproject.org <yocto-bounces at yoctoproject.org>
> on behalf of Alvaro Garcia > <maxpowel at gmail.com>
> > Sent: 07 April 2017 11:59
> > To: yocto at yoctoproject.org
> > Subject: [yocto] Customize live grub entries
>
>
> > Hi, I want an unattended installation (just boot from USB, install, and
> remove USB). I am able to remove all questions during install but I cant
> customize the grub entries of the live boot. By default is market the
> option "boot" but I need the  "install" option.
>
> > In the file poky/plain/meta/classes/grub-efi.bbclass I found that the
> variable GRUB_CFG_LIVE = "${S}/grub_live.cfg" contains the file with this
> configuration but I cannot find this file. Where the image is built (inside
> tmp directory) this file exists. I tried  to override the variables
> "LABELS_LIVE" without success (if I remove the boot option, it also
> disappears from the installation and cannot boot later).
>
> > Once the image is flashed to an USB memory, the file syslinux_live.cfg
> exists in the boot partition and if I edit it it works as I want. But this
> is the bad way, would be great if I can edit it inside yocto build process.
>
> > Anyone knows what recipe should override?
>
> > Thank you
>
> I use:
> LABELS_LIVE = "install"
>
> Just before I inherit core-image in my custom image recipe.
>
> Regards,
> Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170407/a4269501/attachment.html>


More information about the yocto mailing list