[U-Boot] [PATCH 1/4] Add option -r to env import to allow import of text files with CRLF as line endings

Alexander Holler
2014-08-03T16:38:39Z

Am 02.08.2014 23:09, schrieb Alexander Holler:
> Am 01.08.2014 14:08, schrieb Wolfgang Denk:

>> Should we not, for reasons of symmetry, then also extend "env export"
>> by such a "-r" option?
>
> Sorry, but I don't follow the new features of u-boot that closely.
>
> Is it already possible to save an exported environment as (text-)file to
> some storage? Such wasn't possible when I've implemented that -r for
> "env import" and it doesn't make much sense if an exported environment
> never reaches users.

Just to clarify: I see uEnv.txt (which only was possible through your
env import implementation) as a read-only configuration file for u-boot,
mainly used to easily configure the kernel-command-line from userspace.
Something like grub.cfg or any config for other bootloaders. The
(simple) trick with uenvcmd to execute commands is just a handy addition.

And I don't think all the necessary stuff to save a file in all the
possible filesystems should end up in u-boot. Modifying filesystems is
dangerous.

So from a u-boot point of view uEnv.txt is a read-only mechanism and I'm
happy with it as such.

I just did the patch in the subject because it ended up with extremly
hard to diagnose problems when someone created an uEnv.txt with CRLF
using Windows. E.g. foo=bar in such an uEnv.txt was in fact foo=bar<CR>
which was feeded to the kernel command line as foo=bar<CR> too, and the
Linux kernel usually treads carriage returns as a normal character. So
it treats bar<CR> as something different than bar, leading to various
failures. And that underlying problem is almost impossible to see
because everything (what a user pastes, kernel output, ...) looks good.

Regards,

Alexander Holler