[PATCH 1/2] Allow Python packages to be dropped

When building in a portage chroot, we do not have the environment needed to build pylibfdt. It is instead build as a separate package.
Provide a build option to tell U-Boot to skip this part of the build. We still need it to use binman, etc. but don't need it to build its dependencies.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Mike Frysinger vapier@chromium.org ---
Makefile | 8 ++++++++ doc/build/tools.rst | 9 +++++++++ scripts/dtc/Makefile | 2 ++ 3 files changed, 19 insertions(+)
diff --git a/Makefile b/Makefile index 9b90204bfe6..25be94ef20f 100644 --- a/Makefile +++ b/Makefile @@ -646,12 +646,20 @@ export CFLAGS_NON_EFI # Compiler flags to remove when building EFI app export EFI_TARGET # binutils target if EFI is natively supported
export LTO_ENABLE +export PYTHON_ENABLE
# This is y if LTO is enabled for this build. See NO_LTO=1 to disable LTO ifeq ($(NO_LTO),) LTO_ENABLE=$(if $(CONFIG_LTO),y) endif
+# This is y if U-Boot should not build any Python tools or libraries. Typically +# you would need to set this if those tools/libraries (typically binman and +# pylibfdt) cannot be built by your environment and are provided separately. +ifeq ($(NO_PYTHON),) +PYTHON_ENABLE=y +endif + # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use # that (or fail if absent). Otherwise, search for a linker script in a # standard location. diff --git a/doc/build/tools.rst b/doc/build/tools.rst index ec017229258..418f0abb236 100644 --- a/doc/build/tools.rst +++ b/doc/build/tools.rst @@ -45,3 +45,12 @@ Launch the MSYS2 shell of the MSYS2 environment, and do the following::
$ make tools-only_defconfig $ make tools-only + + +Building without Python +----------------------- + +The tools-only build bytes pylibfdt by default. To disable this, use the +NO_PYTHON variable:: + + NO_PYTHON=1 make tools-only_defconfig tools-only diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 58d879dd11f..faa72d95e28 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -19,4 +19,6 @@ HOSTCFLAGS_dtc-parser.tab.o := -I$(src) $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
# Added for U-Boot +ifeq ($(PYTHON_ENABLE),y) subdir-$(CONFIG_PYLIBFDT) += pylibfdt +endif

Declare the global_data pointer at the top of the file, to avoid an error:
arch/x86/include/asm/global_data.h:143:35: error: a label can only be part of a statement and a declaration is not a statement board/coreboot/coreboot/coreboot.c:60:2: note: in expansion of macro ‘DECLARE_GLOBAL_DATA_PTR’
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Mike Frysinger vapier@chromium.org ---
board/coreboot/coreboot/coreboot.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/board/coreboot/coreboot/coreboot.c b/board/coreboot/coreboot/coreboot.c index 3b90ae75386..db855c11ae6 100644 --- a/board/coreboot/coreboot/coreboot.c +++ b/board/coreboot/coreboot/coreboot.c @@ -10,6 +10,8 @@ #include <asm/cb_sysinfo.h> #include <asm/global_data.h>
+DECLARE_GLOBAL_DATA_PTR; + int board_early_init_r(void) { /* @@ -54,14 +56,12 @@ int show_board_info(void) return 0;
fallback: -#ifdef CONFIG_OF_CONTROL - DECLARE_GLOBAL_DATA_PTR; - - model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); + if (IS_ENABLED(CONFIG_OF_CONTROL)) { + model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
- if (model) - printf("Model: %s\n", model); -#endif + if (model) + printf("Model: %s\n", model); + }
return checkboard(); }

On Thu, Aug 31, 2023 at 11:20:52AM -0600, Simon Glass wrote:
When building in a portage chroot, we do not have the environment needed to build pylibfdt. It is instead build as a separate package.
Provide a build option to tell U-Boot to skip this part of the build. We still need it to use binman, etc. but don't need it to build its dependencies.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Mike Frysinger vapier@chromium.org
Makefile | 8 ++++++++
Can we do this via Kconfig instead? It looks like we don't need to do this part of the build for coreboot, yes? And so if we can drop it from other builds as well that might help speed up CI.
[snip]
+The tools-only build bytes pylibfdt by default. To disable this, use the
"build bytes" should probably be "builds" I suspect.

Hi Tom,
On Thu, 31 Aug 2023 at 11:48, Tom Rini trini@konsulko.com wrote:
On Thu, Aug 31, 2023 at 11:20:52AM -0600, Simon Glass wrote:
When building in a portage chroot, we do not have the environment needed to build pylibfdt. It is instead build as a separate package.
Provide a build option to tell U-Boot to skip this part of the build. We still need it to use binman, etc. but don't need it to build its dependencies.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Mike Frysinger vapier@chromium.org
Makefile | 8 ++++++++
Can we do this via Kconfig instead? It looks like we don't need to do this part of the build for coreboot, yes? And so if we can drop it from other builds as well that might help speed up CI.
Yes it could. But I really don't like changing the board config on the fly - we have things like 'select BINMAN' now and it just gets messy. In the normal course of events we want to build the python things and the build won't work without it (e.g. binman will fail). But where the build environment has installed binman separate, it knows better.
So I don't think this is a board config thing,
[snip]
+The tools-only build bytes pylibfdt by default. To disable this, use the
"build bytes" should probably be "builds" I suspect.
Yes, thanks.
Regards, Simon

On Fri, Sep 1, 2023 at 3:13 AM Simon Glass sjg@chromium.org wrote:
Hi Tom,
On Thu, 31 Aug 2023 at 11:48, Tom Rini trini@konsulko.com wrote:
On Thu, Aug 31, 2023 at 11:20:52AM -0600, Simon Glass wrote:
When building in a portage chroot, we do not have the environment needed to build pylibfdt. It is instead build as a separate package.
Provide a build option to tell U-Boot to skip this part of the build. We still need it to use binman, etc. but don't need it to build its dependencies.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Mike Frysinger vapier@chromium.org
Makefile | 8 ++++++++
Can we do this via Kconfig instead? It looks like we don't need to do this part of the build for coreboot, yes? And so if we can drop it from other builds as well that might help speed up CI.
Yes it could. But I really don't like changing the board config on the fly - we have things like 'select BINMAN' now and it just gets messy. In the normal course of events we want to build the python things and the build won't work without it (e.g. binman will fail). But where the build environment has installed binman separate, it knows better.
So I don't think this is a board config thing,
[snip]
+The tools-only build bytes pylibfdt by default. To disable this, use the
"build bytes" should probably be "builds" I suspect.
Yes, thanks.
Corrected "build bytes" to "builds bytes", and
series applied to u-boot-x86/next, thanks!
Regards, Bin
participants (3)
-
Bin Meng
-
Simon Glass
-
Tom Rini