diff mbox

bootloader GRUB doc

Message ID ca969106-c6a0-4fa1-9e6d-ffb26044a3de@googlegroups.com
State Changes Requested
Delegated to: Stefano Babic
Headers show

Commit Message

Roman Kalashnikov Aug. 16, 2017, 10:25 a.m. UTC

Comments

Stefano Babic Aug. 17, 2017, 10:42 a.m. UTC | #1
Hi Roman,

I am afraid this is not enough. Pazch should be well formatted and must
have a commit message that describe what is done.

Each patch must have a Signed-off-by that takes track of the
contributor. Take a look how to submit patches for a FOSS project (for
example, in the kernel).

On 16/08/2017 12:25, Roman Kalashnikov wrote:
> diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
> index 4a798ee..b4e8d75 100644
> --- a/doc/source/sw-description.rst
> +++ b/doc/source/sw-description.rst
> @@ -548,6 +548,26 @@ that must be changed:
>  SWUpdate will internally generate a script that will be passed to the
>  bootloader handler for adjusting the environment.
>  
> +For example to use GRUB environment - after update some of partition
> +and boot from it:
> +
> +::
> +
> +       bootenv: (
> +               {
> +                       name = "default";
> +                       value = "1";
> +               },
> +               {
> +                       name = "fallback";
> +                       value = "0";
> +               },
> +       )
> +
> +Note the `value` must contain correct partition's number in
> +GRUB menuentry. Also `bootenv` can contains variable like `fallback`
> +for failsafe boot if the new default menu entry fails to boot.
> +

This is not enough - a newbie with Grub does not have any additional
information. What we expect in the documentation is something like:

- which CONFIG_ must be set
- how to setup the system (Grub configuration, an example of grub.cfg to
be put into the example directory, whatever can be helpful)
- and of course an example for sw-description. Your example does not
explain the A / B approach you used it and it is too generic.

Best regards,
Stefano Babic
R lab Dec. 29, 2017, 5:58 a.m. UTC | #2
On Wednesday, August 16, 2017 at 3:55:39 PM UTC+5:30, Roman Kalashnikov wrote:
> diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
> index 4a798ee..b4e8d75 100644
> --- a/doc/source/sw-description.rst
> +++ b/doc/source/sw-description.rst
> @@ -548,6 +548,26 @@ that must be changed:
>  SWUpdate will internally generate a script that will be passed to the
>  bootloader handler for adjusting the environment.
>  
> +For example to use GRUB environment - after update some of partition
> +and boot from it:
> +
> +::
> +
> +       bootenv: (
> +               {
> +                       name = "default";
> +                       value = "1";
> +               },
> +               {
> +                       name = "fallback";
> +                       value = "0";
> +               },
> +       )
> +
> +Note the `value` must contain correct partition's number in
> +GRUB menuentry. Also `bootenv` can contains variable like `fallback`
> +for failsafe boot if the new default menu entry fails to boot.
> +
>  For backward compatibility with previously built .swu images, "uboot "group name
>  is still relevant (as an alias).
>  

Hi Roman,

I am working with swupdate and GRUB-efi. I am having issue to use grub environment block to switch partition. I am using the logic you suggested. But I am not sure the GRUB is looking for grubenv in my case. How we can set grub where to look for grubenv block.

Also If you used yocto for this build. Any suggestion to get grubenv by default in image would be helpful.

Thanks,
R
Roman Kalashnikov Dec. 29, 2017, 6:31 a.m. UTC | #3
Hi!

I was working with efi-system too. Unfortunately grub2 ignores grubenv and
i can’t use it for realize update-rotation between partitions. As solution
I use EFI invironment directly (f.e. it can be used with tool efibootmgr).
Result:
1) build and install swupdate stand-alone without yocto (I build system by
another way)
2) build swu-update file
3) run preload Python-script, which run swupdate with special params

3.1) after swupdate finished the script run efibootmgr and set bootnext efi
param
4) reboot

It is really works.

So I should drop this patch or keep it for history.

On Fri, 29 Dec 2017 at 08:58, <rlabdeveloper@gmail.com> wrote:

> On Wednesday, August 16, 2017 at 3:55:39 PM UTC+5:30, Roman Kalashnikov
> wrote:
> > diff --git a/doc/source/sw-description.rst
> b/doc/source/sw-description.rst
> > index 4a798ee..b4e8d75 100644
> > --- a/doc/source/sw-description.rst
> > +++ b/doc/source/sw-description.rst
> > @@ -548,6 +548,26 @@ that must be changed:
> >  SWUpdate will internally generate a script that will be passed to the
> >  bootloader handler for adjusting the environment.
> >
> > +For example to use GRUB environment - after update some of partition
> > +and boot from it:
> > +
> > +::
> > +
> > +       bootenv: (
> > +               {
> > +                       name = "default";
> > +                       value = "1";
> > +               },
> > +               {
> > +                       name = "fallback";
> > +                       value = "0";
> > +               },
> > +       )
> > +
> > +Note the `value` must contain correct partition's number in
> > +GRUB menuentry. Also `bootenv` can contains variable like `fallback`
> > +for failsafe boot if the new default menu entry fails to boot.
> > +
> >  For backward compatibility with previously built .swu images, "uboot
> "group name
> >  is still relevant (as an alias).
> >
>
> Hi Roman,
>
> I am working with swupdate and GRUB-efi. I am having issue to use grub
> environment block to switch partition. I am using the logic you suggested.
> But I am not sure the GRUB is looking for grubenv in my case. How we can
> set grub where to look for grubenv block.
>
> Also If you used yocto for this build. Any suggestion to get grubenv by
> default in image would be helpful.
>
> Thanks,
> R
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "swupdate" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> swupdate+unsubscribe@googlegroups.com.
> To post to this group, send email to swupdate@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Stefano Babic Dec. 29, 2017, 8:35 a.m. UTC | #4
Hi Roman, R,

On 29/12/2017 07:31, Roman Kalashnikov wrote:
> Hi!
> 
> I was working with efi-system too. Unfortunately grub2 ignores grubenv

Really ? Never heard about such a bug in GRUB2. And grubenv is installed
in most current linux distro.

Are you sure that you have "load_env" in your grub.cfg ?

Best regards,
Stefano Babic


> and i can’t use it for realize update-rotation between partitions. As
> solution I use EFI invironment directly (f.e. it can be used with tool
> efibootmgr). Result:
> 1) build and install swupdate stand-alone without yocto (I build system
> by another way)
> 2) build swu-update file
> 3) run preload Python-script, which run swupdate with special params
> 
> 3.1) after swupdate finished the script run efibootmgr and set bootnext
> efi param
> 4) reboot
> 
> It is really works.
> 
> So I should drop this patch or keep it for history.
> 
> On Fri, 29 Dec 2017 at 08:58, <rlabdeveloper@gmail.com
> <mailto:rlabdeveloper@gmail.com>> wrote:
> 
>     On Wednesday, August 16, 2017 at 3:55:39 PM UTC+5:30, Roman
>     Kalashnikov wrote:
>     > diff --git a/doc/source/sw-description.rst
>     b/doc/source/sw-description.rst
>     > index 4a798ee..b4e8d75 100644
>     > --- a/doc/source/sw-description.rst
>     > +++ b/doc/source/sw-description.rst
>     > @@ -548,6 +548,26 @@ that must be changed:
>     >  SWUpdate will internally generate a script that will be passed to the
>     >  bootloader handler for adjusting the environment.
>     >  
>     > +For example to use GRUB environment - after update some of partition
>     > +and boot from it:
>     > +
>     > +::
>     > +
>     > +       bootenv: (
>     > +               {
>     > +                       name = "default";
>     > +                       value = "1";
>     > +               },
>     > +               {
>     > +                       name = "fallback";
>     > +                       value = "0";
>     > +               },
>     > +       )
>     > +
>     > +Note the `value` must contain correct partition's number in
>     > +GRUB menuentry. Also `bootenv` can contains variable like `fallback`
>     > +for failsafe boot if the new default menu entry fails to boot.
>     > +
>     >  For backward compatibility with previously built .swu images,
>     "uboot "group name
>     >  is still relevant (as an alias).
>     >  
> 
>     Hi Roman,
> 
>     I am working with swupdate and GRUB-efi. I am having issue to use
>     grub environment block to switch partition. I am using the logic you
>     suggested. But I am not sure the GRUB is looking for grubenv in my
>     case. How we can set grub where to look for grubenv block.
> 
>     Also If you used yocto for this build. Any suggestion to get grubenv
>     by default in image would be helpful.
> 
>     Thanks,
>     R
> 
>     --
>     You received this message because you are subscribed to a topic in
>     the Google Groups "swupdate" group.
>     To unsubscribe from this topic, visit
>     https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe.
>     To unsubscribe from this group and all its topics, send an email to
>     swupdate+unsubscribe@googlegroups.com
>     <mailto:swupdate%2Bunsubscribe@googlegroups.com>.
>     To post to this group, send email to swupdate@googlegroups.com
>     <mailto:swupdate@googlegroups.com>.
>     For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To post to this group, send email to swupdate@googlegroups.com
> <mailto:swupdate@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Roman Kalashnikov Dec. 29, 2017, 9:27 a.m. UTC | #5
Yes, i have "load_env" in my grub.cfg.
It was tested in Ubuntu 16.04.3 and grub just ignore most of params (f.e. 
next boot entry, timeouts, e.t.c.).
In any case, grub2 looks like workaround for EFI system. Boards with EFI 
can use EFI environment directly, without grub-layer.

P.S. Many guides recommend use / etc / default / grub instead of writing 
custom configs.


пятница, 29 декабря 2017 г., 11:35:42 UTC+3 пользователь Stefano Babic 
написал:
>
> Hi Roman, R, 
>
> On 29/12/2017 07:31, Roman Kalashnikov wrote: 
> > Hi! 
> > 
> > I was working with efi-system too. Unfortunately grub2 ignores grubenv 
>
> Really ? Never heard about such a bug in GRUB2. And grubenv is installed 
> in most current linux distro. 
>
> Are you sure that you have "load_env" in your grub.cfg ? 
>
> Best regards, 
> Stefano Babic 
>
>
> > and i can’t use it for realize update-rotation between partitions. As 
> > solution I use EFI invironment directly (f.e. it can be used with tool 
> > efibootmgr). Result: 
> > 1) build and install swupdate stand-alone without yocto (I build system 
> > by another way) 
> > 2) build swu-update file 
> > 3) run preload Python-script, which run swupdate with special params 
> > 
> > 3.1) after swupdate finished the script run efibootmgr and set bootnext 
> > efi param 
> > 4) reboot 
> > 
> > It is really works. 
> > 
> > So I should drop this patch or keep it for history. 
> > 
> > On Fri, 29 Dec 2017 at 08:58, <rlabde...@gmail.com <javascript:> 
> > <mailto:rlabde...@gmail.com <javascript:>>> wrote: 
> > 
> >     On Wednesday, August 16, 2017 at 3:55:39 PM UTC+5:30, Roman 
> >     Kalashnikov wrote: 
> >     > diff --git a/doc/source/sw-description.rst 
> >     b/doc/source/sw-description.rst 
> >     > index 4a798ee..b4e8d75 100644 
> >     > --- a/doc/source/sw-description.rst 
> >     > +++ b/doc/source/sw-description.rst 
> >     > @@ -548,6 +548,26 @@ that must be changed: 
> >     >  SWUpdate will internally generate a script that will be passed to 
> the 
> >     >  bootloader handler for adjusting the environment. 
> >     >   
> >     > +For example to use GRUB environment - after update some of 
> partition 
> >     > +and boot from it: 
> >     > + 
> >     > +:: 
> >     > + 
> >     > +       bootenv: ( 
> >     > +               { 
> >     > +                       name = "default"; 
> >     > +                       value = "1"; 
> >     > +               }, 
> >     > +               { 
> >     > +                       name = "fallback"; 
> >     > +                       value = "0"; 
> >     > +               }, 
> >     > +       ) 
> >     > + 
> >     > +Note the `value` must contain correct partition's number in 
> >     > +GRUB menuentry. Also `bootenv` can contains variable like 
> `fallback` 
> >     > +for failsafe boot if the new default menu entry fails to boot. 
> >     > + 
> >     >  For backward compatibility with previously built .swu images, 
> >     "uboot "group name 
> >     >  is still relevant (as an alias). 
> >     >   
> > 
> >     Hi Roman, 
> > 
> >     I am working with swupdate and GRUB-efi. I am having issue to use 
> >     grub environment block to switch partition. I am using the logic you 
> >     suggested. But I am not sure the GRUB is looking for grubenv in my 
> >     case. How we can set grub where to look for grubenv block. 
> > 
> >     Also If you used yocto for this build. Any suggestion to get grubenv 
> >     by default in image would be helpful. 
> > 
> >     Thanks, 
> >     R 
> > 
> >     -- 
> >     You received this message because you are subscribed to a topic in 
> >     the Google Groups "swupdate" group. 
> >     To unsubscribe from this topic, visit 
> >     https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe. 
> >     To unsubscribe from this group and all its topics, send an email to 
> >     swupdate+u...@googlegroups.com <javascript:> 
> >     <mailto:swupdate%2Bunsubscribe@googlegroups.com <javascript:>>. 
> >     To post to this group, send email to swup...@googlegroups.com 
> <javascript:> 
> >     <mailto:swup...@googlegroups.com <javascript:>>. 
> >     For more options, visit https://groups.google.com/d/optout. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "swupdate" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to swupdate+u...@googlegroups.com <javascript:> 
> > <mailto:swupdate+u...@googlegroups.com <javascript:>>. 
> > To post to this group, send email to swup...@googlegroups.com 
> <javascript:> 
> > <mailto:swup...@googlegroups.com <javascript:>>. 
> > For more options, visit https://groups.google.com/d/optout. 
>
Stefano Babic Dec. 29, 2017, 9:39 a.m. UTC | #6
On 29/12/2017 10:27, Roman Kalashnikov wrote:
> Yes, i have "load_env" in my grub.cfg.
> It was tested in Ubuntu 16.04.3 and grub just ignore most of params
> (f.e. next boot entry, timeouts, e.t.c.).

This is the custom setup for GRUB in Ubuntu. Ubuntu uses /etc/grub.d/
and it has its own grub.cfg. Variables are interpreted according to this
implementation. You have to rewrite grub.cfg to evaluate the variables
from grubenv.

Anyway, updating Ubuntu is quite far away from SWUpdate's goal. If you
have an embedded board based on X86, and you have GRUB on it, you have
to provide your grub.cfg for working - see in Yocto.

In Ubuntu, variables are overwritten by Ubuntu's handling, that is by
regenerating grub.cfg based on /etc/grub.d/*.

> In any case, grub2 looks like workaround for EFI system. Boards with EFI
> can use EFI environment directly, without grub-layer.

Do not forget that this was thought for Desktop / PCs, and not for
embedded system, and updating the environment is not power-off safe as
far as I know.

> 
> P.S. Many guides recommend use / etc / default / grub instead of writing
> custom configs.

Of course - update of a Linux Distro is different as on an embedded
systems and Ubuntu has its own set of rules to drive the bootloader.

Best regards,
Stefano Babic

> 
> 
> пятница, 29 декабря 2017 г., 11:35:42 UTC+3 пользователь Stefano Babic
> написал:
> 
>     Hi Roman, R,
> 
>     On 29/12/2017 07:31, Roman Kalashnikov wrote:
>     > Hi!
>     >
>     > I was working with efi-system too. Unfortunately grub2 ignores
>     grubenv
> 
>     Really ? Never heard about such a bug in GRUB2. And grubenv is
>     installed
>     in most current linux distro.
> 
>     Are you sure that you have "load_env" in your grub.cfg ?
> 
>     Best regards,
>     Stefano Babic
> 
> 
>     > and i can’t use it for realize update-rotation between partitions. As
>     > solution I use EFI invironment directly (f.e. it can be used with
>     tool
>     > efibootmgr). Result:
>     > 1) build and install swupdate stand-alone without yocto (I build
>     system
>     > by another way)
>     > 2) build swu-update file
>     > 3) run preload Python-script, which run swupdate with special params
>     >
>     > 3.1) after swupdate finished the script run efibootmgr and set
>     bootnext
>     > efi param
>     > 4) reboot
>     >
>     > It is really works.
>     >
>     > So I should drop this patch or keep it for history.
>     >
>     > On Fri, 29 Dec 2017 at 08:58, <rlabde...@gmail.com <javascript:>
>     > <mailto:rlabde...@gmail.com <javascript:>>> wrote:
>     >
>     >     On Wednesday, August 16, 2017 at 3:55:39 PM UTC+5:30, Roman
>     >     Kalashnikov wrote:
>     >     > diff --git a/doc/source/sw-description.rst
>     >     b/doc/source/sw-description.rst
>     >     > index 4a798ee..b4e8d75 100644
>     >     > --- a/doc/source/sw-description.rst
>     >     > +++ b/doc/source/sw-description.rst
>     >     > @@ -548,6 +548,26 @@ that must be changed:
>     >     >  SWUpdate will internally generate a script that will be
>     passed to the
>     >     >  bootloader handler for adjusting the environment.
>     >     >  
>     >     > +For example to use GRUB environment - after update some of
>     partition
>     >     > +and boot from it:
>     >     > +
>     >     > +::
>     >     > +
>     >     > +       bootenv: (
>     >     > +               {
>     >     > +                       name = "default";
>     >     > +                       value = "1";
>     >     > +               },
>     >     > +               {
>     >     > +                       name = "fallback";
>     >     > +                       value = "0";
>     >     > +               },
>     >     > +       )
>     >     > +
>     >     > +Note the `value` must contain correct partition's number in
>     >     > +GRUB menuentry. Also `bootenv` can contains variable like
>     `fallback`
>     >     > +for failsafe boot if the new default menu entry fails to boot.
>     >     > +
>     >     >  For backward compatibility with previously built .swu images,
>     >     "uboot "group name
>     >     >  is still relevant (as an alias).
>     >     >  
>     >
>     >     Hi Roman,
>     >
>     >     I am working with swupdate and GRUB-efi. I am having issue to use
>     >     grub environment block to switch partition. I am using the
>     logic you
>     >     suggested. But I am not sure the GRUB is looking for grubenv
>     in my
>     >     case. How we can set grub where to look for grubenv block.
>     >
>     >     Also If you used yocto for this build. Any suggestion to get
>     grubenv
>     >     by default in image would be helpful.
>     >
>     >     Thanks,
>     >     R
>     >
>     >     --
>     >     You received this message because you are subscribed to a
>     topic in
>     >     the Google Groups "swupdate" group.
>     >     To unsubscribe from this topic, visit
>     >    
>     https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe
>     <https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe>.
>     >     To unsubscribe from this group and all its topics, send an
>     email to
>     >     swupdate+u...@googlegroups.com <javascript:>
>     >     <mailto:swupdate%2Bunsubscribe@googlegroups.com <javascript:>>.
>     >     To post to this group, send email to swup...@googlegroups.com
>     <javascript:>
>     >     <mailto:swup...@googlegroups.com <javascript:>>.
>     >     For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "swupdate" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to swupdate+u...@googlegroups.com <javascript:>
>     > <mailto:swupdate+u...@googlegroups.com <javascript:>>.
>     > To post to this group, send email to swup...@googlegroups.com
>     <javascript:>
>     > <mailto:swup...@googlegroups.com <javascript:>>.
>     > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To post to this group, send email to swupdate@googlegroups.com
> <mailto:swupdate@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Otavio Salvador Dec. 29, 2017, 10:17 a.m. UTC | #7
On Fri, Dec 29, 2017 at 7:27 AM, Roman Kalashnikov <lunix0x@gmail.com> wrote:
> Yes, i have "load_env" in my grub.cfg.
> It was tested in Ubuntu 16.04.3 and grub just ignore most of params (f.e.
> next boot entry, timeouts, e.t.c.).
> In any case, grub2 looks like workaround for EFI system. Boards with EFI can
> use EFI environment directly, without grub-layer.

We did change the OE-Core grub2 to enable the grub-env. It is likely
due Ubuntu build grub-efi with it disabled.
R lab Dec. 29, 2017, 11:06 a.m. UTC | #8
Hi,
Guys with little effort and observing grub recipes in meta-layer. I get
grub2 working fine without any hack with the yocto build.
I am planning to add examples in swupdate repo and meta-swupdate. To save
others hours in debugging same things I did.

Here is the brief description of what steps I did.

1. In yocto grub2.0 build. it is preparing image without the
loadenv module. That is the reason that why I was failing to switch rootfs.
I added new append file to update grub build to be compatible with swupdate.

# Update grub to generate image with environment block support
# and create default grub env file with default boot option.

GRUB_BUILDIN = "boot linux ext2 fat serial part_msdos part_gpt normal
efi_gop iso9660 search loadenv"

GRUB_DEFAULT_BOOT_ENTRY ?= "boot"

do_deploy_append() {
# Create grub env block with default value.
grub-editenv grubenv create
grub-editenv grubenv set default=${GRUB_DEFAULT_BOOT_ENTRY}
install -m 644 ${B}/grubenv ${DEPLOYDIR}
}

2. We also need to update grub-efi.bbclass to copy grubenv in EFI folder
along bootxXX.efi file.
3. When we prepare bootXX.efi, add "load_env" command along with other
default commands in config.

search.file ($cmdpath)/EFI/BOOT/grub.cfg root
set prefix=($root)/EFI/BOOT
load_env

4. Update wks or image prepare script to update grub.cfg properly. (I am
working on this part). Once I don't with this talk I will add all
well-formated steps in a readme.

@
Stefano Babic
 @Otavio
Need a piece of advice, Can we add these append file to meta-swupdate layer
so others can easily start working with GRUB bootloader in the yocto
build? Or keep them as information in doc?

Thanks,
Rahul K



On Fri, Dec 29, 2017 at 3:47 PM Otavio Salvador <
otavio.salvador@ossystems.com.br> wrote:

> On Fri, Dec 29, 2017 at 7:27 AM, Roman Kalashnikov <lunix0x@gmail.com>
> wrote:
> > Yes, i have "load_env" in my grub.cfg.
> > It was tested in Ubuntu 16.04.3 and grub just ignore most of params (f.e.
> > next boot entry, timeouts, e.t.c.).
> > In any case, grub2 looks like workaround for EFI system. Boards with EFI
> can
> > use EFI environment directly, without grub-layer.
>
> We did change the OE-Core grub2 to enable the grub-env. It is likely
> due Ubuntu build grub-efi with it disabled.
>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854 <+55%2053%209981-7854>            Mobile: +1
> (347) 903-9750 <(347)%20903-9750>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "swupdate" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> swupdate+unsubscribe@googlegroups.com.
> To post to this group, send email to swupdate@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Otavio Salvador Dec. 29, 2017, 11:48 a.m. UTC | #9
On Fri, Dec 29, 2017 at 9:06 AM, R lab <rlabdeveloper@gmail.com> wrote:
...
> Need a piece of advice, Can we add these append file to meta-swupdate layer
> so others can easily start working with GRUB bootloader in the yocto build?
> Or keep them as information in doc?

In fact, it is not need. In updatehub we did that on the target
script. We added a check for the empty environment and then set it[1]

1. https://github.com/updatehub/meta-updatehub/blob/master/recipes-bsp/grub/updatehub-grub-script/grub.cfg

If it is indeed desired to copy the environment, I'd work on OE-Core
to make it generic.
R lab Dec. 29, 2017, 12:32 p.m. UTC | #10
On Friday, December 29, 2017 at 5:18:49 PM UTC+5:30, Otavio Salvador wrote:
> On Fri, Dec 29, 2017 at 9:06 AM, wrote:
> ...
> > Need a piece of advice, Can we add these append file to meta-swupdate layer
> > so others can easily start working with GRUB bootloader in the yocto build?
> > Or keep them as information in doc?
> 
> In fact, it is not need. In updatehub we did that on the target
> script. We added a check for the empty environment and then set it[1]
> 
> 1. https://github.com/updatehub/meta-updatehub/blob/master/recipes-bsp/grub/updatehub-grub-script/grub.cfg
> 
> If it is indeed desired to copy the environment, I'd work on OE-Core
> to make it generic.
> 
> -- 
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

Thanks,

1. loadenv module is enabled on openembedded-oe grub2.02

And ur grub.cfg will do rest of the thing.
Thanks :)
R lab Dec. 29, 2017, 12:43 p.m. UTC | #11
On Friday, December 29, 2017 at 6:02:08 PM UTC+5:30, rlabde...@gmail.com wrote:
> On Friday, December 29, 2017 at 5:18:49 PM UTC+5:30, Otavio Salvador wrote:
> > On Fri, Dec 29, 2017 at 9:06 AM, wrote:
> > ...
> > > Need a piece of advice, Can we add these append file to meta-swupdate layer
> > > so others can easily start working with GRUB bootloader in the yocto build?
> > > Or keep them as information in doc?
> > 
> > In fact, it is not need. In updatehub we did that on the target
> > script. We added a check for the empty environment and then set it[1]
> > 
> > 1. https://github.com/updatehub/meta-updatehub/blob/master/recipes-bsp/grub/updatehub-grub-script/grub.cfg
> > 
> > If it is indeed desired to copy the environment, I'd work on OE-Core
> > to make it generic.
> > 
> > -- 
> > Otavio Salvador                             O.S. Systems
> > http://www.ossystems.com.br        http://code.ossystems.com.br
> > Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
> 
> Thanks,
> 
> 1. loadenv module is enabled on openembedded-oe grub2.02
> 
> And ur grub.cfg will do rest of the thing.
> Thanks :)

You are right. The logic you used is good. and straightforward for application without updating generic build. :thumbsup:
Roman Kalashnikov Dec. 29, 2017, 3:16 p.m. UTC | #12
Why use an extra level when embeddedable Intel SoC works with EFI? For
example Apollo Lake can be used in embedded solutions and it uses EFI.
On Fri, 29 Dec 2017 at 15:43, <rlabdeveloper@gmail.com> wrote:

> On Friday, December 29, 2017 at 6:02:08 PM UTC+5:30, rlabde...@gmail.com
> wrote:
> > On Friday, December 29, 2017 at 5:18:49 PM UTC+5:30, Otavio Salvador
> wrote:
> > > On Fri, Dec 29, 2017 at 9:06 AM, wrote:
> > > ...
> > > > Need a piece of advice, Can we add these append file to
> meta-swupdate layer
> > > > so others can easily start working with GRUB bootloader in the yocto
> build?
> > > > Or keep them as information in doc?
> > >
> > > In fact, it is not need. In updatehub we did that on the target
> > > script. We added a check for the empty environment and then set it[1]
> > >
> > > 1.
> https://github.com/updatehub/meta-updatehub/blob/master/recipes-bsp/grub/updatehub-grub-script/grub.cfg
> > >
> > > If it is indeed desired to copy the environment, I'd work on OE-Core
> > > to make it generic.
> > >
> > > --
> > > Otavio Salvador                             O.S. Systems
> > > http://www.ossystems.com.br        http://code.ossystems.com.br
> > > Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
> >
> > Thanks,
> >
> > 1. loadenv module is enabled on openembedded-oe grub2.02
> >
> > And ur grub.cfg will do rest of the thing.
> > Thanks :)
>
> You are right. The logic you used is good. and straightforward for
> application without updating generic build. :thumbsup:
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "swupdate" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> swupdate+unsubscribe@googlegroups.com.
> To post to this group, send email to swupdate@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Stefano Babic Jan. 2, 2018, 3:23 p.m. UTC | #13
On 29/12/2017 16:16, Roman Kalashnikov wrote:
> Why use an extra level when embeddedable Intel SoC works with EFI? For
> example Apollo Lake can be used in embedded solutions and it uses EFI.

One reason is to ensure atomicity. I am afraid that efibootmgr is not
atomic and environment could be corrupted in case of power-loss when the
tool is running.

The bootloader handler in SWUpßdate together with bootloader guarantees
that setting the variables is power-cut safe.

Best regards,
Stefano Babic


> On Fri, 29 Dec 2017 at 15:43, <rlabdeveloper@gmail.com
> <mailto:rlabdeveloper@gmail.com>> wrote:
> 
>     On Friday, December 29, 2017 at 6:02:08 PM UTC+5:30,
>     rlabde...@gmail.com <mailto:rlabde...@gmail.com> wrote:
>     > On Friday, December 29, 2017 at 5:18:49 PM UTC+5:30, Otavio
>     Salvador wrote:
>     > > On Fri, Dec 29, 2017 at 9:06 AM, wrote:
>     > > ...
>     > > > Need a piece of advice, Can we add these append file to
>     meta-swupdate layer
>     > > > so others can easily start working with GRUB bootloader in the
>     yocto build?
>     > > > Or keep them as information in doc?
>     > >
>     > > In fact, it is not need. In updatehub we did that on the target
>     > > script. We added a check for the empty environment and then set
>     it[1]
>     > >
>     > > 1.
>     https://github.com/updatehub/meta-updatehub/blob/master/recipes-bsp/grub/updatehub-grub-script/grub.cfg
>     > >
>     > > If it is indeed desired to copy the environment, I'd work on OE-Core
>     > > to make it generic.
>     > >
>     > > --
>     > > Otavio Salvador                             O.S. Systems
>     > > http://www.ossystems.com.br        http://code.ossystems.com.br
>     > > Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
>     >
>     > Thanks,
>     >
>     > 1. loadenv module is enabled on openembedded-oe grub2.02
>     >
>     > And ur grub.cfg will do rest of the thing.
>     > Thanks :)
> 
>     You are right. The logic you used is good. and straightforward for
>     application without updating generic build. :thumbsup:
> 
>     --
>     You received this message because you are subscribed to a topic in
>     the Google Groups "swupdate" group.
>     To unsubscribe from this topic, visit
>     https://groups.google.com/d/topic/swupdate/TC16K9DW-m0/unsubscribe.
>     To unsubscribe from this group and all its topics, send an email to
>     swupdate+unsubscribe@googlegroups.com
>     <mailto:swupdate%2Bunsubscribe@googlegroups.com>.
>     To post to this group, send email to swupdate@googlegroups.com
>     <mailto:swupdate@googlegroups.com>.
>     For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To post to this group, send email to swupdate@googlegroups.com
> <mailto:swupdate@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
diff mbox

Patch

diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
index 4a798ee..b4e8d75 100644
--- a/doc/source/sw-description.rst
+++ b/doc/source/sw-description.rst
@@ -548,6 +548,26 @@  that must be changed:
 SWUpdate will internally generate a script that will be passed to the
 bootloader handler for adjusting the environment.
 
+For example to use GRUB environment - after update some of partition
+and boot from it:
+
+::
+
+       bootenv: (
+               {
+                       name = "default";
+                       value = "1";
+               },
+               {
+                       name = "fallback";
+                       value = "0";
+               },
+       )
+
+Note the `value` must contain correct partition's number in
+GRUB menuentry. Also `bootenv` can contains variable like `fallback`
+for failsafe boot if the new default menu entry fails to boot.
+
 For backward compatibility with previously built .swu images, "uboot 
"group name
 is still relevant (as an alias).