diff mbox

Can not understand bootloader (grub) option

Message ID 19ca798c-96d0-478b-a205-8b7d543e3ff9@googlegroups.com
State Not Applicable
Delegated to: Stefano Babic
Headers show

Commit Message

Roman Kalashnikov Aug. 16, 2017, 9:49 a.m. UTC
Hi!

I'm not sure for correct way to upload patches by using *github* pull-request, 
so i just post git-diff here:

```
```
My sw-description posted here https://pastebin.com/9YyTsDDB.

For "*GRUB* supporting" i had to reconfigure it while zero-provision stage 
(before using *swupdate*):
1. grub-install --boot-directory=/boot --bootloader-id=ubuntu 
--target=x86_64-efi --efi-directory=/boot/efi --recheck --debug /dev/sda
2. grub-mkconfig -o /boot/efi/EFI/ubuntu/grub.cfg
3. grub-editenv /boot/efi/EFI/ubuntu/grubenv create
It creates *grub.cfg* by the "right way". It is resason i don't post 
grub.cfg here - it creates automactiacally.

Then i build swupdate with *GRUB* params in *.config*:
CONFIG_GRUBENV_PATH="/boot/efi/EFI/ubuntu/grubenv"
CONFIG_BOOTLOADER_GRUB=y

Now i can use swupdate traditionaly.

Best regards, Roman.

Comments

Jamal Mohammad April 3, 2018, 9:41 a.m. UTC | #1
Hi Roman,

I was able to successfully build (ext4.gz), I want to implement single-copy approach.. How did you add a new partition in this. I mean what files did you modify..


On Wednesday, 16 August 2017 15:19:44 UTC+5:30, Roman Kalashnikov  wrote:
> Hi!
> 
> I'm not sure for correct way to upload patches by using github pull-request, so i just post git-diff here:
> 
> ```
> 
> diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
> index b4e8d75..4a798ee 100644
> --- a/doc/source/sw-description.rst
> +++ b/doc/source/sw-description.rst
> @@ -548,26 +548,6 @@ 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).
> ```
> My sw-description posted here https://pastebin.com/9YyTsDDB.
> 
> 
> For "GRUB supporting" i had to reconfigure it while zero-provision stage (before using swupdate):
> 1. grub-install --boot-directory=/boot --bootloader-id=ubuntu --target=x86_64-efi --efi-directory=/boot/efi --recheck --debug /dev/sda
> 2. grub-mkconfig -o /boot/efi/EFI/ubuntu/grub.cfg
> 3. grub-editenv /boot/efi/EFI/ubuntu/grubenv create
> It creates grub.cfg by the "right way". It is resason i don't post grub.cfg here - it creates automactiacally.
> 
> 
> Then i build swupdate with GRUB params in .config:
> CONFIG_GRUBENV_PATH="/boot/efi/EFI/ubuntu/grubenv"
> 
> CONFIG_BOOTLOADER_GRUB=y
> 
> 
> Now i can use swupdate traditionaly.
> 
> 
> Best regards, Roman.
Roman Kalashnikov April 3, 2018, 7:27 p.m. UTC | #2
For now I do not use grub.
I can help you if you will share at least partition scheme and more information about your environment.

Best regards,
Kalashnikov Roman.

> On 3 Apr 2018, at 12:41, md.jamalmohiuddin@gmail.com wrote:
> 
> Hi Roman,
> 
> I was able to successfully build (ext4.gz), I want to implement single-copy approach.. How did you add a new partition in this. I mean what files did you modify..
> 
> 
>> On Wednesday, 16 August 2017 15:19:44 UTC+5:30, Roman Kalashnikov  wrote:
>> Hi!
>> 
>> I'm not sure for correct way to upload patches by using github pull-request, so i just post git-diff here:
>> 
>> ```
>> 
>> diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
>> index b4e8d75..4a798ee 100644
>> --- a/doc/source/sw-description.rst
>> +++ b/doc/source/sw-description.rst
>> @@ -548,26 +548,6 @@ 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).
>> ```
>> My sw-description posted here https://pastebin.com/9YyTsDDB.
>> 
>> 
>> For "GRUB supporting" i had to reconfigure it while zero-provision stage (before using swupdate):
>> 1. grub-install --boot-directory=/boot --bootloader-id=ubuntu --target=x86_64-efi --efi-directory=/boot/efi --recheck --debug /dev/sda
>> 2. grub-mkconfig -o /boot/efi/EFI/ubuntu/grub.cfg
>> 3. grub-editenv /boot/efi/EFI/ubuntu/grubenv create
>> It creates grub.cfg by the "right way". It is resason i don't post grub.cfg here - it creates automactiacally.
>> 
>> 
>> Then i build swupdate with GRUB params in .config:
>> CONFIG_GRUBENV_PATH="/boot/efi/EFI/ubuntu/grubenv"
>> 
>> CONFIG_BOOTLOADER_GRUB=y
>> 
>> 
>> Now i can use swupdate traditionaly.
>> 
>> 
>> Best regards, Roman.
> 
> -- 
> 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/OhMBA7AcoTk/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.
Jamal Mohammad April 4, 2018, 12:48 a.m. UTC | #3
Thanks for your reply.
We have Apollo lake motherboard (Intel 64 bit)

We are planning to use swupdate for OS updates in our project.

The partition scheme is 20 MB EFI partition, 5% of swap partition and
remaining is used by rootfs . this is done by initinstallefi.sh script

We need to have a single copy rescue system. I am able to generate initrd
image by running bitbake swupdate-image

The place where I am struck is how to modify the script to copy the initrd
into a new partition and where to modify in GRUB for switching between them

Thanks for your time as there is almost no information on this online.
  I can provide you more information if you need

On Wed, Apr 4, 2018, 12:57 AM Roman Kalashnikov <lunix0x@gmail.com> wrote:

> For now I do not use grub.
> I can help you if you will share at least partition scheme and more
> information about your environment.
>
> Best regards,
> Kalashnikov Roman.
>
> > On 3 Apr 2018, at 12:41, md.jamalmohiuddin@gmail.com wrote:
> >
> > Hi Roman,
> >
> > I was able to successfully build (ext4.gz), I want to implement
> single-copy approach.. How did you add a new partition in this. I mean what
> files did you modify..
> >
> >
> >> On Wednesday, 16 August 2017 15:19:44 UTC+5:30, Roman Kalashnikov
> wrote:
> >> Hi!
> >>
> >> I'm not sure for correct way to upload patches by using github
> pull-request, so i just post git-diff here:
> >>
> >> ```
> >>
> >> diff --git a/doc/source/sw-description.rst
> b/doc/source/sw-description.rst
> >> index b4e8d75..4a798ee 100644
> >> --- a/doc/source/sw-description.rst
> >> +++ b/doc/source/sw-description.rst
> >> @@ -548,26 +548,6 @@ 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).
> >> ```
> >> My sw-description posted here https://pastebin.com/9YyTsDDB.
> >>
> >>
> >> For "GRUB supporting" i had to reconfigure it while zero-provision
> stage (before using swupdate):
> >> 1. grub-install --boot-directory=/boot --bootloader-id=ubuntu
> --target=x86_64-efi --efi-directory=/boot/efi --recheck --debug /dev/sda
> >> 2. grub-mkconfig -o /boot/efi/EFI/ubuntu/grub.cfg
> >> 3. grub-editenv /boot/efi/EFI/ubuntu/grubenv create
> >> It creates grub.cfg by the "right way". It is resason i don't post
> grub.cfg here - it creates automactiacally.
> >>
> >>
> >> Then i build swupdate with GRUB params in .config:
> >> CONFIG_GRUBENV_PATH="/boot/efi/EFI/ubuntu/grubenv"
> >>
> >> CONFIG_BOOTLOADER_GRUB=y
> >>
> >>
> >> Now i can use swupdate traditionaly.
> >>
> >>
> >> Best regards, Roman.
> >
> > --
> > 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/OhMBA7AcoTk/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.
>
Roman Kalashnikov April 4, 2018, 7:01 p.m. UTC | #4
Unfortunately I did not used yocto project and did not used copy for updates (I use full partition update). But in common we have similar systems (also Apollo lake).

1. You can copy any files using swupdate, just look at the doc https://sbabic.github.io/swupdate/sw-description.html#files. You should add similar block into your sw-update, but destination should be mounted before updating.
2. Then you can do 2 different things:
2.1 Prepare grub.cfg with boot options for each initrd. In simple way
2.1.1 just keep initrd in different static directories/partitions
2.1.2 update each time another using ‘files’ mechanism
2.1.3 switch default in grub between initrd using grub env param ‘default’, you can see how to here https://sbabic.github.io/swupdate/sw-description.html#bootloader or in this thread
2.2 Similar with 2.1, but update grub.cfg dynamically after each update.

Do you use one kernel or/and rootfs (without it) and update just initrd?
You can keep kernel on EFI partition or in another special partition.

> On 4 Apr 2018, at 03:48, Jamal Mohammad <md.jamalmohiuddin@gmail.com> wrote:
> 
> Thanks for your reply.
> We have Apollo lake motherboard (Intel 64 bit)
> 
> We are planning to use swupdate for OS updates in our project.
> 
> The partition scheme is 20 MB EFI partition, 5% of swap partition and remaining is used by rootfs . this is done by initinstallefi.sh script
> 
> We need to have a single copy rescue system. I am able to generate initrd image by running bitbake swupdate-image
> 
> The place where I am struck is how to modify the script to copy the initrd into a new partition and where to modify in GRUB for switching between them
> 
> Thanks for your time as there is almost no information on this online.
>   I can provide you more information if you need
> 
>> On Wed, Apr 4, 2018, 12:57 AM Roman Kalashnikov <lunix0x@gmail.com> wrote:
>> For now I do not use grub.
>> I can help you if you will share at least partition scheme and more information about your environment.
>> 
>> Best regards,
>> Kalashnikov Roman.
>> 
>> > On 3 Apr 2018, at 12:41, md.jamalmohiuddin@gmail.com wrote:
>> >
>> > Hi Roman,
>> >
>> > I was able to successfully build (ext4.gz), I want to implement single-copy approach.. How did you add a new partition in this. I mean what files did you modify..
>> >
>> >
>> >> On Wednesday, 16 August 2017 15:19:44 UTC+5:30, Roman Kalashnikov  wrote:
>> >> Hi!
>> >>
>> >> I'm not sure for correct way to upload patches by using github pull-request, so i just post git-diff here:
>> >>
>> >> ```
>> >>
>> >> diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
>> >> index b4e8d75..4a798ee 100644
>> >> --- a/doc/source/sw-description.rst
>> >> +++ b/doc/source/sw-description.rst
>> >> @@ -548,26 +548,6 @@ 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).
>> >> ```
>> >> My sw-description posted here https://pastebin.com/9YyTsDDB.
>> >>
>> >>
>> >> For "GRUB supporting" i had to reconfigure it while zero-provision stage (before using swupdate):
>> >> 1. grub-install --boot-directory=/boot --bootloader-id=ubuntu --target=x86_64-efi --efi-directory=/boot/efi --recheck --debug /dev/sda
>> >> 2. grub-mkconfig -o /boot/efi/EFI/ubuntu/grub.cfg
>> >> 3. grub-editenv /boot/efi/EFI/ubuntu/grubenv create
>> >> It creates grub.cfg by the "right way". It is resason i don't post grub.cfg here - it creates automactiacally.
>> >>
>> >>
>> >> Then i build swupdate with GRUB params in .config:
>> >> CONFIG_GRUBENV_PATH="/boot/efi/EFI/ubuntu/grubenv"
>> >>
>> >> CONFIG_BOOTLOADER_GRUB=y
>> >>
>> >>
>> >> Now i can use swupdate traditionaly.
>> >>
>> >>
>> >> Best regards, Roman.
>> >
>> > --
>> > 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/OhMBA7AcoTk/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.
diff mbox

Patch

diff --git a/doc/source/sw-description.rst b/doc/source/sw-description.rst
index b4e8d75..4a798ee 100644
--- a/doc/source/sw-description.rst
+++ b/doc/source/sw-description.rst
@@ -548,26 +548,6 @@  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).