Re: [U-Boot] interaction between CONFIG_CMD_SAVEENV and CONFIG_BOOTCOMMAND

2016-09-15 Thread Nicolas le bayon
Dear Wolfgang,

Regarding your recommendations about U-Boot usage, I completely agree with
that. In fact, In my description, I wouldn't give too many details, but
your answer leads me to add some :-)

As I told you, this "old" u-boot is used only as primary bootloader, and
its main objective is just to "source" a script on an external device. Note
that this script is only a text file that can be modified by the user.

We propose different script examples to the user, the basic one will only
start the kernel (all images will be stored on the external device), but
the most used one will start a secondary bootloader, so a second u-boot
(this one is currently in rebasing phase, on 2016.09 release). And in this
second u-boot, there is no access restrictions, user will be able to custom.

Finally note that this is an intermediate step of our project. In final
release, this "primary u-boot" will be replaced by a "bootrom" (so no more
u-boot), and in that case, we will have only one "secondary" u-boot. Hope
this clarifies :-)

Back to our issue on our "primary" u-boot, we found an alternative. We
generate two binaries, the first one used only to flash the second. In that
case, we are able te disallow use of external env for the second and flash
access (define CONFIG_ENV_IS_NOWHERE and undef CONFIG_XXX_FLASH). It seems
functional after further tests.

So indeed, there is a bug, but on our side, not in u-boot. We need
"saveenv" to flash, our script was using the .elf (via gdb) to flash the
.bin. And this flash operation was using the saveenv. So by using two
differents binaries, we solve our issue, and u-boot is going well :-)

Thanks Wolfgang for tyour reactivity and your recommendations. Please note
that in our final product, we'll use u-boot with total respect of its
philosophy, and we'll be aligned on one of the latest releases :)

Best regards,
Nicolas




2016-09-14 20:38 GMT+02:00 Wolfgang Denk :

> Dear Nicolas,
>
> In message 

Re: [U-Boot] interaction between CONFIG_CMD_SAVEENV and CONFIG_BOOTCOMMAND

2016-09-14 Thread Wolfgang Denk
Dear Nicolas,

In message 

Re: [U-Boot] interaction between CONFIG_CMD_SAVEENV and CONFIG_BOOTCOMMAND

2016-09-14 Thread Nicolas le bayon
Would that really be enough?  Please keep in mind that "env save" (or
"saveenv") is only responsible for storing the current environment
into persistant storage.  It does not modify the environment at all.
To modify the environment, you can use quite a number of commands,
including "env set", "env import" etc.  You would have to disable all
of these to prevent modifications of the environment settings - and
probably cripple U-Boot to a level where it becomes unusable.

>> Our objective is just to avoid the user to modify the content in the
persistent storage. Indeed, we have to retrieve the original content at
each reboot.
If the user makes something wrong in its current environment, this is its
responsability, but after the reset, we have to gat back the original
content we stored once for all. In that case, saveenv would maybe be
enough, don't you think?

Which exact version of U-Boot are you talking about?
>>  a quite old one, v2015.01 :-( And we do not plan to upgrade this
"primary bootloader" u-boot.

Regards,
Nicolas

2016-09-14 17:00 GMT+02:00 Wolfgang Denk :

> Dear Nicolas,
>
> In message  ddgl2b+gnb+...@mail.gmail.com> you wrote:
> >
> > Of course, the user will be able to modify the content of the script, to
> > fit with their needs. But on our side, provider of this primary
> bootloader,
> > we want to be sure that the environment of this u-boot won't be changed
> by
> > the user, so that we want to disable all access to "saveenv" command.
>
> Would that really be enough?  Please keep in mind that "env save" (or
> "saveenv") is only responsible for storing the current environment
> into persistant storage.  It does not modify the environment at all.
> To modify the environment, you can use quite a number of commands,
> including "env set", "env import" etc.  You would have to disable all
> of these to prevent modifications of the environment settings - and
> probably cripple U-Boot to a level where it becomes unusable.
>
> > That's why we configure: #undef CONFIG_CMD_SAVEENV
> >
> > With this modifications, saveenv command is not available in the u-boot
> > commands, that's nice. But bootcmd is empty. It's like there was an
> > interaction between both settings, maybe the saveenv primitive is
> necessary
> > one time to construct the environment content.
>
> This would be a bug.  Whcih exact version of U-Boot are you talking
> about?
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
> "There are three principal ways to lose money: wine, women,  and  en-
> gineers.  While  the first two are more pleasant, the third is by far
> the more certain."  -- Baron Rothschild, ca. 1800
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] interaction between CONFIG_CMD_SAVEENV and CONFIG_BOOTCOMMAND

2016-09-14 Thread Wolfgang Denk
Dear Nicolas,

In message  
you wrote:
> 
> Of course, the user will be able to modify the content of the script, to
> fit with their needs. But on our side, provider of this primary bootloader,
> we want to be sure that the environment of this u-boot won't be changed by
> the user, so that we want to disable all access to "saveenv" command.

Would that really be enough?  Please keep in mind that "env save" (or
"saveenv") is only responsible for storing the current environment
into persistant storage.  It does not modify the environment at all.
To modify the environment, you can use quite a number of commands,
including "env set", "env import" etc.  You would have to disable all
of these to prevent modifications of the environment settings - and
probably cripple U-Boot to a level where it becomes unusable.

> That's why we configure: #undef CONFIG_CMD_SAVEENV
> 
> With this modifications, saveenv command is not available in the u-boot
> commands, that's nice. But bootcmd is empty. It's like there was an
> interaction between both settings, maybe the saveenv primitive is necessary
> one time to construct the environment content.

This would be a bug.  Whcih exact version of U-Boot are you talking
about?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"There are three principal ways to lose money: wine, women,  and  en-
gineers.  While  the first two are more pleasant, the third is by far
the more certain."  -- Baron Rothschild, ca. 1800
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot