2017-09-22 20:17:05 +00:00
|
|
|
modules-$(CONFIG_COREBOOT) += coreboot
|
2016-08-03 01:49:22 +00:00
|
|
|
|
2020-11-25 13:43:07 +00:00
|
|
|
ifeq "$(CONFIG_COREBOOT)" "y"
|
|
|
|
|
2021-07-20 20:48:08 +00:00
|
|
|
CONFIG_COREBOOT_ROM ?= coreboot.rom
|
|
|
|
CONFIG_COREBOOT_BOOTBLOCK ?=
|
|
|
|
|
2020-07-10 13:44:01 +00:00
|
|
|
ifeq "$(CONFIG_COREBOOT_VERSION)" "4.8.1"
|
2020-08-20 19:15:46 +00:00
|
|
|
coreboot_version := 4.8.1
|
|
|
|
coreboot_hash := f0ddf4db0628c1fe1e8348c40084d9cbeb5771400c963fd419cda3995b69ad23
|
|
|
|
coreboot-blobs_hash := 18aa509ae3af005a05d7b1e0b0246dc640249c14fc828f5144b6fd20bb10e295
|
2020-10-18 18:48:25 +00:00
|
|
|
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)
|
2020-12-04 01:15:15 +00:00
|
|
|
else ifeq "$(CONFIG_COREBOOT_VERSION)" "4.13"
|
|
|
|
coreboot_version := 4.13
|
|
|
|
coreboot_hash := 4779da645a25ddebc78f1bd2bd0b740fb1e6479572648d4650042a2b9502856a
|
|
|
|
coreboot-blobs_hash := 060656b46a7859d038ddeec3f7e086e85f146a50b280c4babec23c1188264dc8
|
2020-09-02 18:39:37 +00:00
|
|
|
coreboot_depends := $(if $(CONFIG_PURISM_BLOBS), purism-blobs)
|
2021-11-11 18:14:13 +00:00
|
|
|
else ifeq "$(CONFIG_COREBOOT_VERSION)" "4.15"
|
|
|
|
coreboot_version := 4.15
|
|
|
|
coreboot_hash := 20e6aaa6dd0eaec7753441c799711d1b4630e3ca709536386f2242ac2c8a1ec5
|
|
|
|
coreboot-blobs_hash := c0e2d8006da226208ba274a44895d102cb2879cf139cc67bba5f62e67b871f6d
|
|
|
|
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
|
2020-07-10 13:44:01 +00:00
|
|
|
else
|
2020-08-20 19:15:46 +00:00
|
|
|
$(error "$(BOARD): does not specify coreboot version under CONFIG_COREBOOT_VERSION")
|
2020-07-10 13:44:01 +00:00
|
|
|
endif
|
|
|
|
|
2017-02-01 16:50:52 +00:00
|
|
|
#coreboot_version := git
|
|
|
|
#coreboot_repo := https://github.com/osresearch/coreboot
|
2018-05-02 15:38:39 +00:00
|
|
|
coreboot_base_dir := coreboot-$(coreboot_version)
|
|
|
|
coreboot_dir := $(coreboot_base_dir)/$(BOARD)
|
2017-02-01 16:50:52 +00:00
|
|
|
coreboot_tar := coreboot-$(coreboot_version).tar.xz
|
|
|
|
coreboot_url := https://www.coreboot.org/releases/$(coreboot_tar)
|
2016-08-19 15:31:07 +00:00
|
|
|
|
2020-01-08 16:08:15 +00:00
|
|
|
# coreboot builds are specialized on a per-target basis.
|
2016-11-23 17:11:08 +00:00
|
|
|
# The builds are done in a per-target subdirectory
|
2018-02-05 16:56:15 +00:00
|
|
|
CONFIG_COREBOOT_CONFIG ?= config/coreboot-$(BOARD).config
|
2016-11-23 17:11:08 +00:00
|
|
|
|
2018-05-03 20:47:09 +00:00
|
|
|
# Ensure that touching the config file will force a rebuild
|
|
|
|
$(build)/$(coreboot_dir)/.configured: $(CONFIG_COREBOOT_CONFIG)
|
|
|
|
|
2022-01-28 18:57:48 +00:00
|
|
|
EXTRA_FLAGS ?= -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -Wno-error=packed-not-aligned
|
2017-01-29 01:21:47 +00:00
|
|
|
|
2016-11-23 17:11:08 +00:00
|
|
|
coreboot_configure := \
|
2018-08-13 14:26:08 +00:00
|
|
|
mkdir -p "$(build)/$(coreboot_dir)" \
|
|
|
|
&& cp "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" "$(build)/$(coreboot_dir)/.config" \
|
2020-10-21 15:04:27 +00:00
|
|
|
&& echo 'CONFIG_LOCALVERSION="Heads-$(HEADS_GIT_VERSION)"' >> $(build)/$(coreboot_dir)/.config \
|
|
|
|
&& echo 'CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="$(BOARD)"' >> $(build)/$(coreboot_dir)/.config \
|
2018-08-13 14:26:08 +00:00
|
|
|
&& $(MAKE) olddefconfig \
|
|
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
|
|
obj="$(build)/$(coreboot_dir)" \
|
2018-10-27 21:03:45 +00:00
|
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
2017-02-01 18:39:56 +00:00
|
|
|
BUILD_TIMELESS=1 \
|
2017-01-29 01:21:47 +00:00
|
|
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
|
|
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
2016-11-23 17:11:08 +00:00
|
|
|
|
2020-01-08 16:08:15 +00:00
|
|
|
COREBOOT_IASL="$(build)/$(coreboot_base_dir)/util/crossgcc/xgcc/bin/iasl"
|
|
|
|
|
|
|
|
# coreboot 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)" \
|
|
|
|
|
2016-11-23 17:11:08 +00:00
|
|
|
coreboot_target := \
|
2018-08-13 14:26:08 +00:00
|
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
|
|
obj="$(build)/$(coreboot_dir)" \
|
2020-01-08 16:08:15 +00:00
|
|
|
CROSS="$(dir $(CROSS))i386-linux-musl-" \
|
|
|
|
IASL="$(COREBOOT_IASL)" \
|
2018-10-27 21:03:45 +00:00
|
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
2017-02-01 18:39:56 +00:00
|
|
|
BUILD_TIMELESS=1 \
|
2017-01-29 01:21:47 +00:00
|
|
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
|
|
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
2017-03-21 18:29:07 +00:00
|
|
|
$(MAKE_JOBS)
|
2016-11-23 17:11:08 +00:00
|
|
|
|
2021-07-20 20:48:08 +00:00
|
|
|
coreboot_output := $(CONFIG_COREBOOT_ROM)
|
|
|
|
coreboot_output += $(CONFIG_COREBOOT_BOOTBLOCK)
|
2020-01-08 16:08:15 +00:00
|
|
|
coreboot_depend += linux initrd $(musl_dep)
|
2018-09-18 19:59:48 +00:00
|
|
|
|
2020-12-22 21:25:09 +00:00
|
|
|
COREBOOT_TOOLCHAIN="$(build)/$(coreboot_base_dir)/.xcompile"
|
|
|
|
$(COREBOOT_TOOLCHAIN): $(build)/$(coreboot_base_dir)/.canary
|
2021-01-04 04:07:51 +00:00
|
|
|
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=$(CPUS) crossgcc-i386
|
2020-12-22 21:25:09 +00:00
|
|
|
|
2022-01-28 23:12:58 +00:00
|
|
|
$(build)/$(coreboot_dir)/.configured: $(COREBOOT_TOOLCHAIN)
|
2018-05-02 15:38:39 +00:00
|
|
|
|
|
|
|
# Force a rebuild if the inputs have changed
|
|
|
|
$(build)/$(coreboot_dir)/.build: \
|
|
|
|
$(build)/$(BOARD)/bzImage \
|
|
|
|
$(build)/$(BOARD)/initrd.cpio.xz \
|
|
|
|
|
2018-05-02 18:53:54 +00:00
|
|
|
# This produces a ROM image that is written with the flashrom program
|
2020-10-21 15:04:27 +00:00
|
|
|
ifneq ($(CONFIG_COREBOOT),)
|
2021-07-20 20:48:08 +00:00
|
|
|
|
2020-10-21 15:04:27 +00:00
|
|
|
$(build)/$(BOARD)/$(CB_OUTPUT_FILE): $(build)/$(coreboot_dir)/.build
|
2021-07-20 20:48:08 +00:00
|
|
|
# Use coreboot.rom, because custom output files might not be processed by cbfstool
|
2018-05-02 18:53:54 +00:00
|
|
|
"$(build)/$(coreboot_dir)/cbfstool" "$(dir $<)coreboot.rom" print
|
2021-07-20 20:48:08 +00:00
|
|
|
$(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),$@)
|
2018-05-02 18:53:54 +00:00
|
|
|
@touch $@ # update the time stamp
|
2020-10-21 15:04:27 +00:00
|
|
|
endif
|
2016-08-14 20:03:11 +00:00
|
|
|
|
2021-07-20 20:48:08 +00:00
|
|
|
endif
|
|
|
|
|
2018-02-13 18:20:04 +00:00
|
|
|
#
|
|
|
|
# Helpful target for reconfiguring the coreboot target
|
|
|
|
#
|
|
|
|
coreboot.menuconfig:
|
|
|
|
$(MAKE) \
|
2018-05-02 15:38:39 +00:00
|
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
2018-08-13 14:26:08 +00:00
|
|
|
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
|
2018-02-13 18:20:04 +00:00
|
|
|
menuconfig
|
|
|
|
|
2018-08-13 14:26:08 +00:00
|
|
|
# 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
|
|
|
|
|
2017-02-01 16:50:52 +00:00
|
|
|
|
|
|
|
# if we are not building from a git checkout,
|
|
|
|
# we must also download the coreboot-blobs tree
|
2018-02-05 16:56:15 +00:00
|
|
|
ifneq "$(coreboot_version)" "git"
|
|
|
|
|
2017-02-01 16:50:52 +00:00
|
|
|
coreboot_depends += coreboot-blobs
|
2017-03-31 15:18:46 +00:00
|
|
|
modules-y += coreboot-blobs
|
2017-02-01 16:50:52 +00:00
|
|
|
|
|
|
|
coreboot-blobs_version := $(coreboot_version)
|
|
|
|
coreboot-blobs_tar := coreboot-blobs-$(coreboot-blobs_version).tar.xz
|
2020-05-13 20:51:12 +00:00
|
|
|
coreboot-blobs_url := https://www.coreboot.org/releases/$(coreboot-blobs_tar)
|
|
|
|
|
|
|
|
ifeq "$(CONFIG_COREBOOT_VERSION)" "4.8.1"
|
2020-08-20 19:15:46 +00:00
|
|
|
coreboot-blobs_tar_opt := --strip 3
|
|
|
|
coreboot-blobs_dir := coreboot-$(coreboot-blobs_version)/3rdparty/blobs
|
2020-05-13 20:51:12 +00:00
|
|
|
else
|
2020-08-20 19:15:46 +00:00
|
|
|
coreboot-blobs_tar_opt := --strip 2
|
|
|
|
coreboot-blobs_dir := coreboot-$(coreboot-blobs_version)/3rdparty
|
2020-05-13 20:51:12 +00:00
|
|
|
endif
|
2017-02-01 16:50:52 +00:00
|
|
|
|
2016-08-14 20:03:11 +00:00
|
|
|
## there is nothing to build for the blobs, this should be
|
|
|
|
## made easier to make happen
|
2017-02-01 16:50:52 +00:00
|
|
|
coreboot-blobs_output := .built
|
|
|
|
coreboot-blobs_configure := echo -e 'all:\n\ttouch .built' > Makefile
|
2016-08-14 20:03:11 +00:00
|
|
|
|
2017-02-01 16:50:52 +00:00
|
|
|
endif
|
2020-11-25 13:43:07 +00:00
|
|
|
endif
|