payloads: Replace GPL boilerplate with SPDX headers
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I9f74ed19257bc4234465b8f912deff1b485173f9
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41179
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 22:50:46 +02:00
|
|
|
## SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
2019-05-26 01:14:13 +02:00
|
|
|
SHELL := /bin/bash
|
2018-11-11 18:03:26 +01:00
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
ARCH-$(CONFIG_LINUXBOOT_X86_64)=x86_64
|
|
|
|
ARCH-$(CONFIG_LINUXBOOT_X86)=x86
|
|
|
|
ARCH-$(CONFIG_LINUXBOOT_ARM64)=arm64
|
|
|
|
|
|
|
|
TAG-$(CONFIG_LINUXBOOT_KERNEL_MAINLINE)=mainline
|
|
|
|
TAG-$(CONFIG_LINUXBOOT_KERNEL_STABLE)=stable
|
|
|
|
TAG-$(CONFIG_LINUXBOOT_KERNEL_LONGTERM)=longterm
|
|
|
|
|
|
|
|
pwd:=$(shell pwd)
|
|
|
|
top:=../../..
|
2018-11-11 18:03:26 +01:00
|
|
|
project_dir=linuxboot
|
2018-12-05 08:45:26 +01:00
|
|
|
tarball_dir:=$(project_dir)/tarball
|
|
|
|
decompress_flag=.done
|
|
|
|
|
|
|
|
OBJCOPY:=$(LINUXBOOT_CROSS_COMPILE)objcopy
|
2019-09-13 03:59:23 +02:00
|
|
|
KERNEL_MAKE_FLAGS = \
|
2019-09-13 04:19:13 +02:00
|
|
|
ARCH=$(ARCH-y) \
|
|
|
|
KBUILD_BUILD_USER="coreboot" \
|
|
|
|
KBUILD_BUILD_HOST="reproducible" \
|
|
|
|
KBUILD_BUILD_TIMESTAMP="$(shell perl -e 'print scalar gmtime($(SOURCE_DATE_EPOCH))')" \
|
|
|
|
KBUILD_BUILD_VERSION="0"
|
2018-12-05 08:45:26 +01:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_CUSTOM),y)
|
|
|
|
kernel_version:=$(CONFIG_LINUXBOOT_KERNEL_CUSTOM_VERSION)
|
|
|
|
else
|
2019-08-30 19:57:49 +02:00
|
|
|
kernel_version:=$(shell curl -sS -k https://www.kernel.org/feeds/kdist.xml | \
|
2018-12-05 08:45:26 +01:00
|
|
|
sed -n -e 's@.*<guid isPermaLink="false">\(.*\)</guid>.*@\1@p' | \
|
|
|
|
awk -F ',' '/$(TAG-y)/{ print $$3 }' | \
|
|
|
|
head -n 1)
|
2018-11-11 18:03:26 +01:00
|
|
|
endif
|
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
kernel_dir=$(project_dir)/kernel-$(subst .,_,$(kernel_version))
|
|
|
|
kernel_tarball=linux-$(kernel_version).tar
|
|
|
|
kernel_mirror=https://mirrors.edge.kernel.org/pub/linux/kernel
|
|
|
|
|
|
|
|
ifeq ($(findstring x2.6.,x$(kernel_version)),x2.6.)
|
|
|
|
kernel_mirror_path := $(kernel_mirror)/v2.6
|
|
|
|
else ifeq ($(findstring x3.,x$(kernel_version)),x3.)
|
|
|
|
kernel_mirror_path := $(kernel_mirror)/v3.x
|
|
|
|
else ifeq ($(findstring x4.,x$(kernel_version)),x4.)
|
|
|
|
kernel_mirror_path := $(kernel_mirror)/v4.x
|
|
|
|
else ifeq ($(findstring x5.,x$(kernel_version)),x5.)
|
|
|
|
kernel_mirror_path := $(kernel_mirror)/v5.x
|
|
|
|
endif
|
2018-11-11 18:03:26 +01:00
|
|
|
|
|
|
|
all: kernel
|
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
lookup:
|
|
|
|
ifeq ($(kernel_version),)
|
|
|
|
$(error kernel version lookup failed for $(TAG-y) release)
|
|
|
|
endif
|
|
|
|
@echo " WWW Kernel [$(TAG-y)] $(kernel_version)"
|
2018-11-11 18:03:26 +01:00
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
fetch:
|
|
|
|
ifneq ($(shell [[ -d "$(kernel_dir)" && -f "$(kernel_dir)/$(decompress_flag)" ]];echo $$?),0)
|
|
|
|
mkdir -p $(tarball_dir)
|
|
|
|
if [[ ! -f $(tarball_dir)/$(kernel_tarball).xz && ! -f $(tarball_dir)/$(kernel_tarball).xz ]]; then \
|
|
|
|
echo " WWW $(kernel_tarball).xz"; \
|
|
|
|
cd $(tarball_dir); \
|
2019-08-30 19:57:49 +02:00
|
|
|
curl -OLSs "$(kernel_mirror_path)/$(kernel_tarball).xz"; \
|
2018-12-05 08:45:26 +01:00
|
|
|
cd $(pwd); \
|
|
|
|
fi
|
2018-11-11 18:03:26 +01:00
|
|
|
endif
|
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
unpack: fetch
|
|
|
|
if [[ -d "$(kernel_dir)" && ! -f "$(kernel_dir)/$(decompress_flag)" ]]; then \
|
|
|
|
rm -rf $(kernel_dir); \
|
|
|
|
fi
|
|
|
|
if [[ ! -d "$(kernel_dir)" ]]; then \
|
|
|
|
mkdir $(kernel_dir); \
|
|
|
|
echo " XZ $(kernel_tarball).xz"; \
|
|
|
|
tar xJf $(tarball_dir)/$(kernel_tarball).xz --strip 1 -C $(kernel_dir); \
|
|
|
|
fi
|
|
|
|
touch $(kernel_dir)/$(decompress_flag)
|
|
|
|
|
|
|
|
$(kernel_dir)/.config: unpack
|
|
|
|
@echo " CONFIG Linux $(kernel_version)"
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_CUSTOM_CONFIG),y)
|
2018-11-11 18:03:26 +01:00
|
|
|
cp $(CONFIG_LINUXBOOT_KERNEL_CONFIGFILE) $(kernel_dir)/.config
|
2018-12-05 08:45:26 +01:00
|
|
|
else
|
|
|
|
cp $(ARCH-y)/defconfig $(kernel_dir)/.config
|
2018-11-11 18:03:26 +01:00
|
|
|
endif
|
2019-09-13 03:59:23 +02:00
|
|
|
$(MAKE) -C $(kernel_dir) $(KERNEL_MAKE_FLAGS) olddefconfig
|
2018-11-11 18:03:26 +01:00
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
build: $(kernel_dir)/.config
|
|
|
|
@echo " MAKE Linux $(kernel_version)"
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_BZIMAGE),y)
|
2019-09-13 03:59:23 +02:00
|
|
|
$(MAKE) -C $(kernel_dir) $(KERNEL_MAKE_FLAGS) CROSS_COMPILE=$(LINUXBOOT_CROSS_COMPILE) bzImage
|
2018-12-05 08:45:26 +01:00
|
|
|
else
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_UIMAGE),y)
|
2019-09-13 03:59:23 +02:00
|
|
|
$(MAKE) -C $(kernel_dir) $(KERNEL_MAKE_FLAGS) CROSS_COMPILE=$(LINUXBOOT_CROSS_COMPILE) vmlinux
|
2018-12-05 08:45:26 +01:00
|
|
|
endif
|
2018-11-11 18:03:26 +01:00
|
|
|
endif
|
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_BZIMAGE),y)
|
|
|
|
$(top)/$(CONFIG_LINUXBOOT_KERNEL): build
|
|
|
|
@echo " CP bzImage"
|
|
|
|
cp $(kernel_dir)/arch/x86/boot/bzImage $@
|
|
|
|
else
|
|
|
|
ifeq ($(CONFIG_LINUXBOOT_KERNEL_UIMAGE),y)
|
|
|
|
$(project_dir)/target.dtb: $(top)/$(CONFIG_LINUXBOOT_DTB_FILE)
|
2018-11-11 18:03:26 +01:00
|
|
|
cp $< $@
|
|
|
|
$(project_dir)/vmlinux.bin: $(kernel_dir)/vmlinux
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
$(project_dir)/vmlinux.bin.lzma: $(project_dir)/vmlinux.bin
|
|
|
|
xz -c -k -f --format=lzma --lzma1=dict=1MiB,lc=3,lp=0,pb=3 $< > $@
|
2018-12-05 08:45:26 +01:00
|
|
|
$(top)/$(CONFIG_LINUXBOOT_KERNEL): build $(project_dir)/vmlinux.bin.lzma $(project_dir)/target.dtb
|
2018-11-11 18:03:26 +01:00
|
|
|
cp $(project_dir)/../arm64/kernel_fdt_lzma.its $(project_dir)
|
2018-12-05 08:45:26 +01:00
|
|
|
cp $(top)/$(CONFIG_LINUXBOOT_INITRAMFS)$(CONFIG_LINUXBOOT_INITRAMFS_SUFFIX) $(project_dir)/initramfs
|
2018-11-11 18:03:26 +01:00
|
|
|
mkimage -f $(project_dir)/kernel_fdt_lzma.its $@
|
2018-12-05 08:45:26 +01:00
|
|
|
else
|
|
|
|
$(error Kernel image format not found)
|
|
|
|
exit 1
|
|
|
|
endif
|
2018-11-11 18:03:26 +01:00
|
|
|
endif
|
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
ifneq ($(TAG-y),)
|
|
|
|
kernel: lookup $(top)/$(CONFIG_LINUXBOOT_KERNEL)
|
|
|
|
else
|
|
|
|
kernel: $(top)/$(CONFIG_LINUXBOOT_KERNEL)
|
2018-11-11 18:03:26 +01:00
|
|
|
endif
|
|
|
|
|
2018-12-05 08:45:26 +01:00
|
|
|
.PHONY: all kernel build unpack fetch check
|