parallel make fixes and hacks, which seem to work and reduce excessive remaking (issue #394)

This commit is contained in:
Trammell hudson 2018-05-02 11:38:39 -04:00
parent 8108e419fe
commit a772b27e5d
Failed to extract signature
14 changed files with 152 additions and 144 deletions

145
Makefile
View File

@ -65,9 +65,11 @@ endif
# Create a temporary directory for the initrd
initrd_dir := $(shell mktemp -d)
initrd_lib_dir := $(initrd_dir)/lib
initrd_bin_dir := $(initrd_dir)/bin
initrd_dir := $(BOARD)
initrd_tmp_dir := $(shell mktemp -d)
initrd_lib_dir := $(initrd_tmp_dir)/lib
initrd_bin_dir := $(initrd_tmp_dir)/bin
modules-y += initrd
$(shell mkdir -p "$(initrd_lib_dir)" "$(initrd_bin_dir)")
@ -112,11 +114,8 @@ else
$(error "$(BOARD): neither CONFIG_COREBOOT nor CONFIG_LINUXBOOT is set?")
endif
# helpful targets for common uses
linux: $(build)/$(BOARD)/bzImage
cpio: $(build)/$(BOARD)/initrd.cpio.xz
# Disable all built in rules
.INTERMEDIATE:
.SUFFIXES:
FORCE:
@ -133,10 +132,6 @@ endef
# as part of creating the Heads firmware image.
include modules/*
# These will be built via their intermediate targets
# This increases the build time, so it is commented out for now
#all: $(foreach m,$(modules-y),$m.intermediate)
define bins =
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_output)))
endef
@ -155,7 +150,7 @@ endef
# Build a cpio from a directory
#
define do-cpio =
$(call do,CPIO,$1,\
$(call do,CPIO ,$1,\
( cd "$2"; \
find . \
| cpio \
@ -169,17 +164,20 @@ define do-cpio =
@if ! cmp --quiet "$1.tmp" "$1" ; then \
mv "$1.tmp" "$1" ; \
else \
echo "$(DATE) UNCHANGED $(1:$(pwd)/%=%)" ; \
rm "$1.tmp" ; \
fi
endef
define do-copy =
$(call do,COPY,$1 => $2',\
sha256sum "$(1:$(pwd)/%=%)" ; \
$(call do,INSTALL ,$1 => $2',\
if ! cmp --quiet "$1" "$2" ; then \
cp -a "$1" "$2"; \
else \
echo "$(DATE) UNCHANGED $(1:$(pwd)/%=%)" ; \
fi
)
@sha256sum "$(2:$(pwd)/%=%)"
endef
@ -190,21 +188,25 @@ endef
# expansion during the first evaluation.
#
define define_module =
# if they have not defined a separate base dir, define it
# as the same as their build dir.
$(eval $1_base_dir := $(or $($1_base_dir),$($1_dir)))
ifneq ("$($1_repo)","")
# Checkout the tree instead and touch the canary file so that we know
# that the files are all present. No signature hashes are checked in
# this case, since we don't have a stable version to compare against.
$(build)/$($1_dir)/.canary:
$(build)/$($1_base_dir)/.canary:
git clone $($1_repo) "$(build)/$($1_dir)"
if [ -r patches/$1.patch ]; then \
( cd $(build)/$($1_dir) ; patch -p1 ) \
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
< patches/$1.patch; \
fi
if [ -d patches/$1 ] && \
[ -r patches/$1 ] ; then \
for patch in patches/$1/*.patch ; do \
echo "Applying patch file : $$$$patch " ; \
( cd $(build)/$($1_dir) ; patch -p1 ) \
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
< $$$$patch ; \
done ; \
fi
@ -219,17 +221,17 @@ define define_module =
# Unpack the tar file and touch the canary so that we know
# that the files are all present
$(build)/$($1_dir)/.canary: $(packages)/.$1-$($1_version)_verify
$(build)/$($1_base_dir)/.canary: $(packages)/.$1-$($1_version)_verify
tar -xf "$(packages)/$($1_tar)" -C "$(build)"
if [ -r patches/$1-$($1_version).patch ]; then \
( cd $(build)/$($1_dir) ; patch -p1 ) \
( cd $(build)/$(1_base_dir) ; patch -p1 ) \
< patches/$1-$($1_version).patch; \
fi
if [ -d patches/$1-$($1_version) ] && \
[ -r patches/$1-$($1_version) ] ; then \
for patch in patches/$1-$($1_version)/*.patch ; do \
echo "Applying patch file : $$$$patch " ; \
( cd $(build)/$($1_dir) ; patch -p1 ) \
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
< $$$$patch ; \
done ; \
fi
@ -242,21 +244,20 @@ define define_module =
ifeq "$($1_config)" ""
# There is no official .config file
$($1_config_file_path): $(build)/$($1_dir)/.canary
$($1_config_file_path): $(build)/$($1_base_dir)/.canary
@mkdir -p $$(dir $$@)
@touch "$$@"
else
# Copy the stored config file into the unpacked directory
$($1_config_file_path): $($1_config) $(build)/$($1_dir)/.canary
$($1_config_file_path): $($1_config) $(build)/$($1_base_dir)/.canary
@mkdir -p $$(dir $$@)
$(call do-copy,$($1_config),$$@)
endif
# Use the module's configure variable to build itself
$(dir $($1_config_file_path)).configured: \
$(build)/$($1_dir)/.canary \
$(build)/$($1_base_dir)/.canary \
$($1_config_file_path) \
$(foreach d,$($1_depends),$(call outputs,$d)) \
modules/$1
@echo "$(DATE) CONFIG $1"
@( \
@ -270,19 +271,26 @@ define define_module =
$(VERBOSE_REDIRECT)
@touch "$$@"
# All of the outputs should result from building the intermediate target
$(call outputs,$1): $1.intermediate
# Short hand target for the module
#$1: $(call outputs,$1)
# Short hand for our module build target
$1: \
$(build)/$($1_dir)/.build \
$(call outputs,$1) \
# Target for all of the outputs, which depend on their dependent modules
$1.intermediate: \
$(foreach d,$($1_depends),$d.intermediate) \
$(foreach d,$($1_depends),$(call outputs,$d)) \
# being built, as well as this module being configured
$(call outputs,$1): $(build)/$($1_dir)/.build
# If any of the outputs are missing, we should force a rebuild
# of the entire module
$(eval $1.force = $(shell \
stat $(call outputs,$1) >/dev/null 2>/dev/null || echo FORCE \
))
$(build)/$($1_dir)/.build: $($1.force) \
$(foreach d,$($1_depends),$(build)/$($d_dir)/.build) \
$(dir $($1_config_file_path)).configured \
@echo "$(DATE) MAKE $1"
@echo "$(DATE) MAKE $1 --- @=$$@"
+@( \
echo "$(MAKE) \
-C \"$(build)/$($1_dir)\" \
@ -301,7 +309,11 @@ define define_module =
tail -20 "$(log_dir)/$1.log"; \
exit 1; \
)
@echo "$(DATE) DONE $1"
$(call do,DONE,$1,\
touch $(build)/$($1_dir)/.build \
)
$1.clean:
-$(RM) "$(build)/$($1_dir)/.configured"
@ -368,7 +380,6 @@ $(foreach m, $(modules-y), \
# hack to install busybox into the initrd if busybox is configured
ifeq "$(CONFIG_BUSYBOX)" "y"
$(build)/$(BOARD)/heads.cpio: busybox.intermediate
initrd_bins += $(initrd_bin_dir)/busybox
endif
@ -386,7 +397,7 @@ $(initrd_bin_dir)/busybox: $(build)/$(busybox_dir)/busybox
# this must be built *AFTER* musl, but since coreboot depends on other things
# that depend on musl it should be ok.
#
COREBOOT_UTIL_DIR=$(build)/$(coreboot_dir)/util
COREBOOT_UTIL_DIR=$(build)/$(coreboot_base_dir)/util
ifeq ($(CONFIG_COREBOOT),y)
$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/cbmem/cbmem))
#$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/superiotool/superiotool))
@ -396,14 +407,16 @@ endif
$(COREBOOT_UTIL_DIR)/cbmem/cbmem \
$(COREBOOT_UTIL_DIR)/superiotool/superiotool \
$(COREBOOT_UTIL_DIR)/inteltool/inteltool \
: $(build)/$(coreboot_dir)/.canary \
musl.intermediate
: $(build)/$(coreboot_base_dir)/.canary \
$(build)/$(musl_dir)/.build
+$(call do,MAKE,$(notdir $@),\
$(MAKE) -C "$(dir $@)" $(CROSS_TOOLS) \
)
# superio depends on zlib and pciutils
$(COREBOOT_UTIL_DIR)/superiotool/superiotool: zlib.intermediate pciutils.intermediate
$(COREBOOT_UTIL_DIR)/superiotool/superiotool: \
$(build)/$(zlib_dir)/.build \
$(build)/$(pciutils_dir)/.build \
#
# initrd image creation
@ -423,28 +436,35 @@ $(COREBOOT_UTIL_DIR)/superiotool/superiotool: zlib.intermediate pciutils.interme
#
initrd-y += $(pwd)/blobs/dev.cpio
initrd-y += $(build)/$(BOARD)/modules.cpio
initrd-y += $(build)/$(BOARD)/tools.cpio
initrd-$(CONFIG_HEADS) += $(build)/$(BOARD)/heads.cpio
initrd-y += $(build)/$(initrd_dir)/modules.cpio
initrd-y += $(build)/$(initrd_dir)/tools.cpio
initrd-$(CONFIG_HEADS) += $(build)/$(initrd_dir)/heads.cpio
initrd.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
$(build)/$(BOARD)/initrd.cpio.xz: $(initrd-y)
$(call do,CPIO-CLEAN,$@,\
#$(build)/$(initrd_dir)/.build: $(build)/$(initrd_dir)/initrd.cpio.xz
$(build)/$(initrd_dir)/initrd.cpio.xz: $(initrd-y)
$(call do,CPIO-XZ ,$@,\
$(pwd)/bin/cpio-clean \
$^ \
| xz \
--check=crc32 \
--lzma2=dict=1MiB \
-9 \
| dd bs=512 conv=sync > "$@" \
| dd bs=512 conv=sync status=none > "$@.tmp" \
)
@sha256sum "$(@:$(pwd)/%=%)"
@if ! cmp --quiet "$@.tmp" "$@" ; then \
mv "$@.tmp" "$@" ; \
sha256sum "$(@:$(pwd)/%=%)" ; \
else \
echo "$(DATE) UNCHANGED $(@:$(pwd)/%=%)" ; \
rm "$@.tmp" ; \
fi
#
# The heads.cpio is built from the initrd directory in the
# Heads tree.
#
$(build)/$(BOARD)/heads.cpio: FORCE
$(build)/$(initrd_dir)/heads.cpio: FORCE
$(call do-cpio,$@,$(pwd)/initrd)
@ -452,28 +472,31 @@ $(build)/$(BOARD)/heads.cpio: FORCE
# The tools initrd is made from all of the things that we've
# created during the submodule build.
#
$(build)/$(BOARD)/tools.cpio: \
$(build)/$(initrd_dir)/tools.cpio: \
$(initrd_bins) \
$(initrd_libs) \
$(call do,INSTALL,$(CONFIG), \
mkdir -p "$(initrd_dir)/etc" ; \
mkdir -p "$(initrd_tmp_dir)/etc" ; \
export \
| grep ' CONFIG_' \
| sed -e 's/^declare -x /export /' \
-e 's/\\\"//g' \
> "$(initrd_dir)/etc/config" \
> "$(initrd_tmp_dir)/etc/config" \
)
$(call do-cpio,$@,$(initrd_dir))
@$(RM) -rf "$(initrd_dir)"
$(call do-cpio,$@,$(initrd_tmp_dir))
@$(RM) -rf "$(initrd_tmp_dir)"
# Ensure that the initrd depends on all of the modules that produce
# binaries for it
$(build)/$(initrd_dir)/tools.cpio: $(foreach d,$(bin_modules-y),$(build)/$($d_dir)/.build)
# This produces a ROM image that is written with the flashrom program
$(build)/$(BOARD)/coreboot.rom: $(build)/$(coreboot_dir)/$(BOARD)/coreboot.rom
"$(build)/$(coreboot_dir)/$(BOARD)/cbfstool" "$<" print
$(call do,EXTRACT,$@,mv "$<" "$@")
@sha256sum "$(@:$(pwd)/%=%)"
$(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
# List of all modules, excluding the slow to-build modules
modules-slow := musl musl-cross kernel_headers
@ -501,10 +524,6 @@ real.clean:
done
rm -rf ./install
bootstrap:
+$(MAKE) \
musl-cross.intermediate \
$(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc \
else
# Wrong make version detected -- build our local version
@ -515,7 +534,7 @@ HEADS_MAKE := $(build)/$(make_dir)/make
# Once we have a proper Make, we can just pass arguments into it
all bootstrap linux cpio: $(HEADS_MAKE)
LANG=C MAKE=$(HEADS_MAKE) $(HEADS_MAKE) $(MAKE_JOBS) $@
%.clean %.intermediate %.vol: $(HEADS_MAKE)
%.clean %.vol: $(HEADS_MAKE)
LANG=C MAKE=$(HEADS_MAKE) $(HEADS_MAKE) $@
# How to download and build the correct version of make

View File

@ -16,7 +16,7 @@ CONFIG_QRENCODE=y
CONFIG_TPMTOTP=y
endif
#CONFIG_FLASHROM=y
CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG=y
CONFIG_KEXEC=y

View File

@ -14,14 +14,14 @@ CONFIG_ZLIB=n
CONFIG_MUSL=n
else
# These don't fit if u-root is turned on
CONFIG_CRYPTSETUP=y
CONFIG_FLASHROM=y
#CONFIG_CRYPTSETUP=y
#CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_GPG=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
CONFIG_MBEDTLS=y
#CONFIG_LVM2=y
#CONFIG_MBEDTLS=y
CONFIG_PCIUTILS=y
CONFIG_POPT=y
#CONFIG_QRENCODE=y
@ -44,7 +44,7 @@ export CONFIG_BOOT_REQ_ROLLBACK=n
export CONFIG_BOOT_DEV="/dev/sda1"
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
$(build)/$(BOARD)/linuxboot.rom: linuxboot.intermediate
#$(build)/$(BOARD)/linuxboot.rom: $(build)/$(linuxboot_dir)/
# No 0x on these since the flasher doesn't handle that
dxe_offset := 860000

View File

@ -2,7 +2,7 @@
BOARD=x230.flash
export CONFIG_COREBOOT=y
CONFIG_FLASHROM=y
#CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y
CONFIG_PCIUTILS=y
CONFIG_MBEDTLS=y

View File

@ -37,10 +37,10 @@ export CONFIG_USB_BOOT_DEV="/dev/sdb1"
# to separate files for these pieces.
all: $(build)/$(BOARD)/$(BOARD)-8.rom
$(build)/$(BOARD)/$(BOARD)-8.rom: $(build)/$(BOARD)/coreboot.rom
dd of=$@ if=$< bs=65536 count=128 skip=0
sha256sum $@
$(call do,DD 8MB,$@,dd of=$@ if=$< bs=65536 count=128 skip=0 status=none)
@sha256sum $@
all: $(build)/$(BOARD)/$(BOARD)-4.rom
$(build)/$(BOARD)/$(BOARD)-4.rom: $(build)/$(BOARD)/coreboot.rom
dd of=$@ if=$< bs=65536 count=64 skip=128
sha256sum $@
$(call do,DD 4MB,$@,dd of=$@ if=$< bs=65536 count=64 skip=128 status=none)
@sha256sum $@

View File

@ -13,7 +13,7 @@ busybox_config := config/busybox.config
busybox_output := busybox
busybox_target := \
$(CROSS_TOOLS) \
CONFIG_PREFIX="$(initrd_dir)" \
CONFIG_PREFIX="$(initrd_tmp_dir)" \
$(MAKE_JOBS) \
install

View File

@ -3,7 +3,8 @@ modules-$(CONFIG_COREBOOT) += coreboot
#coreboot_version := git
#coreboot_repo := https://github.com/osresearch/coreboot
coreboot_version := 4.7
coreboot_dir := coreboot-$(coreboot_version)
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
@ -15,49 +16,46 @@ CONFIG_COREBOOT_CONFIG ?= config/coreboot-$(BOARD).config
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
coreboot_configure := \
$(MAKE) \
$(MAKE) -C $(build)/$(coreboot_base_dir) \
oldconfig \
obj=./$(BOARD) \
obj=$(build)/$(coreboot_dir) \
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
BUILD_TIMELESS=1 \
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
coreboot_target := \
obj=./$(BOARD) \
-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 := $(BOARD)/coreboot.rom
coreboot_output := coreboot.rom
coreboot_depend += linux initrd
# hack to force a build dependency on the cross compiler
$(build)/$(coreboot_dir)/.configured: $(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc
$(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc: $(build)/$(coreboot_dir)/.canary
$(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_dir)" CPUS=`nproc` crossgcc-i386
$(MAKE) -C "$(build)/$(coreboot_base_dir)" CPUS=`nproc` crossgcc-i386
#echo '******* Building crossgcc-arm (this might take a while) ******'
#$(MAKE) -C "$(build)/$(coreboot_dir)" crossgcc-arm
#$(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 \
# The coreboot-blobs must be unpacked before we can build coreboot
# if we are using a tar file; git checkout will clone the submodule.
# The Linux kernel and Heads initrd must be built before linuxboot
# unless the user has specified "FAST=1" on the make command line,
# which will assume that the kernel and initrd are fresh
ifneq "$(FAST)" "1"
coreboot_depends := linux initrd
coreboot.intermediate: $(build)/$(BOARD)/bzImage
coreboot.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
endif
#
# Helpful target for reconfiguring the coreboot target
#
coreboot.menuconfig:
$(MAKE) \
-C "$(build)/$(coreboot_dir)" \
-C "$(build)/$(coreboot_base_dir)" \
DOTCONFIG="../../$(CONFIG_COREBOOT_CONFIG)" \
menuconfig

View File

@ -25,6 +25,6 @@ dropbear_target := \
DESTDIR="$(INSTALL)" \
dbclient scp dropbear \
&& \
cp $(build)/$(dropbear_dir)/dbclient $(build)/$(dropbear_dir)/ssh
cp -a $(build)/$(dropbear_dir)/dbclient $(build)/$(dropbear_dir)/ssh
dropbear_depends := zlib $(musl_dep)

View File

@ -1,7 +1,17 @@
modules-y += linux
linux_version := 4.9.80
linux_dir := linux-$(linux_version)
linux_base_dir := linux-$(linux_version)
# TODO: fixup the patch process
# input file in the heads config/ dir
# Allow board config to specialize Linux configuration if necessary
linux_kconfig := $(or $(CONFIG_LINUX_CONFIG),config/linux.config)
# Output directory for the Linux kernel build is based on the
# configuration file name, not the board name
linux_dir := $(linux_base_dir)/$(notdir $(basename $(linux_kconfig)))
linux_tar := linux-$(linux_version).tar.xz
linux_url := https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux_tar)
@ -10,28 +20,17 @@ linux-4.9.80_hash := 9e2e83ccc0afc3f23340ed5e58a35d8c6300a7c58aa98ca913848de4122
linux_hash := $(linux-$(linux_version)_hash)
# input file in the heads config/ dir
# Allow board config to specialize Linux configuration if necessary
linux_kconfig := $(or $(CONFIG_LINUX_CONFIG),config/linux.config)
# Output directory for the Linux kernel build is based on the
# configuration file name, not the board name
linux_board_dir := $(build)/$(linux_dir)/$(notdir $(basename $(linux_kconfig)))
# temp file in the build dir to show that we have run make oldconfig
linux_config_file := $(notdir $(basename $(linux_kconfig))/.config-$(BOARD))
linux_configure := \
$(MAKE) \
$(MAKE) -C .. \
CROSS_COMPILE="$(CROSS)" \
O="$(linux_board_dir)" \
O="$(build)/$(linux_dir)" \
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
oldconfig \
linux_output += $(build)/$(BOARD)/bzImage
# linux.intermediate: $(linux_output)
#linux_output += $(build)/$(BOARD)/modules.cpio
linux_output += arch/x86/boot/bzImage
# qemu
@ -87,7 +86,7 @@ linux_modules-$(CONFIG_LINUX_MEI) += drivers/misc/mei/mei-me.ko
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
linux_target := \
O="$(linux_board_dir)" \
O="$(build)/$(linux_dir)" \
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
CROSS_COMPILE="$(CROSS)" \
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
@ -115,13 +114,13 @@ FOO := $(shell mkdir -p "$(module_initrd_lib_dir)")
define linux_module =
# Each module depends on building the Linux kernel
$(linux_board_dir)/$1: linux.intermediate # $(build)/$(BOARD)/bzImage
$(build)/$(linux_dir)/$1: $(build)/$(BOARD)/bzImage
# The cpio file will depend on every module
$(build)/$(BOARD)/modules.cpio: $(module_initrd_lib_dir)/$(notdir $1)
# Strip the modules when we install them so that they will be extra small
$(module_initrd_lib_dir)/$(notdir $1): $(linux_board_dir)/$1
$(module_initrd_lib_dir)/$(notdir $1): $(build)/$(linux_dir)/$1
$(call do,INSTALL-MODULE,$1, \
$(CROSS)strip \
--preserve-dates \
@ -134,7 +133,7 @@ endef
$(call map,linux_module,$(linux_modules-y))
# We can't rebuild the module initrd until the kernel has been rebuilt
$(build)/$(BOARD)/modules.cpio: linux.intermediate
$(build)/$(BOARD)/modules.cpio: $(build)/$(linux_dir)/.build
$(call do-cpio,$@,$(module_initrd_dir))
@$(RM) -rf "$(module_initrd_dir)"
@ -142,15 +141,14 @@ $(build)/$(BOARD)/modules.cpio: linux.intermediate
# The output of the linux.intermediate is the bzImage in the
# linus build directory. We need to copy it into our board
# specific directory for ease of locating it later.
$(linux_board_dir)/arch/x86/boot/bzImage: linux.intermediate
$(build)/$(BOARD)/bzImage: $(linux_board_dir)/arch/x86/boot/bzImage
$(build)/$(BOARD)/bzImage: $(build)/$(linux_dir)/arch/x86/boot/bzImage
$(call do-copy,$<,$@)
# menuconfig target allows us to easily reconfigure this Linux kernel
linux.menuconfig:
$(MAKE) \
-C "$(build)/$(linux_dir)" \
O="$(linux_board_dir)" \
-C "$(build)/$(linux_base_dir)" \
O="$(build)/$(linux_dir)" \
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
menuconfig \

View File

@ -45,33 +45,24 @@ ifneq "y" "$(shell [ -r '$(CONFIG_LINUXBOOT_ROM)' ] && echo y)"
$(error $(CONFIG_LINUXBOOT_ROM): you must provide a ROM file)
endif
# Force a rebuild of the LinuxBoot ROM if the vendor ROM changes
linuxboot.intermediate: $(CONFIG_LINUXBOOT_ROM)
endif
# The output file from the LinuxBoot build is a full ROM
# ready to flash onto the mainboard. There might be partial
# firmware volumes as well, but that depends on the board
# so this only retrieves the final one
linuxboot_output := $(build)/$(linuxboot_dir)/build/$(linuxboot_board)/linuxboot.rom
linuxboot_output := build/$(linuxboot_board)/linuxboot.rom
linuxboot_rom := $(build)/$(linuxboot_dir)/$(linuxboot_output)
$(linuxboot_output): linuxboot.intermediate
$(build)/$(BOARD)/linuxboot.rom: $(linuxboot_output)
$(build)/$(BOARD)/linuxboot.rom: $(linuxboot_rom)
$(call do-copy,$<,$@)
# The Linux kernel and Heads initrd must be built before linuxboot
# unless the user has specified "FAST=1" on the make command line,
# which will assume that the kernel and initrd are fresh
#
# There is not an explicit dependency of linuxboot on linux
# or initrd so that the configuration can pre-build all of edk2
# overlapping with the other builds.
ifneq "$(FAST)" "1"
linuxboot.intermediate: $(build)/$(BOARD)/bzImage
linuxboot.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
endif
# Also force a rebuild if any of the input files are updated
$(build)/$(linuxboot_dir)/.build: \
$(CONFIG_LINUXBOOT_ROM) \
$(build)/$(BOARD)/bzImage \
$(build)/$(BOARD)/initrd.cpio.xz \
linuxboot.run: $(build)/$(BOARD)/linuxboot.rom

View File

@ -38,8 +38,9 @@ musl_depends := musl-cross
# Fake a target so that musl will force a header install by the
# Linux kernel sources.
musl.intermediate: $(INSTALL)/include/linux/limits.h
$(INSTALL)/include/linux/limits.h: $(build)/$(linux_dir)/.canary
$(build)/$(musl_dir)/.build: $(INSTALL)/include/linux/limits.h
$(INSTALL)/include/linux/limits.h: $(build)/$(linux_base_dir)/.canary
$(MAKE) \
-C "$(build)/$(linux_dir)" \
INSTALL_HDR_PATH="$(INSTALL)" \

View File

@ -17,7 +17,7 @@ endif
# The cross compiler has already been built, so the musl-cross target
# is a NOP.
musl-cross.intermediate:
#musl-cross.intermediate:
else
@ -28,8 +28,9 @@ musl-cross_version := git
musl-cross_dir := musl-cross-$(musl-cross_version)
musl-cross_repo := https://github.com/GregorR/musl-cross
CROSS := $(build)/../crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-
musl-cross_output := $(CROSS)gcc
CROSS_TOP := crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-
CROSS := $(build)/../$(CROSS_TOP)
musl-cross_output := ../../$(CROSS_TOP)gcc
musl-cross_configure := \
/bin/echo -e > Makefile \

View File

@ -42,6 +42,6 @@ pciutils_output := \
lspci \
pciutils_libraries := \
../../install/lib/libpci.so.3 \
lib/libpci.so.3.5.4 \
pciutils_configure :=

View File

@ -47,7 +47,7 @@ CONFIG_HEADS=n
# Since we do not include u-root in modules-y, we have to define our
# own intermediate and clean targets here
u-root.intermediate: $(u-root_output)
$(build)/$(u-root_dir)/.build: $(u-root_output)
u-root.clean:
$(RM) $(u-root_output)
endif