mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-21 13:57:52 +00:00
110 lines
3.8 KiB
Plaintext
110 lines
3.8 KiB
Plaintext
modules-$(CONFIG_COREBOOT) += coreboot
|
|
|
|
#coreboot_version := git
|
|
#coreboot_repo := https://github.com/osresearch/coreboot
|
|
coreboot_version := 4.7
|
|
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 := d68a83f8f687e8ea212b8c5bb501e24444b57c3f73896042d09628188c851368
|
|
|
|
# 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 := \
|
|
$(MAKE) -C $(build)/$(coreboot_base_dir) \
|
|
oldconfig \
|
|
obj=$(build)/$(coreboot_dir) \
|
|
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
|
|
BUILD_TIMELESS=1 \
|
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
|
|
|
coreboot_target := \
|
|
-C $(build)/$(coreboot_base_dir) \
|
|
obj=$(build)/$(coreboot_dir) \
|
|
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
|
|
BUILD_TIMELESS=1 \
|
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
|
$(MAKE_JOBS)
|
|
|
|
coreboot_output := coreboot.rom
|
|
coreboot_depend += linux initrd
|
|
|
|
COREBOOT_XGCC_REL := $(coreboot_base_dir)/util/crossgcc/xgcc
|
|
COREBOOT_XGCC_PATH := $(build)/$(COREBOOT_XGCC_REL)
|
|
COREBOOT_XGCC := $(COREBOOT_XGCC_PATH)/bin/i386-elf-gcc
|
|
|
|
# hack to force a build dependency on the cross compiler
|
|
coreboot-gcc $(build)/$(coreboot_dir)/.configured: $(COREBOOT_XGCC)
|
|
|
|
ifeq "$(TOOLCHAIN)" ""
|
|
# Force a rebuild of the entire coreboot toolchain
|
|
$(COREBOOT_XGCC): $(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
|
|
else
|
|
# Use the pre-build one from the external toolchain build
|
|
$(COREBOOT_XGCC): $(build)/$(coreboot_base_dir)/.canary
|
|
if [ ! -e "$(TOOLCHAIN)/build/$(COREBOOT_XGCC_REL)" ]; then \
|
|
echo >&2 "ERROR: TOOLCHAIN=$(TOOLCHAIN) does not have coreboot" ; \
|
|
exit 1 ; \
|
|
fi
|
|
if [ ! -e "$(COREBOOT_XGCC_PATH)" ]; then \
|
|
ln -s \
|
|
"$(TOOLCHAIN)/build/$(COREBOOT_XGCC_REL)" \
|
|
"$(COREBOOT_XGCC_PATH)" ; \
|
|
fi
|
|
endif
|
|
|
|
# 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
|
|
|
|
#
|
|
# Helpful target for reconfiguring the coreboot target
|
|
#
|
|
coreboot.menuconfig:
|
|
$(MAKE) \
|
|
-C "$(build)/$(coreboot_base_dir)" \
|
|
DOTCONFIG="../../$(CONFIG_COREBOOT_CONFIG)" \
|
|
menuconfig
|
|
|
|
|
|
# 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 := 443379a2207e350747cbbfe7968ceafddc7dd8563b067476f755ff11791bb5f5
|
|
|
|
## 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
|