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