coreboot/payloads/external/LinuxBoot/Makefile
Maximilian Brune d233b6c903 payloads/external/LinuxBoot/Makefile: Fix build prerequisite
Sometimes during build you could get this error:
mkdir: cannot create directory 'build': File exists
make[1]: *** [Makefile:48: build] Error 1
make: *** [payloads/external/Makefile.mk:408: payloads/external/LinuxBoot/build/initramfs] Erro
make: *** Waiting for unfinished jobs....
    Test 6.3
    WWW        https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.3.tar.xz

Usually this should not happen, because the 'build' target is an
order-only prerequisite, but I assume its still happening, because the
makefile is called twice during a Linuxboot build. Once for the Linux
kernel and once again for the initramfs.

A quick and dirty fix is to add a '-p' to the mkdir command.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I5663d1cb592bec6a8576347dd22223b382cd617f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87821
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-07-17 20:39:15 +00:00

60 lines
1.4 KiB
Makefile

## SPDX-License-Identifier: GPL-2.0-only
unexport $(COREBOOT_EXPORTS)
DTC ?= dtc
LINUX_ARCH-$(CONFIG_LINUXBOOT_X86_64) = x86_64
LINUX_ARCH-$(CONFIG_LINUXBOOT_X86) = i386
LINUX_ARCH-$(CONFIG_LINUXBOOT_ARM64) = arm64
LINUX_ARCH-$(CONFIG_LINUXBOOT_RISCV_RV32) = riscv
LINUX_ARCH-$(CONFIG_LINUXBOOT_RISCV_RV64) = riscv
ifeq ($(CONFIG_LINUXBOOT_COMPILE_KERNEL),y)
include targets/linux.mk
endif
ifeq ($(CONFIG_LINUXBOOT_UROOT),y)
include targets/u-root.mk
endif
ifeq ($(CONFIG_LINUXBOOT_KERNEL_BZIMAGE),y)
build/Image: $(kernel_dir)/arch/x86/boot/bzImage | build/
cp $< $@
else ifeq ($(CONFIG_LINUXBOOT_KERNEL_UIMAGE),y)
build/target.dtb: $(CONFIG_LINUXBOOT_DTS_FILE) | build/
$(DTC) -o $@ $<
build/Image: build/vmlinux.bin.lzma build/initramfs build/target.dtb $(LINUX_ARCH-y)/kernel_fdt_lzma.its | build/
mkimage -f $(LINUX_ARCH-y)/kernel_fdt_lzma.its $@
else ifneq ($(CONFIG_LINUXBOOT_COMPILE_KERNEL),y)
build/Image: $(CONFIG_LINUXBOOT_KERNEL_PATH) | build/
cp $< $@
endif
build/initramfs: build/initramfs_u-root.cpio | build/
ifeq ($(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ),y)
xz --stdout --keep --force --check=crc32 --lzma2=dict=1MiB $< > $@
else
cp $< $@
endif
build/:
mkdir -p build
clean:
rm -rf build/kernel*
rm -f build/u-root
rm -f build/initramfs*
rm -f build/bzImage
rm -f build/uImage
distclean:
rm -rf build
.PHONY: linuxboot clean distclean