aboutsummaryrefslogtreecommitdiff
path: root/payloads/external/LinuxBoot/Makefile
diff options
context:
space:
mode:
authorPhilipp Deppenwiese <zaolin@das-labor.org>2018-06-19 20:22:32 +0200
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-06-19 18:37:37 +0000
commit0f0e4e6c66b53098404ee00b001819b8b86f8e4b (patch)
treeee25551fd811f1905b0fa791ca8d525ba02a44ba /payloads/external/LinuxBoot/Makefile
parenta892cde653d40e39d399b1bc4c438e3dc2d00cd6 (diff)
payloads: Add LinuxBoot payload in u-root mode
* Add LinuxBoot support * Add u-root mode * Download kernel and u-root from upstream sources. * Add customization options * Clean kernel only if directory exists Change-Id: I3a25ff6812e046acc688cbbb203cf262ad751659 Signed-off-by: Philipp Deppenwiese <zaolin@das-labor.org> Reviewed-on: https://review.coreboot.org/23071 Reviewed-by: Ronald G. Minnich <rminnich@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'payloads/external/LinuxBoot/Makefile')
-rw-r--r--payloads/external/LinuxBoot/Makefile63
1 files changed, 63 insertions, 0 deletions
diff --git a/payloads/external/LinuxBoot/Makefile b/payloads/external/LinuxBoot/Makefile
new file mode 100644
index 0000000000..10ad0c3391
--- /dev/null
+++ b/payloads/external/LinuxBoot/Makefile
@@ -0,0 +1,63 @@
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2017 Facebook Inc.
+##
+## 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.
+##
+
+kernel_tarball=https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-$(CONFIG_LINUXBOOT_KERNEL_VERSION).tar.xz
+project_dir=linuxboot
+kernel_dir=$(project_dir)/kernel
+
+unexport $(COREBOOT_EXPORTS)
+
+all: payload
+
+$(kernel_dir)/.config:
+ echo " WWW Download Linux $(CONFIG_LINUXBOOT_KERNEL_VERSION)"
+ mkdir -p $(kernel_dir)
+ifeq ("$(wildcard $(kernel_dir)/README)","")
+ wget -qO- $(kernel_tarball) | tar xJ -C $(kernel_dir) --strip 1
+endif
+
+config: $(kernel_dir)/.config
+ echo " CONFIG Linux $(CONFIG_LINUXBOOT_KERNEL_VERSION)"
+ifneq ($(CONFIG_LINUXBOOT_KERNEL_CONFIGFILE),)
+ cp $(CONFIG_LINUXBOOT_KERNEL_CONFIGFILE) $(kernel_dir)/.config
+endif
+ifeq ($(CONFIG_LINUXBOOT_ARCH),386)
+ cp x86/defconfig $(kernel_dir)/.config
+else ifeq ($(CONFIG_LINUXBOOT_ARCH),amd64)
+ cp x86_64/defconfig $(kernel_dir)/.config
+endif
+
+$(project_dir)/kernel-image: config
+ echo " MAKE Kernel $(CONFIG_LINUXBOOT_KERNEL_VERSION)"
+ $(MAKE) -C $(kernel_dir) olddefconfig
+ $(MAKE) -C $(kernel_dir) -j $(CPUS)
+ifeq ($(CONFIG_LINUXBOOT_ARCH),386)
+ cp $(kernel_dir)/arch/x86/boot/bzImage $(project_dir)/kernel-image
+else ifeq ($(CONFIG_LINUXBOOT_ARCH),amd64)
+ cp $(kernel_dir)/arch/x86/boot/bzImage $(project_dir)/kernel-image
+endif
+
+payload: $(project_dir)/kernel-image
+ifeq ($(CONFIG_LINUXBOOT_UROOT),y)
+ $(MAKE) -f targets/u-root.mk
+endif
+
+clean:
+ if [ -d "$(kernel_dir)" ]; then make -C $(kernel_dir) clean; fi
+ rm -f $(project_dir)/initramfs.cpio.xz
+
+distclean:
+ rm -rf $(project_dir)
+
+.PHONY: config patch payload clean distclean clone fetch all