configs: apple: Add 8k padding to default environment · AsahiLinux/u-boot@4411224

Booting EFI stub binaries via m1n1's linux.py modifies the default environment ad requires additional space for boot command (either booti or bootefi with kernel and initramfs in memory). With ...

GitHub
@trini there is a script (https://github.com/AsahiLinux/m1n1/blob/main/proxyclient/tools/linux.py) for m1n1's proxy mode which uploads kernel, initramfs and optionally u-boot and boots them.
When using u-boot the script modifies the embedded default environment to boot kernel and initramfs from the known memory addresses. See the script source starting at line 84.
This worked with the distro boot scripts since it replaced the complex boot script as that is not necessary. This broke with bootstd as the default environment is tiny and there is not much which can be dropped.
I probably got overboard with the 8K padding but one intended use case is https://gitlab.freedesktop.org/gfx-ci/boot2container and I wasn't sure how long the boot arguments for that can get. I started looking how to solve this for upstream u-boot.
One option I thought of is using `... char default_environment[CONFIG_ENV_DEFAULT_ENV_EMBEDDED_SIZE] = {` with CONFIG_ENV_DEFAULT_ENV_EMBEDDED_SIZE unset by default. The other one is to let the build system append a configurable sized padding at the end.
m1n1/proxyclient/tools/linux.py at main · AsahiLinux/m1n1

A bootloader and experimentation playground for Apple Silicon - AsahiLinux/m1n1

GitHub
@janne I'm probably missing something, but why aren't the bootargs just being set/modified in the device tree directly? By default there's not a lot of extra space, but can both resize it with libfdt (and available in python) and/or build the dtb with a known amount of extra padding.

@trini u-boot env has to modified anyway to set the boot command to booti/bootefi with the actual kernel image and initramfs addresses and sizes. iirc there wasn’t even enough space for that. Bootargs are already modified in the dtb so it should be unnecessary to add them to the u-boot env.

The alternate bootcmd can then added to the default env for apple devices since it has a known maximal size. That’s better than my quick workaround and the alternate solutions I was thinking of. thanks

@janne Can that also be used to automate other stuff?