blob: cd9f7eaa0e7a38904349457bd13eae95bd857db3 [file] [log] [blame]
Patrick Georgi8480c0b2020-05-08 22:50:46 +02001## SPDX-License-Identifier: GPL-2.0-only
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +02002
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +02003project_dir=linuxboot
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +02004
5unexport $(COREBOOT_EXPORTS)
Patrick Rudolph02c08142018-03-13 11:22:26 +01006
Marcello Sylvester Bauer9d3b1b22018-11-04 11:24:28 +01007all: linuxboot
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +02008
Marcello Sylvester Bauer78d02562018-11-11 18:03:26 +01009u-root:
10 $(MAKE) -f targets/u-root.mk
11
12ifeq ($(CONFIG_LINUXBOOT_BUILD_INITRAMFS),y)
13ifeq ($(CONFIG_LINUXBOOT_UROOT),y)
14initramfs: u-root
15endif
16else
17ifneq ($(CONFIG_LINUXBOOT_INITRAMFS),)
18initramfs:
19 if [[ ! -f "$(top)/$(CONFIG_LINUXBOOT_INITRAMFS)" ]]; then \
20 echo "<< Linux initramfs '$(CONFIG_LINUXBOOT_INITRAMFS)' is missing. >>"; \
Patrick Rudolph02c08142018-03-13 11:22:26 +010021 exit 1; \
22 fi
Marcello Sylvester Bauer78d02562018-11-11 18:03:26 +010023endif
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +020024endif
25
Marcello Sylvester Bauere102c5d2018-11-21 17:45:43 +010026initramfs_compressed: initramfs
27ifeq ($(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ),y)
Marcello Sylvester Bauerf1d68832018-11-29 16:34:39 +010028 xz --keep --force --check=crc32 --lzma2=dict=1MiB $(top)/$(CONFIG_LINUXBOOT_INITRAMFS)
Marcello Sylvester Bauere102c5d2018-11-21 17:45:43 +010029endif
30
Marcello Sylvester Bauer78d02562018-11-11 18:03:26 +010031ifeq ($(CONFIG_LINUXBOOT_COMPILE_KERNEL),y)
32ifeq ($(CONFIG_LINUXBOOT_ARCH),arm64)
33kernel: initramfs
Marcello Sylvester Bauer79f92912018-12-05 08:45:26 +010034 if [[ ! -f "$(top)/$(CONFIG_LINUXBOOT_DTB_FILE)" ]]; then \
35 echo "<< Linux kernel devicetree is missing. >>"; \
36 exit 1; \
37 fi
Marcello Sylvester Bauer78d02562018-11-11 18:03:26 +010038 $(MAKE) -f targets/linux.mk
Patrick Rudolph02c08142018-03-13 11:22:26 +010039else
Marcello Sylvester Bauer78d02562018-11-11 18:03:26 +010040kernel:
41 $(MAKE) -f targets/linux.mk
42endif
43else
44kernel:
45 if [[ ! -f "$(top)/$(CONFIG_LINUXBOOT_KERNEL)" ]]; then \
46 echo "<< Linux kernel '$(CONFIG_LINUXBOOT_KERNEL)' is missing. >>"; \
47 exit 1; \
48 fi
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +020049endif
50
Marcello Sylvester Bauere102c5d2018-11-21 17:45:43 +010051linuxboot: kernel initramfs_compressed
Patrick Rudolph02c08142018-03-13 11:22:26 +010052
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +020053clean:
Arthur Heymans241c1c62022-06-15 15:19:42 +020054 rm -rf $(project_dir)/kernel*
Marcello Sylvester Bauere102c5d2018-11-21 17:45:43 +010055 rm -f $(project_dir)/u-root
56 rm -f $(project_dir)/initramfs*
Patrik Tesarikf5c2f252022-06-11 21:47:21 +020057 rm -f $(project_dir)/bzImage
Philipp Deppenwiese0f0e4e62018-06-19 20:22:32 +020058
59distclean:
60 rm -rf $(project_dir)
61
Marcello Sylvester Bauere102c5d2018-11-21 17:45:43 +010062.PHONY: linuxboot kernel initramfs_compressed initramfs u-root clean distclean