Go to file
Julien Olivain caafa2d5d7 boot/edk2: unset MAKEFLAGS in build environment
Yann reported in [1] that edk2 build could sometimes fail. The issue
can be reproduced when per-package directories is enabled, or also
when building on a system with GNU Make >= 4.4 using the
"--shuffle=reverse" option (such as Fedora 39). Those are pointing
toward a Makefile dependency issue.

The issue can be reproduced with commands:

    cat > .config <<EOF
    BR2_riscv=y
    BR2_RISCV_64=y
    BR2_TOOLCHAIN_EXTERNAL=y
    BR2_TARGET_EDK2=y
    EOF
    make olddefconfig

Then, building either with:

    make --shuffle=reverse

Or:

    utils/config -e BR2_PER_PACKAGE_DIRECTORIES
    make olddefconfig
    make -j$(nproc)

It is interesting to mention that when using "make --shuffle=reverse"
to build, the build can be completed if restarted only with "make". It
will not pull any other Buildroot package. This fact hints toward a
Makefile dependency issue internal to the EDK2 build system, rather
than in the Buildroot recipe.

The EDK2 build system is quite unique. See [2]. It generates files,
makefiles and internally uses GNU Make to compile code. This system is
likely not tested as being a sub-Make process in a complex Makefile
such as Buildroot.

In order to prevent Buildroot to pass unexpected Make flags to the
EDK2 sub-Make, this commit unset the MAKEFLAGS variable in the EDK2
build environment. This will put the EDK2 build script in a more
common and tested state. See GNU Make documentation about recursive use
of Make, more specifically [3].

Note: as mentioned, the build failure is likely due to an internal
issue of the EDK2 build system. The failure points to a missing
dependency in the EDK2 generator itself. This commit does not fix this
issue, but rather put the EDK2 build system in a normalized
environment, avoiding Buildroot flags being passed to the internal
EDK2 sub-Make invocation. The upstream EDK2 build system most likely
need a fix too.

Fixes:

    make[2]: *** No rule to make target '/buildroot/output/build/edk2-edk2-stable202308/Build/RiscVVirtQemu/RELEASE_GCC5/RISCV64/MdeModulePkg/Application/UiApp/UiApp/DEBUG/UiApp.efi', needed by '/buildroot/output/build/edk2-edk2-stable202308/Build/RiscVVirtQemu/RELEASE_GCC5/FV/Ffs/462CAA21-7614-4503-836E-8AB6F4662331UiApp/UiApp.offset'.  Stop.

    build.py...
     : error 7000: Failed to execute command
	    make tbuild [/buildroot/output/build/edk2-edk2-stable202308/Build/RiscVVirtQemu/RELEASE_GCC5/RISCV64/MdeModulePkg/Application/UiApp/UiApp]

    build.py...
     : error F002: Failed to build module
	    /buildroot/output/build/edk2-edk2-stable202308/MdeModulePkg/Application/UiApp/UiApp.inf [RISCV64, GCC5, RELEASE]

[1] https://lists.buildroot.org/pipermail/buildroot/2023-December/681507.html
[2] https://tianocore-docs.github.io/edk2-BuildSpecification/draft/4_edk_ii_build_process_overview/42_build_process_overview.html
[3] https://www.gnu.org/software/make/manual/make.html#Options_002fRecursion

Reported-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit 44af6938fb)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-01-10 21:08:01 +01:00
arch arch/powerpc: drop ABI selection 2023-08-20 23:22:27 +02:00
board configs/rock5b: add hash for custom kernel 2024-01-08 12:03:55 +01:00
boot boot/edk2: unset MAKEFLAGS in build environment 2024-01-10 21:08:01 +01:00
configs configs/rock5b: add hash for custom kernel 2024-01-08 12:03:55 +01:00
docs doc/manual: rsync is not optional 2024-01-05 11:42:13 +01:00
fs fs/cpio: allow users to provide their own dracut modules 2023-02-06 22:46:35 +01:00
linux {linux, linux-headers}: bump 4.{14, 19}.x / 5.{4, 10, 15}.x / 6.{1, 6}.x series 2024-01-09 21:09:18 +01:00
package package/x11r7/xserver_xorg-server: security bump to version 21.1.10 2024-01-10 21:03:02 +01:00
support support/testing: TestDtbocfg: bump kernel to 5.10.202 2024-01-05 11:40:38 +01:00
system package/openrc: fix uclibc handling 2023-11-29 10:00:43 +01:00
toolchain {toolchain, linux-headers}: add support for 6.6 headers 2023-11-01 19:22:47 +01:00
utils utils/add-custom-hashes: add script to manage global patch dir hashes 2023-11-12 11:59:27 +01:00
.checkpackageignore .checkpackageignore: stop ignoring ShellCheck issues in google-breakpad 2024-01-09 13:51:21 +01:00
.clang-format
.defconfig
.editorconfig editorconfig: fix wildcard expansion 2024-01-07 12:21:04 +01:00
.flake8
.gitignore
.gitlab-ci.yml support/misc/gitlab-ci.yml.in: retry a job only if it failed due to a runner issue 2023-08-27 10:09:37 +02:00
.shellcheckrc utils/check-package: improve shellcheck reproducibility 2022-07-25 23:52:47 +02:00
CHANGES Update for 2023.11 2023-12-04 09:08:32 +01:00
Config.in Config.in: rework BR2_DOWNLOAD_FORCE_CHECK_HASHES 2024-01-10 20:29:45 +01:00
Config.in.legacy package/libcamera: pipeline option 'raspberrypi' changed to 'rpi/vc4' 2024-01-10 16:38:43 +01:00
COPYING
DEVELOPERS DEVELOPERS: fix indentation on 2 entries 2024-01-05 11:54:37 +01:00
Makefile Update for 2023.11 2023-12-04 09:08:32 +01:00
Makefile.legacy
README

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches