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
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2020-12-27 21:03:34 +01:00
|
|
|
unexport $(COREBOOT_EXPORTS)
|
|
|
|
|
2016-03-08 20:32:40 +01:00
|
|
|
src := $(CURDIR)
|
2012-12-01 01:04:58 +01:00
|
|
|
srctree := $(src)
|
2015-06-30 01:10:16 +02:00
|
|
|
srck := $(src)/../../util/kconfig
|
2016-03-08 00:26:51 +01:00
|
|
|
coreinfo_obj := $(src)/build
|
2012-12-01 01:04:58 +01:00
|
|
|
objk := $(src)/build/util/kconfig
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2017-01-19 23:20:14 +01:00
|
|
|
ifeq ($(filter %clean,$(MAKECMDGOALS)),)
|
2008-03-24 16:47:49 +01:00
|
|
|
export KERNELVERSION := 0.1.0
|
2016-03-08 00:26:51 +01:00
|
|
|
export KCONFIG_AUTOHEADER := $(coreinfo_obj)/config.h
|
|
|
|
export KCONFIG_AUTOCONFIG := $(coreinfo_obj)/auto.conf
|
|
|
|
export KCONFIG_DEPENDENCIES := $(coreinfo_obj)/auto.conf.cmd
|
|
|
|
export KCONFIG_SPLITCONFIG := $(coreinfo_obj)/config
|
|
|
|
export KCONFIG_TRISTATE := $(coreinfo_obj)/tristate.conf
|
2016-08-02 03:25:33 +02:00
|
|
|
export KCONFIG_CONFIG := $(CURDIR)/.config
|
2015-06-30 01:10:16 +02:00
|
|
|
export KCONFIG_NEGATIVES := 1
|
|
|
|
export Kconfig := Kconfig
|
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
export V := $(V)
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
CONFIG_SHELL := sh
|
|
|
|
KBUILD_DEFCONFIG := configs/defconfig
|
|
|
|
UNAME_RELEASE := $(shell uname -r)
|
|
|
|
HAVE_DOTCONFIG := $(wildcard .config)
|
|
|
|
MAKEFLAGS += -rR --no-print-directory
|
|
|
|
|
|
|
|
# Make is silent per default, but 'make V=1' will show all compiler calls.
|
|
|
|
ifneq ($(V),1)
|
2015-07-01 00:22:12 +02:00
|
|
|
.SILENT:
|
2008-03-24 16:47:49 +01:00
|
|
|
endif
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
HOSTCC ?= gcc
|
|
|
|
HOSTCXX ?= g++
|
2008-03-24 16:47:49 +01:00
|
|
|
HOSTCFLAGS := -I$(srck) -I$(objk)
|
|
|
|
HOSTCXXFLAGS := -I$(srck) -I$(objk)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2016-04-24 01:33:18 +02:00
|
|
|
LIBPAYLOAD_PATH := $(realpath ../libpayload)
|
2016-03-15 21:29:35 +01:00
|
|
|
LIBPAYLOAD_OBJ := $(coreinfo_obj)/libpayload
|
|
|
|
HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_OBJ)/lib/libpayload.a)
|
2016-03-12 20:47:00 +01:00
|
|
|
LIBPAYLOAD_CONFIG ?= configs/defconfig-tinycurses
|
2012-12-01 01:04:58 +01:00
|
|
|
OBJCOPY ?= objcopy
|
2008-04-10 02:05:41 +02:00
|
|
|
|
2016-07-08 11:14:40 +02:00
|
|
|
INCLUDES = -I$(coreinfo_obj) -include $(LIBPAYLOAD_OBJ)/include/kconfig.h -I$(src)/../../src/commonlib/include
|
2008-03-31 22:30:18 +02:00
|
|
|
OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
|
2016-03-11 17:30:14 +01:00
|
|
|
nvram_module.o bootlog_module.o ramdump_module.o \
|
2016-07-08 11:14:40 +02:00
|
|
|
multiboot_module.o cbfs_module.o timestamps_module.o coreinfo.o
|
2016-03-08 00:26:51 +01:00
|
|
|
OBJS = $(patsubst %,$(coreinfo_obj)/%,$(OBJECTS))
|
|
|
|
TARGET = $(coreinfo_obj)/coreinfo.elf
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2015-11-17 06:33:48 +01:00
|
|
|
all: real-all
|
|
|
|
|
|
|
|
# in addition to the dependency below, create the file if it doesn't exist
|
|
|
|
# to silence warnings about a file that would be generated anyway.
|
|
|
|
$(if $(wildcard .xcompile),,$(eval $(shell ../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
|
|
|
|
.xcompile: ../../util/xcompile/xcompile
|
|
|
|
$< $(XGCCPATH) > $@.tmp
|
|
|
|
\mv -f $@.tmp $@ 2> /dev/null || rm -f $@.tmp $@
|
|
|
|
|
|
|
|
CONFIG_COMPILER_GCC := y
|
|
|
|
ARCH-y := x86_32
|
|
|
|
|
|
|
|
include .xcompile
|
|
|
|
|
|
|
|
CC := $(CC_$(ARCH-y))
|
|
|
|
AS := $(AS_$(ARCH-y))
|
|
|
|
OBJCOPY := $(OBJCOPY_$(ARCH-y))
|
|
|
|
|
2016-03-15 21:29:35 +01:00
|
|
|
LPCC := CC="$(CC)" $(LIBPAYLOAD_OBJ)/bin/lpgcc
|
|
|
|
LPAS := AS="$(AS)" $(LIBPAYLOAD_OBJ)/bin/lpas
|
2015-11-17 06:33:48 +01:00
|
|
|
|
2019-06-27 21:23:38 +02:00
|
|
|
CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wvla -Werror
|
2019-06-29 19:04:42 +02:00
|
|
|
CFLAGS += -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES)
|
2015-11-17 06:33:48 +01:00
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
ifneq ($(strip $(HAVE_DOTCONFIG)),)
|
2008-03-24 16:47:49 +01:00
|
|
|
include $(src)/.config
|
2015-11-17 06:33:48 +01:00
|
|
|
real-all: $(TARGET)
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2019-10-03 02:55:23 +02:00
|
|
|
ifeq ($(CONFIG_LTO),y)
|
|
|
|
CFLAGS += -flto
|
|
|
|
endif
|
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload
|
2016-03-08 20:32:40 +01:00
|
|
|
printf " LPCC $(subst $(CURDIR)/,,$(@)) (LINK)\n"
|
2019-10-03 02:55:23 +02:00
|
|
|
$(LPCC) $(CFLAGS) -o $@ $(OBJS)
|
2015-07-01 00:22:12 +02:00
|
|
|
$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
|
|
|
|
$(OBJCOPY) --strip-debug $@
|
|
|
|
$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(coreinfo_obj)/%.S.o: $(src)/%.S libpayload
|
2016-03-08 20:32:40 +01:00
|
|
|
printf " LPAS $(subst $(CURDIR)/,,$(@))\n"
|
2015-07-01 00:22:12 +02:00
|
|
|
$(LPAS) -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(coreinfo_obj)/%.o: $(src)/%.c libpayload
|
2016-03-08 20:32:40 +01:00
|
|
|
printf " LPCC $(subst $(CURDIR)/,,$(@))\n"
|
2015-07-01 00:22:12 +02:00
|
|
|
$(LPCC) $(CFLAGS) -c -o $@ $<
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2012-12-01 01:04:58 +01:00
|
|
|
else
|
2015-11-17 06:33:48 +01:00
|
|
|
real-all: config
|
2008-03-24 16:47:49 +01:00
|
|
|
endif
|
|
|
|
|
2016-01-25 22:01:55 +01:00
|
|
|
defaultbuild:
|
|
|
|
$(MAKE) olddefconfig
|
|
|
|
$(MAKE) all
|
|
|
|
|
2012-12-01 01:15:36 +01:00
|
|
|
ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
|
|
|
|
libpayload:
|
2016-03-15 21:29:35 +01:00
|
|
|
printf "Found Libpayload $(LIBPAYLOAD_OBJ).\n"
|
2012-12-01 01:15:36 +01:00
|
|
|
else
|
2016-04-15 18:54:23 +02:00
|
|
|
LPOPTS=obj="$(CURDIR)/lpbuild" DOTCONFIG="$(CURDIR)/lp.config"
|
2012-12-01 01:15:36 +01:00
|
|
|
libpayload:
|
2016-03-15 21:29:35 +01:00
|
|
|
printf "Building libpayload @ $(LIBPAYLOAD_PATH).\n"
|
2016-04-15 18:54:23 +02:00
|
|
|
$(MAKE) -C $(LIBPAYLOAD_PATH) $(LPOPTS) distclean coreinfo_obj=$(coreinfo_obj)/libptmp
|
|
|
|
$(MAKE) -C $(LIBPAYLOAD_PATH) $(LPOPTS) defconfig KBUILD_DEFCONFIG=$(LIBPAYLOAD_CONFIG)
|
|
|
|
$(MAKE) -C $(LIBPAYLOAD_PATH) $(LPOPTS) install DESTDIR=$(coreinfo_obj)
|
2012-12-01 01:15:36 +01:00
|
|
|
endif
|
2012-12-01 01:04:58 +01:00
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(coreinfo_obj)/config.h:
|
2015-06-30 01:44:12 +02:00
|
|
|
$(MAKE) oldconfig
|
|
|
|
|
2016-03-08 00:26:51 +01:00
|
|
|
$(shell mkdir -p $(coreinfo_obj) $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
|
2008-03-24 16:47:49 +01:00
|
|
|
|
2017-01-19 23:20:14 +01:00
|
|
|
include $(srck)/Makefile
|
|
|
|
|
|
|
|
.PHONY: $(PHONY) prepare
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2008-03-20 01:11:05 +01:00
|
|
|
clean:
|
2020-08-04 17:04:55 +02:00
|
|
|
rm -rf build lpbuild .xcompile
|
2008-03-24 16:47:49 +01:00
|
|
|
|
|
|
|
distclean: clean
|
2016-04-24 01:33:18 +02:00
|
|
|
rm -f .config* lp.config*
|
2008-03-20 01:11:05 +01:00
|
|
|
|
2017-01-19 23:20:14 +01:00
|
|
|
.PHONY: clean distclean
|
|
|
|
endif
|