All of lore.kernel.org
 help / color / mirror / Atom feed
* [rauc] create a rescue image
@ 2019-03-25 15:01 jairo
  2019-03-25 16:21 ` Patrick Boettcher
  0 siblings, 1 reply; 9+ messages in thread
From: jairo @ 2019-03-25 15:01 UTC (permalink / raw)
  To: yocto

Hi all,

I want to make a system with a rescue partition.

What is the minimum to make a rescue image? Or how can it be done?

I use a board with a imx6 micro from phytec, and in the meta-yogurt
layer there is a recipe called phytec-initramfs-image.bb that creates
an image or partition with cpio.gz format of 11MB containing rootfs,
can it be used That image as a rescue? If so, how do you copy a cpio
partition in an UBI MTD system?

https://layers.openembedded.org/layerindex/recipe/89608/

Thanks in advance




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

* Re: [rauc] create a rescue image
  2019-03-25 15:01 [rauc] create a rescue image jairo
@ 2019-03-25 16:21 ` Patrick Boettcher
  2019-03-26  8:05   ` jairo
  0 siblings, 1 reply; 9+ messages in thread
From: Patrick Boettcher @ 2019-03-25 16:21 UTC (permalink / raw)
  To: jairo; +Cc: yocto

Hi,

On Mon, 25 Mar 2019 16:01:37 +0100
jairo <jairo@futurasmus-knxlab.es> wrote:

> Hi all,
> 
> I want to make a system with a rescue partition.
> 
> What is the minimum to make a rescue image? Or how can it be done?
> 
> I use a board with a imx6 micro from phytec, and in the meta-yogurt
> layer there is a recipe called phytec-initramfs-image.bb that creates
> an image or partition with cpio.gz format of 11MB containing rootfs,
> can it be used That image as a rescue? If so, how do you copy a cpio
> partition in an UBI MTD system?

To create an initramfs rescue image (assuming that's what you would
want to do?) You need to tell yocto that there is a initramfs to be
built:

To your local.conf you can add

  # for initramfs-usage
  INITRAMFS_IMAGE = "rescue-image-initramfs"
  INITRAMFS_IMAGE_BUNDLE = "1"

and you'll to craete a corresponding .bb-file. There are example over
the internet if you search for it. I needed the following packages:

  PACKAGE_INSTALL = "packagegroup-core-boot \
                     ppp          \
                     bash         \
                     sshd         \
                     rauc         \
                     mtd-utils    \
  "

This gave me a initramfs of 25-30 MB and barebox wasnot able to
jump to the kernel so I had to patch.

After that you just need to add a partition for the initramfs and its
device-tree-blob (dtb) to the UBIFS and flash it and boot it.

You should, if you haven't already, come up with a complete strategy of
how to do your updates and upgrades using RAUC or another update-system.

best regards,
--
Patrick.





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

* Re: [rauc] create a rescue image
  2019-03-25 16:21 ` Patrick Boettcher
@ 2019-03-26  8:05   ` jairo
  2019-03-26  8:14     ` Patrick Boettcher
  0 siblings, 1 reply; 9+ messages in thread
From: jairo @ 2019-03-26  8:05 UTC (permalink / raw)
  To: Patrick Boettcher; +Cc: yocto

Thanks Patrick:


The idea is that when an update is going to be done, the system will
restart in the rescue partition so that it updates the main partition
and when it is updated it will restart the main partition again.


I think the problem (among others) was having it because I was not
applying any patch to the device-tree. It's a somewhat complicated
issue, anyway, thank you very much for the help, I think it's a good
clue to keep going.

A greeting!


El lun, 25-03-2019 a las 17:21 +0100, Patrick Boettcher escribió:
> Hi,
> 
> On Mon, 25 Mar 2019 16:01:37 +0100
> jairo <jairo@futurasmus-knxlab.es> wrote:
> 
> > Hi all,
> > 
> > I want to make a system with a rescue partition.
> > 
> > What is the minimum to make a rescue image? Or how can it be done?
> > 
> > I use a board with a imx6 micro from phytec, and in the meta-yogurt
> > layer there is a recipe called phytec-initramfs-image.bb that
> > creates
> > an image or partition with cpio.gz format of 11MB containing
> > rootfs,
> > can it be used That image as a rescue? If so, how do you copy a
> > cpio
> > partition in an UBI MTD system?
> 
> To create an initramfs rescue image (assuming that's what you would
> want to do?) You need to tell yocto that there is a initramfs to be
> built:
> 
> To your local.conf you can add
> 
>   # for initramfs-usage
>   INITRAMFS_IMAGE = "rescue-image-initramfs"
>   INITRAMFS_IMAGE_BUNDLE = "1"
> 
> and you'll to craete a corresponding .bb-file. There are example over
> the internet if you search for it. I needed the following packages:
> 
>   PACKAGE_INSTALL = "packagegroup-core-boot \
>                      ppp          \
>                      bash         \
>                      sshd         \
>                      rauc         \
>                      mtd-utils    \
>   "
> 
> This gave me a initramfs of 25-30 MB and barebox wasnot able to
> jump to the kernel so I had to patch.
> 
> After that you just need to add a partition for the initramfs and its
> device-tree-blob (dtb) to the UBIFS and flash it and boot it.
> 
> You should, if you haven't already, come up with a complete strategy
> of
> how to do your updates and upgrades using RAUC or another update-
> system.
> 
> best regards,
> --
> Patrick.
> 
> 
> 




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

* Re: [rauc] create a rescue image
  2019-03-26  8:05   ` jairo
@ 2019-03-26  8:14     ` Patrick Boettcher
  2019-03-26 10:02       ` jairo
  0 siblings, 1 reply; 9+ messages in thread
From: Patrick Boettcher @ 2019-03-26  8:14 UTC (permalink / raw)
  To: jairo; +Cc: yocto

On Tue, 26 Mar 2019 09:05:47 +0100
jairo <jairo@futurasmus-knxlab.es> wrote:

> Thanks Patrick:
> 
> 
> The idea is that when an update is going to be done, the system will
> restart in the rescue partition so that it updates the main partition
> and when it is updated it will restart the main partition again.

This is a good idea when you want to keep a maximum of rootfs-space for
one system and can be done with RAUC, bootchooser and barebox.

However, there is a risk of when a system update (from the
rescue-partition) installs a non-working image. Then you will stuck on
your rescue system without a possibility to get back a working system.

This is why "usually" there is system0 and a system1 which are
switching over after an update and the system marks itself OK if it is
- otherwise it is switching back to the previous system.

> I think the problem (among others) was having it because I was not
> applying any patch to the device-tree. It's a somewhat complicated
> issue, anyway, thank you very much for the help, I think it's a good
> clue to keep going.

Also check the latest phytec recipes in their distro, they integrated
RAUC and barebox-state (in eeprom) and bootchooser. Though this is not
yet releases for IMX6 - afaik.

--
Patrick.


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

* Re: [rauc] create a rescue image
  2019-03-26  8:14     ` Patrick Boettcher
@ 2019-03-26 10:02       ` jairo
  2019-03-26 10:40         ` Mike Looijmans
  0 siblings, 1 reply; 9+ messages in thread
From: jairo @ 2019-03-26 10:02 UTC (permalink / raw)
  To: Patrick Boettcher; +Cc: yocto

El mar, 26-03-2019 a las 09:14 +0100, Patrick Boettcher escribió:
> On Tue, 26 Mar 2019 09:05:47 +0100
> jairo <jairo@futurasmus-knxlab.es> wrote:
> 
> > Thanks Patrick:
> > 
> > 
> > The idea is that when an update is going to be done, the system
> > will
> > restart in the rescue partition so that it updates the main
> > partition
> > and when it is updated it will restart the main partition again.
> 
> This is a good idea when you want to keep a maximum of rootfs-space
> for
> one system and can be done with RAUC, bootchooser and barebox.
> 
> However, there is a risk of when a system update (from the
> rescue-partition) installs a non-working image. Then you will stuck
> on
> your rescue system without a possibility to get back a working
> system.
> 
> This is why "usually" there is system0 and a system1 which are
> switching over after an update and the system marks itself OK if it
> is
> - otherwise it is switching back to the previous system.

Yes, I know, it is somewhat risky, but I have only 512MB of nand
memory, and we are getting a lot of software. I think we have to
evaluate the move to a hardware with more memory, at the moment is what
we have. I think it is practically impossible to put 2 systems in so
little memory.

> 
> Also check the latest phytec recipes in their distro, they integrated
> RAUC and barebox-state (in eeprom) and bootchooser. Though this is
> not
> yet releases for IMX6 - afaik.

Sure, they are going to release a new version this Friday. I'll have to
take a good look. :D

--
Jairo





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

* Re: [rauc] create a rescue image
  2019-03-26 10:02       ` jairo
@ 2019-03-26 10:40         ` Mike Looijmans
  2019-03-26 11:31           ` jairo
  0 siblings, 1 reply; 9+ messages in thread
From: Mike Looijmans @ 2019-03-26 10:40 UTC (permalink / raw)
  To: jairo, Patrick Boettcher; +Cc: yocto

On 26-03-19 11:02, jairo wrote:
> El mar, 26-03-2019 a las 09:14 +0100, Patrick Boettcher escribió:
>> On Tue, 26 Mar 2019 09:05:47 +0100
>> jairo <jairo@futurasmus-knxlab.es> wrote:
...
> Yes, I know, it is somewhat risky, but I have only 512MB of nand
> memory, and we are getting a lot of software. I think we have to
> evaluate the move to a hardware with more memory, at the moment is what
> we have. I think it is practically impossible to put 2 systems in so
> little memory.

With NAND you'll probably have a filesystem (jffs2 or UBI) in place. With 
that, you could just use a package manager like opkg to update sofware. If the 
box has a network connection, just running "opkg update && opkg upgrade" will 
install the current releases with the minimum effort. We've been using this on 
a million boxes and it works fine (until someone decides to patch libc and you 
get a 300+ package upgrade).

Linux is also capable of upgrading a running system. Basically, copy some 
executables to a tmp filesystem, remount everything read-only, and change root 
to the tmp part. Then you can rewrite partitions and reboot.

In any case, you should have a u-boot configuration that allows it to be 
debricked. Typically a USB stick or DFU will do nicely if your board has USB. 
Or even serial...

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

* Re: [rauc] create a rescue image
  2019-03-26 10:40         ` Mike Looijmans
@ 2019-03-26 11:31           ` jairo
  2019-03-26 14:17             ` Mike Looijmans
  0 siblings, 1 reply; 9+ messages in thread
From: jairo @ 2019-03-26 11:31 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: yocto


Thank you very much Mike.



> With NAND you'll probably have a filesystem (jffs2 or UBI) in place.
> With that, you could just use a package manager like opkg to update
> sofware. If the box has a network connection, just running "opkg
> update && opkg upgrade" will install the current releases with the
> minimum effort. We've been using this on a million boxes and it works
> fine (until someone decides to patch libc and you get a 300+ package
> upgrade).


Is there a public repository with ipk packages, or do I have to create
my own repository?
Can opkg solve dependencies well? Can it create problems?


> Linux is also capable of upgrading a running system. Basically, copy
> some 
> executables to a tmp filesystem, remount everything read-only, and
> change root 
> to the tmp part. Then you can rewrite partitions and reboot.
> 
> In any case, you should have a u-boot configuration that allows it to
> be 
> debricked. Typically a USB stick or DFU will do nicely if your board
> has USB. 
> Or even serial...

I'm using Barebox, I think there would be no problems out there, the
bad part of using opkg is that the product should be used by clients
without much knowledge of linux. In that part I think it would be
easier for customers to use a update system such as Rauc or any similar
...

A greeting!




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

* Re: [rauc] create a rescue image
  2019-03-26 11:31           ` jairo
@ 2019-03-26 14:17             ` Mike Looijmans
  2019-03-28 10:23               ` jairo
  0 siblings, 1 reply; 9+ messages in thread
From: Mike Looijmans @ 2019-03-26 14:17 UTC (permalink / raw)
  To: jairo; +Cc: yocto

On 26-03-19 12:31, jairo wrote:
> 
> Thank you very much Mike.
> 
> 
> 
>> With NAND you'll probably have a filesystem (jffs2 or UBI) in place.
>> With that, you could just use a package manager like opkg to update
>> sofware. If the box has a network connection, just running "opkg
>> update && opkg upgrade" will install the current releases with the
>> minimum effort. We've been using this on a million boxes and it works
>> fine (until someone decides to patch libc and you get a 300+ package
>> upgrade).
> 
> 
> Is there a public repository with ipk packages, or do I have to create
> my own repository?

OpenEmbedded already created it, it's usually in build/tmp-glibc/deploy/ipk

To turn it into a "feed" just share this directory through http. On my 
development setup, I installed apache and created a symlink to that directory. 
You'll also need to add "distro-feed-configs" to your image (and maybe append 
it a bit to match your system).

> Can opkg solve dependencies well? Can it create problems?

Haven't seen any problems with it, and it installs dependencies along with 
packages.

>> Linux is also capable of upgrading a running system. Basically, copy
>> some
>> executables to a tmp filesystem, remount everything read-only, and
>> change root
>> to the tmp part. Then you can rewrite partitions and reboot.
>>
>> In any case, you should have a u-boot configuration that allows it to
>> be
>> debricked. Typically a USB stick or DFU will do nicely if your board
>> has USB.
>> Or even serial...
> 
> I'm using Barebox, I think there would be no problems out there, the
> bad part of using opkg is that the product should be used by clients
> without much knowledge of linux. In that part I think it would be
> easier for customers to use a update system such as Rauc or any similar

The system that's using ipkg is a TV settop box, and the average user has 
about the intellectual capabilities of a potato.

To actually upgrade, the user selects "settings" and "update software" from 
the main menu using the remote control, and doesn't even have to leave the couch.

(To recover a bricked box, or install from scratch, the procedure is much more 
complicated: Download a zip file, unpack on a USB stick, put it into the 
settop and switch it on. That'd require intellect slightly above your average 
vegetable but is still doable apparently.)

Being user-friendly is about providing a proper wrapper, it's not about 
technology.

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

* Re: [rauc] create a rescue image
  2019-03-26 14:17             ` Mike Looijmans
@ 2019-03-28 10:23               ` jairo
  0 siblings, 0 replies; 9+ messages in thread
From: jairo @ 2019-03-28 10:23 UTC (permalink / raw)
  To: Mike Looijmans, patrick.boettcher; +Cc: yocto

Thanks Mike, Patrick,

I have been much clearer about the options to update the system and the
cost involved.

a greeting

Jairo




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

end of thread, other threads:[~2019-03-28 10:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 15:01 [rauc] create a rescue image jairo
2019-03-25 16:21 ` Patrick Boettcher
2019-03-26  8:05   ` jairo
2019-03-26  8:14     ` Patrick Boettcher
2019-03-26 10:02       ` jairo
2019-03-26 10:40         ` Mike Looijmans
2019-03-26 11:31           ` jairo
2019-03-26 14:17             ` Mike Looijmans
2019-03-28 10:23               ` jairo

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.