]> git.dujemihanovic.xyz Git - u-boot.git/commit
Makefile: fix generation of defaultenv.h from empty initial file
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Thu, 22 Apr 2021 07:44:18 +0000 (09:44 +0200)
committerStefan Roese <sr@denx.de>
Wed, 28 Apr 2021 08:05:13 +0000 (10:05 +0200)
commitc6ecb2f81e7fdb80ef2e5e5153d60552c4ea3fda
treecf3f3b6063a90978e5e964e0622407c38337d890
parent6b4880e63fd5c0f4f114ef7c89fcf55c97bade53
Makefile: fix generation of defaultenv.h from empty initial file

When CONFIG_USE_DEFAULT_ENV_FILE=y and the file
CONFIG_DEFAULT_ENV_FILE is empty (or at least doesn't contain any
non-comment, non-empty lines), we end up feeding nothing into xxd,
which in turn then outputs nothing. Then blindly appending ", 0x00"
means that we end up trying to compile (roughly)

const char defaultenv[] = { , 0x00 }

which is of course broken.

To fix that, change the frobbing of the text file so that we always
end up printing an extra empty line (which gets turned into that extra
nul byte we need) - that corresponds better to the binary format
consisting of a series of key=val nul terminated strings, terminated
by an empty string.

Reported-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Makefile