There were some issues with the current Linuxboot Makefiles.
- multithreaded compilation didn't work, because some prerequisites
were missing
- initramfs wasn't added for x86 qemu boot.
- riscv support was incomplete
It began with separate patches, but resulted in a clean up patch, that
is hard to separate. The most important changes are the following:
- Instead of phony targets, actual files are now used as prerequisites
- riscv can now be used as target
- initramfs works now also for x86
- instead of querying the most recent version from the internet, I set a
known working version (because I tested it) that can be customized
and/or upgraded in the future. The reasons:
- querying the version from the internet requires a constant
connection to the internet even after linux kernel is already
build (aka subsequent builds).
- one usually wants to use a known working version, but optionally
still have the posibillity to choose a custom one. This patch
introduces this possibility in its most simple form.
- I removed as much ifeq statements as possible and moved that
responsibility to Kconfig, because they tend to make the
Makefile less readable.
Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I25e757108e0dd473969fe5a192ad0733f1fe6286
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76150
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
51 lines
1.3 KiB
Makefile
51 lines
1.3 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
|
|
|
|
build/Image: $(CONFIG_LINUXBOOT_KERNEL_PATH)
|
|
ln -s -r $< $@
|
|
|
|
include targets/linux.mk targets/u-root.mk
|
|
|
|
build/initramfs: $(CONFIG_LINUXBOOT_INITRAMFS_PATH)
|
|
ifeq ($(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ),y)
|
|
xz --keep --force --check=crc32 --lzma2=dict=1MiB $(CONFIG_LINUXBOOT_INITRAMFS_PATH)
|
|
endif
|
|
cp $(CONFIG_LINUXBOOT_INITRAMFS_PATH)$(CONFIG_LINUXBOOT_INITRAMFS_SUFFIX) $@
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_BZIMAGE),y)
|
|
|
|
build/bzImage: $(kernel_dir)/arch/x86/boot/bzImage | build
|
|
cp $< $@
|
|
|
|
else ifeq ($(CONFIG_LINUXBOOT_KERNEL_UIMAGE),y)
|
|
|
|
build/target.dtb: $(CONFIG_LINUXBOOT_DTS_FILE)
|
|
$(DTC) -o $@ $<
|
|
|
|
build/uImage: 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 $@
|
|
|
|
endif # CONFIG_LINUXBOOT_KERNEL_BZIMAGE
|
|
|
|
build:
|
|
mkdir build
|
|
|
|
clean:
|
|
rm -rf build/kernel*
|
|
rm -f build/u-root
|
|
rm -f build/initramfs*
|
|
rm -f build/bzImage
|
|
|
|
distclean:
|
|
rm -rf build
|
|
|
|
.PHONY: linuxboot clean distclean
|