uboot uses the KBuild build system in a slightly unusual way. To cross-compile for arm64, it’s necessary to set ARCH to arm even when the kernel architecture is arm64. For snapcraft this case is not automatically detectable.
I proposed a PR to handle this case by picking up the value from the environment - that’s the same approached already done for the CROSS_COMPILE variable for kbuild/ kernel parts. Unfortunately there’s a catch: this won’t work on Launchpad builds where custom environment variables can’t be set at all.
@ondra suggested in a discussion on IRC a generic mechanism for environment variables in parts might be useful. It could handle both of these cases. And there might be other plugins that would benefit from that.
The make plugin has make-parameters which effectively makes it possible to add environment variables and arbitrary options. An argument could be made that kbuild could do the same - or, conversely, a more generic option could be used for all plugins, including make.
More arguments welcome. Especially if we could find other cases that would potentially make use of such a feature.