Make coreboot building modular to support multiple boards.

This touches most of the module configurations since the
coreboot build process had to add a few new features.
The Linux kernel could make use of it as well if we need
separate x230/chell/qemu kernels, for instance.
This commit is contained in:
Trammell Hudson 2016-11-23 12:11:08 -05:00
parent cc1c198810
commit 4fbd6ca58b
Failed to extract signature
12 changed files with 68 additions and 23 deletions

View File

@ -4,10 +4,15 @@ packages := $(pwd)/packages
build := $(pwd)/build
config := $(pwd)/build
all: x230.rom
# Currently supported targets are x230, chell and qemu
TARGET ?= x230
all: $(TARGET).rom
# Bring in all of the module definitions;
# these are the external pieces that will be downloaded and built
# as part of creating the Heads firmware image.
include modules/*
all: $(modules)
@ -63,7 +68,7 @@ define define_module =
endif
# Copy our stored config file into the unpacked directory
$(build)/$($1_dir)/.config: config/$1.config $(build)/$($1_dir)/.canary
$(build)/$($1_dir)/.config: config/$($1_config) $(build)/$($1_dir)/.canary
cp "$$<" "$$@"
# Use the module's configure variable to build itself
@ -177,14 +182,14 @@ initrd_lib_install: $(initrd_bins) $(initrd_libs)
# initrd image creation
#
# The initrd is constructed from various bits and pieces
# Note the touch and sort operation on the find output -- this
# ensures that the files always have the same timestamp and
# appear in the same order.
# The cpio-clean program is used ensure that the files
# always have the same timestamp and appear in the same order.
#
# If there is in /dev/console, initrd can't startup.
# If there is no /dev/console, initrd can't startup.
# We have to force it to be included into the cpio image.
# Since we are picking up the system's /dev/console, the
# timestamp will not be reproducible.
# Since we are picking up the system's /dev/console, there
# is a chance the build will not be reproducible (although
# unlikely that their device file has a different major/minor)
#
#
initrd.cpio: $(initrd_bins) $(initrd_libs) initrd_lib_install
@ -224,6 +229,8 @@ $(call outputs,coreboot): $(build)/$(coreboot_dir)/bzImage
#export CC := $(XGCC)/bin/x86_64-elf-gcc
#export LDFLAGS := -L/lib/x86_64-linux-gnu
x230.rom: $(build)/$(coreboot_dir)/build/coreboot.rom
x230.rom: $(build)/$(coreboot_dir)/x230/coreboot.rom
dd if="$<" of="$@" bs=1M skip=8
qemu.rom: $(build)/$(coreboot_dir)/qemu/coreboot.rom
cp -a "$<" "$@"

View File

@ -8,7 +8,6 @@
#
CONFIG_LOCALVERSION="-heads"
CONFIG_CBFS_PREFIX="fallback"
# CONFIG_MULTIPLE_CBFS_INSTANCES is not set
CONFIG_COMPILER_GCC=y
# CONFIG_COMPILER_LLVM_CLANG is not set
# CONFIG_ANY_TOOLCHAIN is not set
@ -36,7 +35,6 @@ CONFIG_BOOTBLOCK_SOURCE="bootblock_simple.c"
# CONFIG_GENERIC_GPIO_LIB is not set
# CONFIG_BOARD_ID_AUTO is not set
# CONFIG_BOARD_ID_MANUAL is not set
CONFIG_DEVICETREE="devicetree.cb"
# CONFIG_RAM_CODE_SUPPORT is not set
# CONFIG_BOOTSPLASH_IMAGE is not set
@ -68,6 +66,7 @@ CONFIG_DEVICETREE="devicetree.cb"
# CONFIG_VENDOR_DIGITALLOGIC is not set
# CONFIG_VENDOR_DMP is not set
# CONFIG_VENDOR_ECS is not set
# CONFIG_VENDOR_ELMEX is not set
CONFIG_VENDOR_EMULATION=y
# CONFIG_VENDOR_ESD is not set
# CONFIG_VENDOR_GETAC is not set
@ -114,7 +113,7 @@ CONFIG_MAINBOARD_DIR="emulation/qemu-q35"
CONFIG_MAINBOARD_PART_NUMBER="QEMU x86 q35/ich9"
CONFIG_MAINBOARD_VENDOR="Emulation"
CONFIG_MAX_CPUS=1
CONFIG_CACHE_ROM_SIZE_OVERRIDE=0
CONFIG_CACHE_ROM_SIZE_OVERRIDE=0x0
CONFIG_CBFS_SIZE=0x400000
CONFIG_UART_FOR_CONSOLE=0
# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set
@ -138,6 +137,7 @@ CONFIG_BOARD_EMULATION_QEMU_X86_Q35=y
CONFIG_BOARD_EMULATION_QEMU_X86=y
# CONFIG_POST_DEVICE is not set
CONFIG_DRIVERS_PS2_KEYBOARD=y
CONFIG_DEVICETREE="devicetree.cb"
CONFIG_TTYS0_LCS=3
# CONFIG_CONSOLE_POST is not set
CONFIG_DRIVERS_UART_8250IO=y
@ -188,6 +188,8 @@ CONFIG_UART_PCI_ADDR=0
CONFIG_HPET_MIN_TICKS=0x80
# CONFIG_SOC_MARVELL_ARMADA38X is not set
# CONFIG_SOC_MARVELL_BG4CD is not set
# CONFIG_SOC_MARVELL_MVMAP2315 is not set
CONFIG_TTYS0_BAUD=115200
# CONFIG_SOC_MEDIATEK_MT8173 is not set
# CONFIG_SOC_NVIDIA_TEGRA124 is not set
# CONFIG_SOC_NVIDIA_TEGRA210 is not set
@ -239,6 +241,7 @@ CONFIG_CPU_MICROCODE_CBFS_GENERATE=y
# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER is not set
# CONFIG_CPU_MICROCODE_CBFS_NONE is not set
# CONFIG_CPU_MICROCODE_MULTIPLE_FILES is not set
CONFIG_CPU_UCODE_BINARIES=""
#
# Northbridge
@ -266,6 +269,7 @@ CONFIG_SOUTHBRIDGE_INTEL_I82801IX=y
#
# Super I/O
#
# CONFIG_SUPERIO_NUVOTON_NCT6776_COM_A is not set
#
# Embedded Controllers
@ -273,10 +277,10 @@ CONFIG_SOUTHBRIDGE_INTEL_I82801IX=y
CONFIG_VBOOT_VBNV_OFFSET=0x26
# CONFIG_VBOOT_VBNV_CMOS is not set
# CONFIG_VBOOT_VBNV_EC is not set
# CONFIG_VBOOT_VBNV_FLASH is not set
# CONFIG_VBOOT is not set
# CONFIG_MAINBOARD_HAS_CHROMEOS is not set
# CONFIG_UEFI_2_4_BINDING is not set
# CONFIG_UDK_2015_BINDING is not set
# CONFIG_USE_SIEMENS_HWILIB is not set
# CONFIG_ARCH_ARM is not set
# CONFIG_ARCH_BOOTBLOCK_ARM is not set
@ -293,6 +297,10 @@ CONFIG_VBOOT_VBNV_OFFSET=0x26
# CONFIG_ARCH_RAMSTAGE_ARMV7 is not set
# CONFIG_ARCH_BOOTBLOCK_ARMV7_M is not set
# CONFIG_ARCH_VERSTAGE_ARMV7_M is not set
# CONFIG_ARCH_BOOTBLOCK_ARMV7_R is not set
# CONFIG_ARCH_VERSTAGE_ARMV7_R is not set
# CONFIG_ARCH_ROMSTAGE_ARMV7_R is not set
# CONFIG_ARCH_RAMSTAGE_ARMV7_R is not set
# CONFIG_ARM_LPAE is not set
# CONFIG_ARCH_ARM64 is not set
# CONFIG_ARCH_BOOTBLOCK_ARM64 is not set
@ -384,6 +392,7 @@ CONFIG_SUBSYSTEM_DEVICE_ID=0x0000
# CONFIG_SPI_FLASH is not set
# CONFIG_HAVE_SPI_CONSOLE_SUPPORT is not set
CONFIG_DRIVERS_UART=y
# CONFIG_DRIVERS_UART_8250IO_SKIP_INIT is not set
# CONFIG_NO_UART_ON_SUPERIO is not set
# CONFIG_UART_OVERRIDE_INPUT_CLOCK_DIVIDER is not set
# CONFIG_UART_OVERRIDE_REFCLK is not set
@ -399,6 +408,8 @@ CONFIG_DRIVERS_EMULATION_QEMU_BOCHS=y
# CONFIG_SMBIOS_PROVIDED_BY_MOBO is not set
# CONFIG_DRIVERS_I2C_PCF8523 is not set
# CONFIG_DRIVERS_I2C_RTD2132 is not set
# CONFIG_MAINBOARD_HAS_I2C_TPM_CR50 is not set
# CONFIG_DRIVER_I2C_TPM_ACPI is not set
# CONFIG_INTEL_DP is not set
# CONFIG_INTEL_DDI is not set
# CONFIG_INTEL_EDID is not set
@ -420,6 +431,10 @@ CONFIG_DRIVERS_MC146818=y
# CONFIG_DRIVER_XPOWERS_AXP209 is not set
# CONFIG_ACPI_SATA_GENERATOR is not set
# CONFIG_ACPI_INTEL_HARDWARE_SLEEP_VALUES is not set
# CONFIG_BOOT_DEVICE_NOT_SPI_FLASH is not set
CONFIG_BOOT_DEVICE_SPI_FLASH=y
CONFIG_BOOT_DEVICE_MEMORY_MAPPED=y
# CONFIG_BOOT_DEVICE_SUPPORTS_WRITES is not set
# CONFIG_RTC is not set
# CONFIG_TPM is not set
CONFIG_STACK_SIZE=0x1000
@ -447,7 +462,6 @@ CONFIG_CONSOLE_SERIAL_115200=y
# CONFIG_CONSOLE_SERIAL_38400 is not set
# CONFIG_CONSOLE_SERIAL_19200 is not set
# CONFIG_CONSOLE_SERIAL_9600 is not set
CONFIG_TTYS0_BAUD=115200
# CONFIG_SPKMODEM is not set
# CONFIG_CONSOLE_NE2K is not set
CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000
@ -535,7 +549,6 @@ CONFIG_LINUX_INITRD=""
# CONFIG_DEBUG_BOOT_STATE is not set
# CONFIG_ENABLE_APIC_EXT_ID is not set
CONFIG_WARNINGS_ARE_ERRORS=y
CONFIG_IASL_WARNINGS_ARE_ERRORS=y
# CONFIG_POWER_BUTTON_DEFAULT_ENABLE is not set
# CONFIG_POWER_BUTTON_DEFAULT_DISABLE is not set
# CONFIG_POWER_BUTTON_FORCE_ENABLE is not set

View File

@ -68,6 +68,7 @@ CONFIG_MEASURED_BOOT=y
# CONFIG_VENDOR_DIGITALLOGIC is not set
# CONFIG_VENDOR_DMP is not set
# CONFIG_VENDOR_ECS is not set
# CONFIG_VENDOR_ELMEX is not set
# CONFIG_VENDOR_EMULATION is not set
# CONFIG_VENDOR_ESD is not set
# CONFIG_VENDOR_GETAC is not set
@ -114,7 +115,7 @@ CONFIG_MAINBOARD_DIR="lenovo/x230"
CONFIG_MAINBOARD_PART_NUMBER="ThinkPad X230"
CONFIG_MAINBOARD_VENDOR="LENOVO"
CONFIG_MAX_CPUS=8
CONFIG_CACHE_ROM_SIZE_OVERRIDE=0
CONFIG_CACHE_ROM_SIZE_OVERRIDE=0x0
CONFIG_CBFS_SIZE=0x400000
CONFIG_UART_FOR_CONSOLE=0
CONFIG_VGA_BIOS_ID="8086,0166"
@ -137,7 +138,7 @@ CONFIG_ID_SECTION_OFFSET=0x80
CONFIG_USBDEBUG_HCD_INDEX=2
CONFIG_IFD_BIOS_SECTION=""
CONFIG_IFD_ME_SECTION=""
CONFIG_TPM_PIRQ=0
CONFIG_TPM_PIRQ=0x0
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
CONFIG_DRIVERS_PS2_KEYBOARD=y
CONFIG_DEVICETREE="devicetree.cb"
@ -312,6 +313,7 @@ CONFIG_SOUTHBRIDGE_INTEL_COMMON_GPIO=y
#
# Super I/O
#
# CONFIG_SUPERIO_NUVOTON_NCT6776_COM_A is not set
#
# Embedded Controllers
@ -461,6 +463,7 @@ CONFIG_SPI_FLASH_WINBOND=y
# CONFIG_SPI_FLASH_FAST_READ_DUAL_OUTPUT_3B is not set
# CONFIG_HAVE_SPI_CONSOLE_SUPPORT is not set
CONFIG_DRIVERS_UART=y
# CONFIG_DRIVERS_UART_8250IO_SKIP_INIT is not set
CONFIG_NO_UART_ON_SUPERIO=y
# CONFIG_UART_OVERRIDE_INPUT_CLOCK_DIVIDER is not set
# CONFIG_UART_OVERRIDE_REFCLK is not set

View File

@ -7,5 +7,6 @@ busybox_url := https://busybox.net/downloads/$(busybox_tar)
busybox_hash := 5a0fe06885ee1b805fb459ab6aaa023fe4f2eccee4fb8c0fd9a6c17c0daca2fc
busybox_configure := make oldconfig
busybox_config := busybox.config
busybox_output := busybox

View File

@ -9,14 +9,26 @@ coreboot_dir := coreboot-$(coreboot_version)
coreboot_repo := https://github.com/osresearch/coreboot
coreboot_configure := make oldconfig
coreboot_output := build/coreboot.rom
# Coreboot builds are specialized on a per-target basis.
# The builds are done in a per-target subdirectory
coreboot_config := coreboot-$(TARGET).config
coreboot_configure := \
make oldconfig obj=./$(TARGET) DOTCONFIG=../../config/coreboot-$(TARGET).config
coreboot_target := \
obj=./$(TARGET) DOTCONFIG=../../config/coreboot-$(TARGET).config -j 8
coreboot_output := $(TARGET)/coreboot.rom
# hack to force a build dependency on the cross compiler
$(build)/$(coreboot_dir)/.configured: $(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/iasl
$(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/iasl:
echo '******* Building gcc (this might take a while) ******'
$(build)/$(coreboot_dir)/.configured: $(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc
$(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc:
echo '******* Building crossgcc-i386 (this might take a while) ******'
time make -C "$(build)/$(coreboot_dir)" crossgcc-i386
#echo '******* Building crossgcc-arm (this might take a while) ******'
#time make -C "$(build)/$(coreboot_dir)" crossgcc-arm
# The coreboot-blobs must be unpacked before we can build coreboot
# if we are using a tar file; git checkout will clone the submodule.

View File

@ -7,4 +7,5 @@ cryptsetup_url := https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptse
cryptsetup_hash := dbb35dbf5f0c1749168c86c913fe98e872247bfc8425314b494c2423e7e43342
cryptsetup_configure := ./configure
cryptsetup_config := cryptsetup.config
cryptsetup_output :=

View File

@ -8,3 +8,4 @@ kexec_hash := cc7b60dad0da202004048a6179d8a53606943062dd627a2edba45a8ea3a85135
kexec_configure := ./configure
kexec_output := build/sbin/kexec
kexec_config := kexec.config

View File

@ -12,3 +12,5 @@ linux_hash := $(linux-$(linux_version)_hash)
linux_configure := make oldconfig
linux_output := arch/x86/boot/bzImage
linux_config := linux.config
linux_target := -j 8 bzImage

View File

@ -11,3 +11,4 @@ mbedtls_libraries := \
mbedtls_configure :=
mbedtls_target := SHARED=1
mbedtls_config := mbedtls.config

View File

@ -8,3 +8,4 @@ qrencode_hash := e794e26a96019013c0e3665cb06b18992668f352c5553d0a553f5d144f7f2a7
qrencode_output := .libs/libqrencode.so.$(qrencode_version)
qrencode_configure := ./configure --without-tools
qrencode_config := qrencode.config

View File

@ -42,3 +42,4 @@ tpmtotp_libraries := \
libtpm/libtpm.so \
tpmtotp_configure :=
tpmtotp_config := tpmtotp.config

View File

@ -10,3 +10,5 @@ xen_hash := 02badfce9a037bd1bd4a94210c1f6b85467746216c71795805102b514bcf1fc4
xen_output := xen.gz
xen_configure :=
xen_target := -j 8
xen_config := xen.config