heads/modules/coreboot

99 lines
3.5 KiB
Plaintext
Raw Normal View History

modules-$(CONFIG_COREBOOT) += coreboot
#coreboot_version := git
#coreboot_repo := https://github.com/osresearch/coreboot
coreboot_version := 4.8.1
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_hash := f0ddf4db0628c1fe1e8348c40084d9cbeb5771400c963fd419cda3995b69ad23
# 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
coreboot_configure := \
2018-08-13 14:26:08 +00: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)" \
BUILD_TIMELESS=1 \
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
coreboot_target := \
2018-08-13 14:26:08 +00:00
-C "$(build)/$(coreboot_base_dir)" \
obj="$(build)/$(coreboot_dir)" \
BUILD_TIMELESS=1 \
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
2017-03-21 18:29:07 +00:00
$(MAKE_JOBS)
coreboot_output := coreboot.rom
coreboot_depend += linux initrd
# hack to force a build dependency on the cross compiler
$(build)/$(coreboot_dir)/.configured: $(build)/$(coreboot_base_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc
$(build)/$(coreboot_base_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc: $(build)/$(coreboot_base_dir)/.canary
echo '******* Building crossgcc-i386 (this might take a while) ******'
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=`nproc` crossgcc-i386
#echo '******* Building crossgcc-arm (this might take a while) ******'
#$(MAKE) -C "$(build)/$(coreboot_base_dir)" crossgcc-arm
# Force a rebuild if the inputs have changed
$(build)/$(coreboot_dir)/.build: \
$(build)/$(BOARD)/bzImage \
$(build)/$(BOARD)/initrd.cpio.xz \
# 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
2018-02-13 18:20:04 +00:00
#
# Helpful target for reconfiguring the coreboot target
#
coreboot.menuconfig:
$(MAKE) \
-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
# 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_dir := coreboot-$(coreboot-blobs_version)/3rdparty/blobs
coreboot-blobs_url := https://www.coreboot.org/releases/$(coreboot-blobs_tar)
coreboot-blobs_hash := 18aa509ae3af005a05d7b1e0b0246dc640249c14fc828f5144b6fd20bb10e295
## 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