All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] uboot tools: fw_setenv can break environment/cause bricks
@ 2019-06-15 11:43 Daniel Palmer
  2019-06-16  6:59 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Palmer @ 2019-06-15 11:43 UTC (permalink / raw)
  To: buildroot

Hi all,

I just noticed this and couldn't find any other reports of it.

If you enable BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV you get fw_printenv
and fw_setenv built for the target but they are built with a u-boot
configuration that isn't for the target as it uses it's own copy of
the source and not the one configured in the bootloader section.

That works in most cases but if you have uninitialised or broken
environment fw_setenv will write what it thinks is the default
environment with a bootcmd that tries to boot via bootp with an NFS
root which will probably brick many targets.

I'm think if u-boot is enabled in the bootloader section there should
probably be an option there to install those tools configured for the
target that blocks the uboot tools package.

Cheers,

Daniel

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

* [Buildroot] uboot tools: fw_setenv can break environment/cause bricks
  2019-06-15 11:43 [Buildroot] uboot tools: fw_setenv can break environment/cause bricks Daniel Palmer
@ 2019-06-16  6:59 ` Thomas Petazzoni
  2019-06-16 12:31   ` Pierre-Jean Texier
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2019-06-16  6:59 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 15 Jun 2019 20:43:44 +0900
Daniel Palmer <daniel@0x0f.com> wrote:

> I just noticed this and couldn't find any other reports of it.
> 
> If you enable BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV you get fw_printenv
> and fw_setenv built for the target but they are built with a u-boot
> configuration that isn't for the target as it uses it's own copy of
> the source and not the one configured in the bootloader section.
> 
> That works in most cases but if you have uninitialised or broken
> environment fw_setenv will write what it thinks is the default
> environment with a bootcmd that tries to boot via bootp with an NFS
> root which will probably brick many targets.
> 
> I'm think if u-boot is enabled in the bootloader section there should
> probably be an option there to install those tools configured for the
> target that blocks the uboot tools package.

I'm adding Pierre-Jean in Cc, as he has been posting patches related
exactly to this not long ago, if I remember correctly.

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] uboot tools: fw_setenv can break environment/cause bricks
  2019-06-16  6:59 ` Thomas Petazzoni
@ 2019-06-16 12:31   ` Pierre-Jean Texier
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre-Jean Texier @ 2019-06-16 12:31 UTC (permalink / raw)
  To: buildroot

Hi Thomas, Hi Daniel,

Le 16/06/2019 ? 08:59, Thomas Petazzoni a ?crit?:
> Hello,
> 
> On Sat, 15 Jun 2019 20:43:44 +0900
> Daniel Palmer <daniel@0x0f.com> wrote:
> 
>> I just noticed this and couldn't find any other reports of it.
>>
>> If you enable BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV you get fw_printenv
>> and fw_setenv built for the target but they are built with a u-boot
>> configuration that isn't for the target as it uses it's own copy of
>> the source and not the one configured in the bootloader section.
>>
>> That works in most cases but if you have uninitialised or broken
>> environment fw_setenv will write what it thinks is the default
>> environment with a bootcmd that tries to boot via bootp with an NFS
>> root which will probably brick many targets.
>>
>> I'm think if u-boot is enabled in the bootloader section there should
>> probably be an option there to install those tools configured for the
>> target that blocks the uboot tools package.
> 
> I'm adding Pierre-Jean in Cc, as he has been posting patches related
> exactly to this not long ago, if I remember correctly.

Thanks Thomas.

Indeed, the need to synchronize the U-Boot and u-boot-tools package has 
always been a problem because the fw_printenv/fw_setenv tools from 
U-Boot must be always be built for exactly the same default environment.

That is why there is now a new project to remove this 'hard link' 
(libubootenv). Libubootenv [1][2] is fully hardware independent, and it 
also provides fw_setenv & fw_printenv tools (+ a library). So there is 
no need for synchronization between U-Boot and libubootenv.

The other advantage with 'libubootenv' is, if you have uninitialized or 
broken environment on the persistent storage.
You have the ability to use a default environment (a file to be passed 
as a parameter with fw_* tools in fact).

FYI, there is a patch [3] to generate this default environment with 
Buildroot.
After that, you are able to put this last one in /etc for libubootenv [4].

For sure, you can read more information at the different links.

Best Regards,

[1] - 
https://groups.google.com/forum/#!searchin/swupdate/libubootenv%7Csort:date/swupdate/2wcIyfexOro/iADiuQRtBQAJ
[2] - https://github.com/sbabic/libubootenv
[3] - http://patchwork.ozlabs.org/patch/1105926/
[4] - 
https://github.com/sbabic/libubootenv/commit/edb580a42e46f76543edd0d6fd603881c6294eca

-- 
Pierre-Jean Texier
Embedded Linux Engineer
https://koncepto.io

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

end of thread, other threads:[~2019-06-16 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-15 11:43 [Buildroot] uboot tools: fw_setenv can break environment/cause bricks Daniel Palmer
2019-06-16  6:59 ` Thomas Petazzoni
2019-06-16 12:31   ` Pierre-Jean Texier

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.