2018-06-19 20:22:32 +02:00
|
|
|
## This file is part of the coreboot project.
|
|
|
|
##
|
|
|
|
## Copyright (C) 2017 Facebook Inc.
|
2018-11-11 18:03:26 +01:00
|
|
|
## Copyright (C) 2018 9elements Cyber Security
|
2018-06-19 20:22:32 +02:00
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; version 2 of the License.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
|
|
|
|
project_dir=linuxboot
|
|
|
|
kernel_dir=$(project_dir)/kernel
|
|
|
|
|
|
|
|
unexport $(COREBOOT_EXPORTS)
|
2018-03-13 11:22:26 +01:00
|
|
|
|
2018-11-04 11:24:28 +01:00
|
|
|
all: linuxboot
|
2018-06-19 20:22:32 +02:00
|
|
|
|
2018-11-11 18:03:26 +01:00
|
|
|
u-root:
|
|
|
|
$(MAKE) -f targets/u-root.mk
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_BUILD_INITRAMFS),y)
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_UROOT),y)
|
|
|
|
initramfs: u-root
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifneq ($(CONFIG_LINUXBOOT_INITRAMFS),)
|
|
|
|
initramfs:
|
|
|
|
if [[ ! -f "$(top)/$(CONFIG_LINUXBOOT_INITRAMFS)" ]]; then \
|
|
|
|
echo "<< Linux initramfs '$(CONFIG_LINUXBOOT_INITRAMFS)' is missing. >>"; \
|
2018-03-13 11:22:26 +01:00
|
|
|
exit 1; \
|
|
|
|
fi
|
2018-06-19 20:22:32 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-11-21 17:45:43 +01:00
|
|
|
initramfs_compressed: initramfs
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_INITRAMFS_COMPRESSION_XZ),y)
|
|
|
|
xz --keep --force --lzma2=dict=1MiB $(top)/$(CONFIG_LINUXBOOT_INITRAMFS)
|
|
|
|
endif
|
|
|
|
|
2018-11-11 18:03:26 +01:00
|
|
|
ifeq ($(CONFIG_LINUXBOOT_COMPILE_KERNEL),y)
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_ARCH),arm64)
|
|
|
|
kernel: initramfs
|
|
|
|
$(MAKE) -f targets/linux.mk
|
|
|
|
else
|
|
|
|
kernel:
|
|
|
|
$(MAKE) -f targets/linux.mk
|
2018-06-19 20:22:32 +02:00
|
|
|
endif
|
2018-03-13 11:22:26 +01:00
|
|
|
else
|
2018-11-11 18:03:26 +01:00
|
|
|
kernel:
|
|
|
|
if [[ ! -f "$(top)/$(CONFIG_LINUXBOOT_KERNEL)" ]]; then \
|
|
|
|
echo "<< Linux kernel '$(CONFIG_LINUXBOOT_KERNEL)' is missing. >>"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2018-06-19 20:22:32 +02:00
|
|
|
endif
|
|
|
|
|
2018-11-21 17:45:43 +01:00
|
|
|
linuxboot: kernel initramfs_compressed
|
2018-03-13 11:22:26 +01:00
|
|
|
|
2018-06-19 20:22:32 +02:00
|
|
|
clean:
|
2018-07-30 22:49:33 +02:00
|
|
|
if [ -d "$(kernel_dir)" ]; then rm -rf $(kernel_dir); fi
|
2018-11-21 17:45:43 +01:00
|
|
|
rm -f $(project_dir)/u-root
|
|
|
|
rm -f $(project_dir)/initramfs*
|
2018-06-19 20:22:32 +02:00
|
|
|
|
|
|
|
distclean:
|
|
|
|
rm -rf $(project_dir)
|
|
|
|
|
2018-11-21 17:45:43 +01:00
|
|
|
.PHONY: linuxboot kernel initramfs_compressed initramfs u-root clean distclean
|