mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-24 07:06:42 +00:00
8150e300ee
patches/coreboot-4.15: remove patches for coreboot 4.15 No boards depend on it and is affected by CVE-2022-29264 Signed-off-by: Daniel Pineda <daniel.pineda@puri.sm>
177 lines
6.4 KiB
Makefile
177 lines
6.4 KiB
Makefile
modules-$(CONFIG_COREBOOT) += coreboot
|
|
|
|
ifeq "$(CONFIG_COREBOOT)" "y"
|
|
|
|
CONFIG_COREBOOT_ROM ?= coreboot.rom
|
|
CONFIG_COREBOOT_BOOTBLOCK ?=
|
|
|
|
ifeq "$(CONFIG_TARGET_ARCH)" "x86"
|
|
COREBOOT_TARGET := i386
|
|
LINUX_IMAGE_FILE := bzImage
|
|
else ifeq "$(CONFIG_TARGET_ARCH)" "ppc64"
|
|
COREBOOT_TARGET := ppc64
|
|
LINUX_IMAGE_FILE := zImage
|
|
else
|
|
$(error "$(CONFIG_TARGET_ARCH) target isn't supported by this module")
|
|
endif
|
|
|
|
ifeq "$(CONFIG_COREBOOT_VERSION)" "4.8.1"
|
|
coreboot_version := 4.8.1
|
|
coreboot_hash := f0ddf4db0628c1fe1e8348c40084d9cbeb5771400c963fd419cda3995b69ad23
|
|
coreboot-blobs_hash := 18aa509ae3af005a05d7b1e0b0246dc640249c14fc828f5144b6fd20bb10e295
|
|
else ifeq "$(CONFIG_COREBOOT_VERSION)" "4.11"
|
|
coreboot_version := 4.11
|
|
coreboot_hash := 97fd859b4c39a25534fe33c30eb86e54a233952e08a024c55858d11598a8ad87
|
|
coreboot-blobs_hash := aa7855c5bd385b3360dadc043ea6bc93f564e6e4840d9b3ee5b9e696bbd055db
|
|
coreboot_depends := $(if $(CONFIG_PURISM_BLOBS), purism-blobs)
|
|
else ifeq "$(CONFIG_COREBOOT_VERSION)" "4.13"
|
|
coreboot_version := 4.13
|
|
coreboot_hash := 4779da645a25ddebc78f1bd2bd0b740fb1e6479572648d4650042a2b9502856a
|
|
coreboot-blobs_hash := 060656b46a7859d038ddeec3f7e086e85f146a50b280c4babec23c1188264dc8
|
|
coreboot_depends := $(if $(CONFIG_PURISM_BLOBS), purism-blobs)
|
|
else ifeq "$(CONFIG_COREBOOT_VERSION)" "4.17"
|
|
coreboot_version := 4.17
|
|
coreboot_hash := 95da11d1c6a450385101a68799258a398ce965f4e46cce6fe8d5ebd74e50c125
|
|
coreboot-blobs_hash := a2277fe7a2b2aab5da0aa335158460e00b852382f6736f2179992805702eb607
|
|
coreboot_depends := $(if $(CONFIG_PURISM_BLOBS), purism-blobs)
|
|
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned -Wno-error=address-of-packed-member
|
|
else ifeq "$(CONFIG_COREBOOT_VERSION)" "talos_2"
|
|
coreboot_version = git
|
|
coreboot_commit_hash = 2207bbcccba31ad89cf21607b0d8d05d8dc47c03
|
|
coreboot_repo := https://github.com/Dasharo/coreboot
|
|
|
|
else
|
|
$(error "$(BOARD): does not specify coreboot version under CONFIG_COREBOOT_VERSION")
|
|
endif
|
|
|
|
#coreboot_version := git
|
|
#coreboot_repo := https://github.com/osresearch/coreboot
|
|
coreboot_base_dir := coreboot-$(coreboot_version)
|
|
coreboot_dir := $(coreboot_base_dir)/$(BOARD)
|
|
coreboot_tar := coreboot-$(coreboot_version).tar.xz
|
|
coreboot_url := https://www.coreboot.org/releases/$(coreboot_tar)
|
|
|
|
# coreboot builds are specialized on a per-target basis.
|
|
# The builds are done in a per-target subdirectory
|
|
CONFIG_COREBOOT_CONFIG ?= config/coreboot-$(BOARD).config
|
|
|
|
# Ensure that touching the config file will force a rebuild
|
|
$(build)/$(coreboot_dir)/.configured: $(CONFIG_COREBOOT_CONFIG)
|
|
|
|
EXTRA_FLAGS ?= -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned
|
|
|
|
coreboot_configure := \
|
|
mkdir -p "$(build)/$(coreboot_dir)" \
|
|
&& $(call install_config,$(pwd)/$(CONFIG_COREBOOT_CONFIG),$(build)/$(coreboot_dir)/.config) \
|
|
&& echo 'CONFIG_LOCALVERSION="Heads-$(HEADS_GIT_VERSION)"' >> $(build)/$(coreboot_dir)/.config \
|
|
&& echo 'CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="$(BOARD)"' >> $(build)/$(coreboot_dir)/.config \
|
|
&& $(MAKE) olddefconfig \
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
obj="$(build)/$(coreboot_dir)" \
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
|
BUILD_TIMELESS=1 \
|
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
|
|
|
COREBOOT_IASL="$(build)/$(coreboot_base_dir)/util/crossgcc/xgcc/bin/iasl"
|
|
|
|
# coreboot for x86 is built with the 32-bit compiler; ideally we could use the
|
|
# same x86_64-linux-musl -m32 to build it, but this causes some link errors that
|
|
# need to be tracked down.
|
|
# CROSS="$(CROSS)" \
|
|
|
|
ifeq "$(CONFIG_TARGET_ARCH)" "x86"
|
|
COREBOOT_CROSS := $(dir $(CROSS))i386-linux-musl-
|
|
else
|
|
COREBOOT_CROSS := $(CROSS)
|
|
endif
|
|
|
|
coreboot_target := \
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
obj="$(build)/$(coreboot_dir)" \
|
|
CROSS="$(COREBOOT_CROSS)" \
|
|
IASL="$(COREBOOT_IASL)" \
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
|
BUILD_TIMELESS=1 \
|
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
|
$(MAKE_JOBS)
|
|
|
|
coreboot_output := $(CONFIG_COREBOOT_ROM)
|
|
coreboot_output += $(CONFIG_COREBOOT_BOOTBLOCK)
|
|
coreboot_depend += linux initrd $(musl_dep)
|
|
|
|
COREBOOT_TOOLCHAIN="$(build)/$(coreboot_base_dir)/.xcompile"
|
|
$(COREBOOT_TOOLCHAIN): $(build)/$(coreboot_base_dir)/.canary
|
|
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=$(CPUS) "crossgcc-$(COREBOOT_TARGET)"
|
|
|
|
$(build)/$(coreboot_dir)/.configured: $(COREBOOT_TOOLCHAIN)
|
|
|
|
# Force a rebuild if the inputs have changed
|
|
$(build)/$(coreboot_dir)/.build: \
|
|
$(build)/$(BOARD)/$(LINUX_IMAGE_FILE) \
|
|
$(build)/$(BOARD)/initrd.cpio.xz \
|
|
|
|
# This produces a ROM image that is written with the flashrom program
|
|
ifneq ($(CONFIG_COREBOOT),)
|
|
|
|
$(build)/$(BOARD)/$(CB_OUTPUT_FILE): $(build)/$(coreboot_dir)/.build
|
|
# Use coreboot.rom, because custom output files might not be processed by cbfstool
|
|
"$(build)/$(coreboot_dir)/cbfstool" "$(dir $<)coreboot.rom" print
|
|
$(call do-copy,$(dir $<)$(CONFIG_COREBOOT_ROM),$@)
|
|
@touch $@ # update the time stamp
|
|
|
|
ifneq ($(CONFIG_COREBOOT_BOOTBLOCK),)
|
|
$(build)/$(BOARD)/$(CB_BOOTBLOCK_FILE): $(build)/$(coreboot_dir)/.build
|
|
$(call do-copy,$(dir $<)$(CONFIG_COREBOOT_BOOTBLOCK),$@)
|
|
@touch $@ # update the time stamp
|
|
endif
|
|
|
|
endif
|
|
|
|
#
|
|
# Helpful target for reconfiguring the coreboot target
|
|
#
|
|
coreboot.menuconfig:
|
|
$(MAKE) \
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
|
menuconfig
|
|
|
|
# The config file in the repo is stored as a "defconfig" format
|
|
# which only includes the options that have changed from the defaults.
|
|
coreboot.saveconfig:
|
|
$(MAKE) \
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
|
DEFCONFIG="$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
|
|
savedefconfig
|
|
|
|
|
|
# if we are not building from a git checkout,
|
|
# we must also download the coreboot-blobs tree
|
|
ifneq "$(coreboot_version)" "git"
|
|
|
|
coreboot_depends += coreboot-blobs
|
|
modules-y += coreboot-blobs
|
|
|
|
coreboot-blobs_version := $(coreboot_version)
|
|
coreboot-blobs_tar := coreboot-blobs-$(coreboot-blobs_version).tar.xz
|
|
coreboot-blobs_url := https://www.coreboot.org/releases/$(coreboot-blobs_tar)
|
|
|
|
ifeq "$(CONFIG_COREBOOT_VERSION)" "4.8.1"
|
|
coreboot-blobs_tar_opt := --strip 3
|
|
coreboot-blobs_dir := coreboot-$(coreboot-blobs_version)/3rdparty/blobs
|
|
else
|
|
coreboot-blobs_tar_opt := --strip 2
|
|
coreboot-blobs_dir := coreboot-$(coreboot-blobs_version)/3rdparty
|
|
endif
|
|
|
|
## there is nothing to build for the blobs, this should be
|
|
## made easier to make happen
|
|
coreboot-blobs_output := .built
|
|
coreboot-blobs_configure := echo -e 'all:\n\ttouch .built' > Makefile
|
|
|
|
endif
|
|
endif
|