pkgs/kernel/uimage: introduce commandLineDtbNode

Certain devices like the Zyxel NWA50AX will pass information on the command-line
to explain what is the current image (`bootImage=1` vs. `bootImage=0`).

Unfortunately, if we set the `chosen/bootargs` node, this will be overridden forcibly
by U-Boot.

To avoid this problem, it's easier to simply just use another DTB node like `bootargs-override` which
is what OpenWRT does [1].

[1]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ramips/patches-5.15/314-MIPS-add-bootargs-override-property.patch;h=e7dca7af886e8c0b69ba2b23f5855ddfeeb0d4a1;hb=refs/heads/main

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
Raito Bezarius 2024-02-17 02:16:20 +01:00
parent d14ee41325
commit 0a8343be66

View file

@ -15,6 +15,7 @@ let
in { in {
kernel kernel
, commandLine , commandLine
, commandLineDtbNode ? "bootargs"
, entryPoint , entryPoint
, extraName ? "" # e.g. socFamily , extraName ? "" # e.g. socFamily
, loadAddress , loadAddress
@ -39,7 +40,7 @@ in {
''; '';
mungeDtbPhase = '' mungeDtbPhase = ''
dtc -I dtb -O dts -o tmp.dts ${dtb} dtc -I dtb -O dts -o tmp.dts ${dtb}
echo '/{ chosen { bootargs = ${builtins.toJSON commandLine}; }; };' >> tmp.dts echo '/{ chosen { ${commandLineDtbNode} = ${builtins.toJSON commandLine}; }; };' >> tmp.dts
dtc -I dts -O dtb -o tmp.dtb tmp.dts dtc -I dts -O dtb -o tmp.dtb tmp.dts
''; '';