All of lore.kernel.org
 help / color / mirror / Atom feed
* Customize live grub entries
@ 2017-04-07 10:59 Alvaro Garcia
  2017-04-07 11:12 ` Chris Trobridge
  0 siblings, 1 reply; 3+ messages in thread
From: Alvaro Garcia @ 2017-04-07 10:59 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1042 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Customize live grub entries
  2017-04-07 10:59 Customize live grub entries Alvaro Garcia
@ 2017-04-07 11:12 ` Chris Trobridge
  2017-04-07 12:04   ` Alvaro Garcia
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Trobridge @ 2017-04-07 11:12 UTC (permalink / raw)
  To: Alvaro Garcia, yocto

> From: yocto-bounces@yoctoproject.org <yocto-bounces@yoctoproject.org> on behalf of Alvaro Garcia > <maxpowel@gmail.com>
> Sent: 07 April 2017 11:59
> To: yocto@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Customize live grub entries
  2017-04-07 11:12 ` Chris Trobridge
@ 2017-04-07 12:04   ` Alvaro Garcia
  0 siblings, 0 replies; 3+ messages in thread
From: Alvaro Garcia @ 2017-04-07 12:04 UTC (permalink / raw)
  To: Chris Trobridge; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]

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@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@hotmail.com>:

> > From: yocto-bounces@yoctoproject.org <yocto-bounces@yoctoproject.org>
> on behalf of Alvaro Garcia > <maxpowel@gmail.com>
> > Sent: 07 April 2017 11:59
> > To: yocto@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
>

[-- Attachment #2: Type: text/html, Size: 3413 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-08 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 10:59 Customize live grub entries Alvaro Garcia
2017-04-07 11:12 ` Chris Trobridge
2017-04-07 12:04   ` Alvaro Garcia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.