mirror of
https://github.com/linuxboot/heads.git
synced 2025-02-06 11:10:46 +00:00
Merge branch 'parallel-build' of ssh://github.com/osresearch/heads
This commit is contained in:
commit
2b79f006d9
177
Makefile
177
Makefile
@ -1,6 +1,12 @@
|
|||||||
all:
|
all:
|
||||||
-include .config
|
-include .config
|
||||||
|
|
||||||
|
ifneq "$(TOOLCHAIN)" ""
|
||||||
|
$(info Using $(TOOLCHAIN) for cross compiler and packages)
|
||||||
|
packages := $(TOOLCHAIN)/packages
|
||||||
|
CROSS := $(TOOLCHAIN)/crossgcc/x86_64-linux-musl/bin/x86_64-linux-musl-
|
||||||
|
endif
|
||||||
|
|
||||||
modules-y :=
|
modules-y :=
|
||||||
pwd := $(shell pwd)
|
pwd := $(shell pwd)
|
||||||
packages ?= $(pwd)/packages
|
packages ?= $(pwd)/packages
|
||||||
@ -17,10 +23,11 @@ CPUS := $(shell nproc)
|
|||||||
BUILD_LOG := $(shell mkdir -p "$(log_dir)" )
|
BUILD_LOG := $(shell mkdir -p "$(log_dir)" )
|
||||||
|
|
||||||
# Check that we have a correct version of make
|
# Check that we have a correct version of make
|
||||||
|
# that matches at least the major version
|
||||||
LOCAL_MAKE_VERSION := $(shell $(MAKE) --version | head -1 | cut -d' ' -f3)
|
LOCAL_MAKE_VERSION := $(shell $(MAKE) --version | head -1 | cut -d' ' -f3)
|
||||||
include modules/make
|
include modules/make
|
||||||
|
|
||||||
ifeq "$(LOCAL_MAKE_VERSION)" "$(make_version)"
|
ifneq "" "$(filter $(make_version)%,$(LOCAL_MAKE_VERSION))"
|
||||||
|
|
||||||
# This is the correct version of Make
|
# This is the correct version of Make
|
||||||
|
|
||||||
@ -65,9 +72,11 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
# Create a temporary directory for the initrd
|
# Create a temporary directory for the initrd
|
||||||
initrd_dir := $(shell mktemp -d)
|
initrd_dir := $(BOARD)
|
||||||
initrd_lib_dir := $(initrd_dir)/lib
|
initrd_tmp_dir := $(shell mktemp -d)
|
||||||
initrd_bin_dir := $(initrd_dir)/bin
|
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)")
|
$(shell mkdir -p "$(initrd_lib_dir)" "$(initrd_bin_dir)")
|
||||||
|
|
||||||
@ -112,11 +121,8 @@ else
|
|||||||
$(error "$(BOARD): neither CONFIG_COREBOOT nor CONFIG_LINUXBOOT is set?")
|
$(error "$(BOARD): neither CONFIG_COREBOOT nor CONFIG_LINUXBOOT is set?")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# helpful targets for common uses
|
|
||||||
linux: $(build)/$(BOARD)/bzImage
|
|
||||||
cpio: $(build)/$(BOARD)/initrd.cpio.xz
|
|
||||||
|
|
||||||
# Disable all built in rules
|
# Disable all built in rules
|
||||||
|
.INTERMEDIATE:
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
@ -133,10 +139,6 @@ endef
|
|||||||
# as part of creating the Heads firmware image.
|
# as part of creating the Heads firmware image.
|
||||||
include modules/*
|
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 =
|
define bins =
|
||||||
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_output)))
|
$(foreach m,$1,$(call prefix,$(build)/$($m_dir)/,$($m_output)))
|
||||||
endef
|
endef
|
||||||
@ -155,7 +157,7 @@ endef
|
|||||||
# Build a cpio from a directory
|
# Build a cpio from a directory
|
||||||
#
|
#
|
||||||
define do-cpio =
|
define do-cpio =
|
||||||
$(call do,CPIO,$1,\
|
$(call do,CPIO ,$1,\
|
||||||
( cd "$2"; \
|
( cd "$2"; \
|
||||||
find . \
|
find . \
|
||||||
| cpio \
|
| cpio \
|
||||||
@ -169,17 +171,20 @@ define do-cpio =
|
|||||||
@if ! cmp --quiet "$1.tmp" "$1" ; then \
|
@if ! cmp --quiet "$1.tmp" "$1" ; then \
|
||||||
mv "$1.tmp" "$1" ; \
|
mv "$1.tmp" "$1" ; \
|
||||||
else \
|
else \
|
||||||
|
echo "$(DATE) UNCHANGED $(1:$(pwd)/%=%)" ; \
|
||||||
rm "$1.tmp" ; \
|
rm "$1.tmp" ; \
|
||||||
fi
|
fi
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define do-copy =
|
define do-copy =
|
||||||
$(call do,COPY,$1 => $2',\
|
$(call do,INSTALL ,$1 => $2',\
|
||||||
sha256sum "$(1:$(pwd)/%=%)" ; \
|
|
||||||
if ! cmp --quiet "$1" "$2" ; then \
|
if ! cmp --quiet "$1" "$2" ; then \
|
||||||
cp -a "$1" "$2"; \
|
cp -a "$1" "$2"; \
|
||||||
|
else \
|
||||||
|
echo "$(DATE) UNCHANGED $(1:$(pwd)/%=%)" ; \
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
@sha256sum "$(2:$(pwd)/%=%)"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
@ -190,21 +195,25 @@ endef
|
|||||||
# expansion during the first evaluation.
|
# expansion during the first evaluation.
|
||||||
#
|
#
|
||||||
define define_module =
|
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)","")
|
ifneq ("$($1_repo)","")
|
||||||
# Checkout the tree instead and touch the canary file so that we know
|
# 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
|
# 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.
|
# 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)"
|
git clone $($1_repo) "$(build)/$($1_base_dir)"
|
||||||
if [ -r patches/$1.patch ]; then \
|
if [ -r patches/$1.patch ]; then \
|
||||||
( cd $(build)/$($1_dir) ; patch -p1 ) \
|
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
|
||||||
< patches/$1.patch; \
|
< patches/$1.patch; \
|
||||||
fi
|
fi
|
||||||
if [ -d patches/$1 ] && \
|
if [ -d patches/$1 ] && \
|
||||||
[ -r patches/$1 ] ; then \
|
[ -r patches/$1 ] ; then \
|
||||||
for patch in patches/$1/*.patch ; do \
|
for patch in patches/$1/*.patch ; do \
|
||||||
echo "Applying patch file : $$$$patch " ; \
|
echo "Applying patch file : $$$$patch " ; \
|
||||||
( cd $(build)/$($1_dir) ; patch -p1 ) \
|
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
|
||||||
< $$$$patch ; \
|
< $$$$patch ; \
|
||||||
done ; \
|
done ; \
|
||||||
fi
|
fi
|
||||||
@ -219,17 +228,17 @@ define define_module =
|
|||||||
|
|
||||||
# Unpack the tar file and touch the canary so that we know
|
# Unpack the tar file and touch the canary so that we know
|
||||||
# that the files are all present
|
# 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)"
|
tar -xf "$(packages)/$($1_tar)" -C "$(build)"
|
||||||
if [ -r patches/$1-$($1_version).patch ]; then \
|
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; \
|
< patches/$1-$($1_version).patch; \
|
||||||
fi
|
fi
|
||||||
if [ -d patches/$1-$($1_version) ] && \
|
if [ -d patches/$1-$($1_version) ] && \
|
||||||
[ -r patches/$1-$($1_version) ] ; then \
|
[ -r patches/$1-$($1_version) ] ; then \
|
||||||
for patch in patches/$1-$($1_version)/*.patch ; do \
|
for patch in patches/$1-$($1_version)/*.patch ; do \
|
||||||
echo "Applying patch file : $$$$patch " ; \
|
echo "Applying patch file : $$$$patch " ; \
|
||||||
( cd $(build)/$($1_dir) ; patch -p1 ) \
|
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
|
||||||
< $$$$patch ; \
|
< $$$$patch ; \
|
||||||
done ; \
|
done ; \
|
||||||
fi
|
fi
|
||||||
@ -242,21 +251,29 @@ define define_module =
|
|||||||
|
|
||||||
ifeq "$($1_config)" ""
|
ifeq "$($1_config)" ""
|
||||||
# There is no official .config file
|
# 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 $$@)
|
@mkdir -p $$(dir $$@)
|
||||||
@touch "$$@"
|
@touch "$$@"
|
||||||
else
|
else
|
||||||
# Copy the stored config file into the unpacked directory
|
# 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 $$@)
|
@mkdir -p $$(dir $$@)
|
||||||
$(call do-copy,$($1_config),$$@)
|
$(call do-copy,$($1_config),$$@)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# The first time we have to wait for all the dependencies to be built
|
||||||
|
# before we can configure the target. Once the dep has been built,
|
||||||
|
# we only depend on it for a rebuild.
|
||||||
|
$(eval $1_config_wait := $(foreach d,$($1_depends),\
|
||||||
|
$(shell [ -r $(build)/$($d_dir)/.build ] || echo $d)))
|
||||||
|
|
||||||
# Use the module's configure variable to build itself
|
# Use the module's configure variable to build itself
|
||||||
|
# this has to wait for the dependencies to be built since
|
||||||
|
# cross compilers and libraries might be messed up
|
||||||
$(dir $($1_config_file_path)).configured: \
|
$(dir $($1_config_file_path)).configured: \
|
||||||
$(build)/$($1_dir)/.canary \
|
$(build)/$($1_base_dir)/.canary \
|
||||||
|
$(foreach d,$($1_config_wait),$(build)/$($d_dir)/.build) \
|
||||||
$($1_config_file_path) \
|
$($1_config_file_path) \
|
||||||
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
|
||||||
modules/$1
|
modules/$1
|
||||||
@echo "$(DATE) CONFIG $1"
|
@echo "$(DATE) CONFIG $1"
|
||||||
@( \
|
@( \
|
||||||
@ -270,19 +287,26 @@ define define_module =
|
|||||||
$(VERBOSE_REDIRECT)
|
$(VERBOSE_REDIRECT)
|
||||||
@touch "$$@"
|
@touch "$$@"
|
||||||
|
|
||||||
# All of the outputs should result from building the intermediate target
|
# Short hand for our module build target
|
||||||
$(call outputs,$1): $1.intermediate
|
$1: \
|
||||||
|
$(build)/$($1_dir)/.build \
|
||||||
# Short hand target for the module
|
$(call outputs,$1) \
|
||||||
#$1: $(call outputs,$1)
|
|
||||||
|
|
||||||
# Target for all of the outputs, which depend on their dependent modules
|
# Target for all of the outputs, which depend on their dependent modules
|
||||||
$1.intermediate: \
|
# being built, as well as this module being configured
|
||||||
$(foreach d,$($1_depends),$d.intermediate) \
|
$(call outputs,$1): $(build)/$($1_dir)/.build
|
||||||
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
|
||||||
|
# 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 \
|
$(dir $($1_config_file_path)).configured \
|
||||||
|
|
||||||
@echo "$(DATE) MAKE $1"
|
@echo "$(DATE) MAKE $1 --- $$@"
|
||||||
+@( \
|
+@( \
|
||||||
echo "$(MAKE) \
|
echo "$(MAKE) \
|
||||||
-C \"$(build)/$($1_dir)\" \
|
-C \"$(build)/$($1_dir)\" \
|
||||||
@ -301,7 +325,11 @@ define define_module =
|
|||||||
tail -20 "$(log_dir)/$1.log"; \
|
tail -20 "$(log_dir)/$1.log"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
)
|
)
|
||||||
@echo "$(DATE) DONE $1"
|
$(call do,DONE,$1,\
|
||||||
|
touch $(build)/$($1_dir)/.build \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$1.clean:
|
$1.clean:
|
||||||
-$(RM) "$(build)/$($1_dir)/.configured"
|
-$(RM) "$(build)/$($1_dir)/.configured"
|
||||||
@ -312,7 +340,7 @@ endef
|
|||||||
$(call map, define_module, $(modules-y))
|
$(call map, define_module, $(modules-y))
|
||||||
|
|
||||||
# hack to force musl-cross to be built before musl
|
# hack to force musl-cross to be built before musl
|
||||||
#$(build)/$(musl_dir)/.configured: $(build)/$(musl-cross_dir)/../../crossgcc/x86_64-linux-musl/bin/x86_64-linux-musl-gcc
|
#$(build)/$(musl_dir)/.configured: $(build)/$(musl-cross_dir)/../../crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-gcc
|
||||||
|
|
||||||
#
|
#
|
||||||
# Install a file into the initrd, if it changed from
|
# Install a file into the initrd, if it changed from
|
||||||
@ -366,27 +394,12 @@ $(foreach m, $(modules-y), \
|
|||||||
$(call map,initrd_lib_add,$(call libs,$m)) \
|
$(call map,initrd_lib_add,$(call libs,$m)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
$(initrd_bin_dir)/busybox: $(build)/$(busybox_dir)/busybox
|
|
||||||
$(do,SYMLINK,$@,$(MAKE) \
|
|
||||||
-C $(build)/$(busybox_dir) \
|
|
||||||
CC="$(heads_cc)" \
|
|
||||||
CONFIG_PREFIX="$(pwd)/initrd" \
|
|
||||||
$(MAKE_JOBS) \
|
|
||||||
install \
|
|
||||||
)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# hack to build cbmem from coreboot
|
# hack to build cbmem from coreboot
|
||||||
# this must be built *AFTER* musl, but since coreboot depends on other things
|
# this must be built *AFTER* musl, but since coreboot depends on other things
|
||||||
# that depend on musl it should be ok.
|
# 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)
|
ifeq ($(CONFIG_COREBOOT),y)
|
||||||
$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/cbmem/cbmem))
|
$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/cbmem/cbmem))
|
||||||
#$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/superiotool/superiotool))
|
#$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/superiotool/superiotool))
|
||||||
@ -396,14 +409,16 @@ endif
|
|||||||
$(COREBOOT_UTIL_DIR)/cbmem/cbmem \
|
$(COREBOOT_UTIL_DIR)/cbmem/cbmem \
|
||||||
$(COREBOOT_UTIL_DIR)/superiotool/superiotool \
|
$(COREBOOT_UTIL_DIR)/superiotool/superiotool \
|
||||||
$(COREBOOT_UTIL_DIR)/inteltool/inteltool \
|
$(COREBOOT_UTIL_DIR)/inteltool/inteltool \
|
||||||
: $(build)/$(coreboot_dir)/.canary \
|
: $(build)/$(coreboot_base_dir)/.canary \
|
||||||
musl.intermediate
|
$(build)/$(musl_dir)/.build
|
||||||
+$(call do,MAKE,$(notdir $@),\
|
+$(call do,MAKE,$(notdir $@),\
|
||||||
$(MAKE) -C "$(dir $@)" $(CROSS_TOOLS) \
|
$(MAKE) -C "$(dir $@)" $(CROSS_TOOLS) \
|
||||||
)
|
)
|
||||||
|
|
||||||
# superio depends on zlib and pciutils
|
# 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
|
# initrd image creation
|
||||||
@ -423,28 +438,35 @@ $(COREBOOT_UTIL_DIR)/superiotool/superiotool: zlib.intermediate pciutils.interme
|
|||||||
#
|
#
|
||||||
|
|
||||||
initrd-y += $(pwd)/blobs/dev.cpio
|
initrd-y += $(pwd)/blobs/dev.cpio
|
||||||
initrd-y += $(build)/$(BOARD)/modules.cpio
|
initrd-y += $(build)/$(initrd_dir)/modules.cpio
|
||||||
initrd-y += $(build)/$(BOARD)/tools.cpio
|
initrd-y += $(build)/$(initrd_dir)/tools.cpio
|
||||||
initrd-$(CONFIG_HEADS) += $(build)/$(BOARD)/heads.cpio
|
initrd-$(CONFIG_HEADS) += $(build)/$(initrd_dir)/heads.cpio
|
||||||
|
|
||||||
initrd.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
|
#$(build)/$(initrd_dir)/.build: $(build)/$(initrd_dir)/initrd.cpio.xz
|
||||||
$(build)/$(BOARD)/initrd.cpio.xz: $(initrd-y)
|
|
||||||
$(call do,CPIO-CLEAN,$@,\
|
$(build)/$(initrd_dir)/initrd.cpio.xz: $(initrd-y)
|
||||||
|
$(call do,CPIO-XZ ,$@,\
|
||||||
$(pwd)/bin/cpio-clean \
|
$(pwd)/bin/cpio-clean \
|
||||||
$^ \
|
$^ \
|
||||||
| xz \
|
| xz \
|
||||||
--check=crc32 \
|
--check=crc32 \
|
||||||
--lzma2=dict=1MiB \
|
--lzma2=dict=1MiB \
|
||||||
-9 \
|
-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
|
# The heads.cpio is built from the initrd directory in the
|
||||||
# Heads tree.
|
# Heads tree.
|
||||||
#
|
#
|
||||||
$(build)/$(BOARD)/heads.cpio: FORCE
|
$(build)/$(initrd_dir)/heads.cpio: FORCE
|
||||||
$(call do-cpio,$@,$(pwd)/initrd)
|
$(call do-cpio,$@,$(pwd)/initrd)
|
||||||
|
|
||||||
|
|
||||||
@ -452,29 +474,26 @@ $(build)/$(BOARD)/heads.cpio: FORCE
|
|||||||
# The tools initrd is made from all of the things that we've
|
# The tools initrd is made from all of the things that we've
|
||||||
# created during the submodule build.
|
# created during the submodule build.
|
||||||
#
|
#
|
||||||
$(build)/$(BOARD)/tools.cpio: \
|
$(build)/$(initrd_dir)/tools.cpio: \
|
||||||
$(initrd_bins) \
|
$(initrd_bins) \
|
||||||
$(initrd_libs) \
|
$(initrd_libs) \
|
||||||
|
|
||||||
$(call do,INSTALL,$(CONFIG), \
|
$(call do,INSTALL,$(CONFIG), \
|
||||||
mkdir -p "$(initrd_dir)/etc" ; \
|
mkdir -p "$(initrd_tmp_dir)/etc" ; \
|
||||||
export \
|
export \
|
||||||
| grep ' CONFIG_' \
|
| grep ' CONFIG_' \
|
||||||
| sed -e 's/^declare -x /export /' \
|
| sed -e 's/^declare -x /export /' \
|
||||||
-e 's/\\\"//g' \
|
-e 's/\\\"//g' \
|
||||||
> "$(initrd_dir)/etc/config" \
|
> "$(initrd_tmp_dir)/etc/config" \
|
||||||
)
|
)
|
||||||
$(call do-cpio,$@,$(initrd_dir))
|
$(call do-cpio,$@,$(initrd_tmp_dir))
|
||||||
@$(RM) -rf "$(initrd_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)/%=%)"
|
|
||||||
|
|
||||||
# List of all modules, excluding the slow to-build modules
|
# List of all modules, excluding the slow to-build modules
|
||||||
modules-slow := musl musl-cross kernel_headers
|
modules-slow := musl musl-cross kernel_headers
|
||||||
module_dirs := $(foreach m,$(filter-out $(modules-slow),$(modules-y)),$($m_dir))
|
module_dirs := $(foreach m,$(filter-out $(modules-slow),$(modules-y)),$($m_dir))
|
||||||
@ -501,10 +520,6 @@ real.clean:
|
|||||||
done
|
done
|
||||||
rm -rf ./install
|
rm -rf ./install
|
||||||
|
|
||||||
bootstrap:
|
|
||||||
+$(MAKE) \
|
|
||||||
musl-cross.intermediate \
|
|
||||||
$(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc \
|
|
||||||
|
|
||||||
else
|
else
|
||||||
# Wrong make version detected -- build our local version
|
# Wrong make version detected -- build our local version
|
||||||
@ -515,7 +530,7 @@ HEADS_MAKE := $(build)/$(make_dir)/make
|
|||||||
# Once we have a proper Make, we can just pass arguments into it
|
# Once we have a proper Make, we can just pass arguments into it
|
||||||
all bootstrap linux cpio: $(HEADS_MAKE)
|
all bootstrap linux cpio: $(HEADS_MAKE)
|
||||||
LANG=C MAKE=$(HEADS_MAKE) $(HEADS_MAKE) $(MAKE_JOBS) $@
|
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) $@
|
LANG=C MAKE=$(HEADS_MAKE) $(HEADS_MAKE) $@
|
||||||
|
|
||||||
# How to download and build the correct version of make
|
# How to download and build the correct version of make
|
||||||
|
@ -16,7 +16,7 @@ CONFIG_QRENCODE=y
|
|||||||
CONFIG_TPMTOTP=y
|
CONFIG_TPMTOTP=y
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#CONFIG_FLASHROM=y
|
CONFIG_FLASHROM=y
|
||||||
CONFIG_FLASHTOOLS=y
|
CONFIG_FLASHTOOLS=y
|
||||||
CONFIG_GPG=y
|
CONFIG_GPG=y
|
||||||
CONFIG_KEXEC=y
|
CONFIG_KEXEC=y
|
||||||
|
@ -14,14 +14,14 @@ CONFIG_ZLIB=n
|
|||||||
CONFIG_MUSL=n
|
CONFIG_MUSL=n
|
||||||
else
|
else
|
||||||
# These don't fit if u-root is turned on
|
# These don't fit if u-root is turned on
|
||||||
CONFIG_CRYPTSETUP=y
|
#CONFIG_CRYPTSETUP=y
|
||||||
CONFIG_FLASHROM=y
|
#CONFIG_FLASHROM=y
|
||||||
CONFIG_FLASHTOOLS=y
|
CONFIG_FLASHTOOLS=y
|
||||||
CONFIG_GPG=y
|
CONFIG_GPG=y
|
||||||
CONFIG_KEXEC=y
|
CONFIG_KEXEC=y
|
||||||
CONFIG_UTIL_LINUX=y
|
CONFIG_UTIL_LINUX=y
|
||||||
CONFIG_LVM2=y
|
#CONFIG_LVM2=y
|
||||||
CONFIG_MBEDTLS=y
|
#CONFIG_MBEDTLS=y
|
||||||
CONFIG_PCIUTILS=y
|
CONFIG_PCIUTILS=y
|
||||||
CONFIG_POPT=y
|
CONFIG_POPT=y
|
||||||
#CONFIG_QRENCODE=y
|
#CONFIG_QRENCODE=y
|
||||||
@ -44,7 +44,7 @@ export CONFIG_BOOT_REQ_ROLLBACK=n
|
|||||||
export CONFIG_BOOT_DEV="/dev/sda1"
|
export CONFIG_BOOT_DEV="/dev/sda1"
|
||||||
export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
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
|
# No 0x on these since the flasher doesn't handle that
|
||||||
dxe_offset := 860000
|
dxe_offset := 860000
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
BOARD=x230.flash
|
BOARD=x230.flash
|
||||||
|
|
||||||
export CONFIG_COREBOOT=y
|
export CONFIG_COREBOOT=y
|
||||||
CONFIG_FLASHROM=y
|
#CONFIG_FLASHROM=y
|
||||||
CONFIG_FLASHTOOLS=y
|
CONFIG_FLASHTOOLS=y
|
||||||
CONFIG_PCIUTILS=y
|
CONFIG_PCIUTILS=y
|
||||||
CONFIG_MBEDTLS=y
|
CONFIG_MBEDTLS=y
|
||||||
|
@ -37,10 +37,10 @@ export CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
|||||||
# to separate files for these pieces.
|
# to separate files for these pieces.
|
||||||
all: $(build)/$(BOARD)/$(BOARD)-8.rom
|
all: $(build)/$(BOARD)/$(BOARD)-8.rom
|
||||||
$(build)/$(BOARD)/$(BOARD)-8.rom: $(build)/$(BOARD)/coreboot.rom
|
$(build)/$(BOARD)/$(BOARD)-8.rom: $(build)/$(BOARD)/coreboot.rom
|
||||||
dd of=$@ if=$< bs=65536 count=128 skip=0
|
$(call do,DD 8MB,$@,dd of=$@ if=$< bs=65536 count=128 skip=0 status=none)
|
||||||
sha256sum $@
|
@sha256sum $@
|
||||||
|
|
||||||
all: $(build)/$(BOARD)/$(BOARD)-4.rom
|
all: $(build)/$(BOARD)/$(BOARD)-4.rom
|
||||||
$(build)/$(BOARD)/$(BOARD)-4.rom: $(build)/$(BOARD)/coreboot.rom
|
$(build)/$(BOARD)/$(BOARD)-4.rom: $(build)/$(BOARD)/coreboot.rom
|
||||||
dd of=$@ if=$< bs=65536 count=64 skip=128
|
$(call do,DD 4MB,$@,dd of=$@ if=$< bs=65536 count=64 skip=128 status=none)
|
||||||
sha256sum $@
|
@sha256sum $@
|
||||||
|
@ -13,8 +13,24 @@ busybox_config := config/busybox.config
|
|||||||
busybox_output := busybox
|
busybox_output := busybox
|
||||||
busybox_target := \
|
busybox_target := \
|
||||||
$(CROSS_TOOLS) \
|
$(CROSS_TOOLS) \
|
||||||
CONFIG_PREFIX="$(initrd_dir)" \
|
|
||||||
$(MAKE_JOBS) \
|
$(MAKE_JOBS) \
|
||||||
install
|
|
||||||
|
# Install symlinks when the busybox program is installed
|
||||||
|
|
||||||
|
ifeq "$(CONFIG_BUSYBOX)" "y"
|
||||||
|
initrd_bins += $(initrd_bin_dir)/busybox
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(initrd_tmp_dir)/bin/busybox: $(build)/$(busybox_dir)/.build
|
||||||
|
$(call do,SYMLINK,bin/busybox,\
|
||||||
|
$(MAKE) \
|
||||||
|
-C $(build)/$(busybox_dir) \
|
||||||
|
CC="$(heads_cc)" \
|
||||||
|
CONFIG_PREFIX="$(initrd_bin_dir)/.." \
|
||||||
|
install \
|
||||||
|
| tee -a $(build)/log/busybox.log \
|
||||||
|
$(VERBOSE_REDIRECT) \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
busybox_depends := $(musl_dep)
|
busybox_depends := $(musl_dep)
|
||||||
|
@ -3,7 +3,8 @@ modules-$(CONFIG_COREBOOT) += coreboot
|
|||||||
#coreboot_version := git
|
#coreboot_version := git
|
||||||
#coreboot_repo := https://github.com/osresearch/coreboot
|
#coreboot_repo := https://github.com/osresearch/coreboot
|
||||||
coreboot_version := 4.7
|
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_tar := coreboot-$(coreboot_version).tar.xz
|
||||||
coreboot_url := https://www.coreboot.org/releases/$(coreboot_tar)
|
coreboot_url := https://www.coreboot.org/releases/$(coreboot_tar)
|
||||||
coreboot_hash := d68a83f8f687e8ea212b8c5bb501e24444b57c3f73896042d09628188c851368
|
coreboot_hash := d68a83f8f687e8ea212b8c5bb501e24444b57c3f73896042d09628188c851368
|
||||||
@ -15,49 +16,51 @@ CONFIG_COREBOOT_CONFIG ?= config/coreboot-$(BOARD).config
|
|||||||
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
|
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
|
||||||
|
|
||||||
coreboot_configure := \
|
coreboot_configure := \
|
||||||
$(MAKE) \
|
$(MAKE) -C $(build)/$(coreboot_base_dir) \
|
||||||
oldconfig \
|
oldconfig \
|
||||||
obj=./$(BOARD) \
|
obj=$(build)/$(coreboot_dir) \
|
||||||
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
|
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
|
||||||
BUILD_TIMELESS=1 \
|
BUILD_TIMELESS=1 \
|
||||||
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
||||||
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
||||||
|
|
||||||
coreboot_target := \
|
coreboot_target := \
|
||||||
obj=./$(BOARD) \
|
-C $(build)/$(coreboot_base_dir) \
|
||||||
|
obj=$(build)/$(coreboot_dir) \
|
||||||
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
|
DOTCONFIG=../../$(CONFIG_COREBOOT_CONFIG) \
|
||||||
BUILD_TIMELESS=1 \
|
BUILD_TIMELESS=1 \
|
||||||
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
CFLAGS_x86_32="$(EXTRA_FLAGS)" \
|
||||||
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
||||||
$(MAKE_JOBS)
|
$(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
|
# 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)/.configured: $(build)/$(coreboot_base_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc
|
||||||
$(build)/$(coreboot_dir)/util/crossgcc/xgcc/bin/i386-elf-gcc: $(build)/$(coreboot_dir)/.canary
|
$(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) ******'
|
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) ******'
|
#echo '******* Building crossgcc-arm (this might take a while) ******'
|
||||||
#$(MAKE) -C "$(build)/$(coreboot_dir)" crossgcc-arm
|
#$(MAKE) -C "$(build)/$(coreboot_base_dir)" crossgcc-arm
|
||||||
|
|
||||||
# The coreboot-blobs must be unpacked before we can build coreboot
|
# Force a rebuild if the inputs have changed
|
||||||
# if we are using a tar file; git checkout will clone the submodule.
|
$(build)/$(coreboot_dir)/.build: \
|
||||||
# The Linux kernel and Heads initrd must be built before linuxboot
|
$(build)/$(BOARD)/bzImage \
|
||||||
# unless the user has specified "FAST=1" on the make command line,
|
$(build)/$(BOARD)/initrd.cpio.xz \
|
||||||
# which will assume that the kernel and initrd are fresh
|
|
||||||
ifneq "$(FAST)" "1"
|
# This produces a ROM image that is written with the flashrom program
|
||||||
coreboot_depends := linux initrd
|
$(build)/$(BOARD)/coreboot.rom: $(build)/$(coreboot_dir)/.build
|
||||||
coreboot.intermediate: $(build)/$(BOARD)/bzImage
|
"$(build)/$(coreboot_dir)/cbfstool" "$(dir $<)coreboot.rom" print
|
||||||
coreboot.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
|
$(call do-copy,$(dir $<)coreboot.rom,$@)
|
||||||
endif
|
@touch $@ # update the time stamp
|
||||||
|
|
||||||
#
|
#
|
||||||
# Helpful target for reconfiguring the coreboot target
|
# Helpful target for reconfiguring the coreboot target
|
||||||
#
|
#
|
||||||
coreboot.menuconfig:
|
coreboot.menuconfig:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
-C "$(build)/$(coreboot_dir)" \
|
-C "$(build)/$(coreboot_base_dir)" \
|
||||||
DOTCONFIG="../../$(CONFIG_COREBOOT_CONFIG)" \
|
DOTCONFIG="../../$(CONFIG_COREBOOT_CONFIG)" \
|
||||||
menuconfig
|
menuconfig
|
||||||
|
|
||||||
|
@ -25,6 +25,6 @@ dropbear_target := \
|
|||||||
DESTDIR="$(INSTALL)" \
|
DESTDIR="$(INSTALL)" \
|
||||||
dbclient scp dropbear \
|
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)
|
dropbear_depends := zlib $(musl_dep)
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
modules-y += linux
|
modules-y += linux
|
||||||
|
|
||||||
linux_version := 4.9.80
|
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_tar := linux-$(linux_version).tar.xz
|
||||||
linux_url := https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux_tar)
|
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)
|
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
|
# temp file in the build dir to show that we have run make oldconfig
|
||||||
linux_config_file := $(notdir $(basename $(linux_kconfig))/.config-$(BOARD))
|
linux_config_file := $(notdir $(basename $(linux_kconfig))/.config-$(BOARD))
|
||||||
|
|
||||||
linux_configure := \
|
linux_configure := \
|
||||||
$(MAKE) \
|
$(MAKE) -C .. \
|
||||||
CROSS_COMPILE="$(CROSS)" \
|
CROSS_COMPILE="$(CROSS)" \
|
||||||
O="$(linux_board_dir)" \
|
O="$(build)/$(linux_dir)" \
|
||||||
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
||||||
oldconfig \
|
oldconfig \
|
||||||
|
|
||||||
linux_output += $(build)/$(BOARD)/bzImage
|
linux_output += arch/x86/boot/bzImage
|
||||||
|
|
||||||
# linux.intermediate: $(linux_output)
|
|
||||||
#linux_output += $(build)/$(BOARD)/modules.cpio
|
|
||||||
|
|
||||||
|
|
||||||
# qemu
|
# 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
|
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
|
||||||
|
|
||||||
linux_target := \
|
linux_target := \
|
||||||
O="$(linux_board_dir)" \
|
O="$(build)/$(linux_dir)" \
|
||||||
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
||||||
CROSS_COMPILE="$(CROSS)" \
|
CROSS_COMPILE="$(CROSS)" \
|
||||||
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
||||||
@ -115,13 +114,13 @@ FOO := $(shell mkdir -p "$(module_initrd_lib_dir)")
|
|||||||
define linux_module =
|
define linux_module =
|
||||||
|
|
||||||
# Each module depends on building the Linux kernel
|
# 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
|
# The cpio file will depend on every module
|
||||||
$(build)/$(BOARD)/modules.cpio: $(module_initrd_lib_dir)/$(notdir $1)
|
$(build)/$(BOARD)/modules.cpio: $(module_initrd_lib_dir)/$(notdir $1)
|
||||||
|
|
||||||
# Strip the modules when we install them so that they will be extra small
|
# 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, \
|
$(call do,INSTALL-MODULE,$1, \
|
||||||
$(CROSS)strip \
|
$(CROSS)strip \
|
||||||
--preserve-dates \
|
--preserve-dates \
|
||||||
@ -134,7 +133,7 @@ endef
|
|||||||
$(call map,linux_module,$(linux_modules-y))
|
$(call map,linux_module,$(linux_modules-y))
|
||||||
|
|
||||||
# We can't rebuild the module initrd until the kernel has been rebuilt
|
# 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))
|
$(call do-cpio,$@,$(module_initrd_dir))
|
||||||
@$(RM) -rf "$(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
|
# The output of the linux.intermediate is the bzImage in the
|
||||||
# linus build directory. We need to copy it into our board
|
# linus build directory. We need to copy it into our board
|
||||||
# specific directory for ease of locating it later.
|
# specific directory for ease of locating it later.
|
||||||
$(linux_board_dir)/arch/x86/boot/bzImage: linux.intermediate
|
$(build)/$(BOARD)/bzImage: $(build)/$(linux_dir)/arch/x86/boot/bzImage
|
||||||
$(build)/$(BOARD)/bzImage: $(linux_board_dir)/arch/x86/boot/bzImage
|
|
||||||
$(call do-copy,$<,$@)
|
$(call do-copy,$<,$@)
|
||||||
|
|
||||||
|
|
||||||
# menuconfig target allows us to easily reconfigure this Linux kernel
|
# menuconfig target allows us to easily reconfigure this Linux kernel
|
||||||
linux.menuconfig:
|
linux.menuconfig:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
-C "$(build)/$(linux_dir)" \
|
-C "$(build)/$(linux_base_dir)" \
|
||||||
O="$(linux_board_dir)" \
|
O="$(build)/$(linux_dir)" \
|
||||||
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
||||||
menuconfig \
|
menuconfig \
|
||||||
|
@ -2,25 +2,27 @@ modules-$(CONFIG_LINUXBOOT) += linuxboot
|
|||||||
|
|
||||||
linuxboot_version := git
|
linuxboot_version := git
|
||||||
linuxboot_repo := https://github.com/osresearch/linuxboot
|
linuxboot_repo := https://github.com/osresearch/linuxboot
|
||||||
linuxboot_dir := linuxboot-$(linuxboot_version)
|
linuxboot_base_dir := linuxboot-$(linuxboot_version)
|
||||||
|
|
||||||
# linuxboot builds are specialized on a per-target basis.
|
# linuxboot builds are specialized on a per-target basis.
|
||||||
# They can be specialized by defining $(CONFIG_LINUXBOOT_BOARD)
|
# They can be specialized by defining $(CONFIG_LINUXBOOT_BOARD)
|
||||||
# otherwise it is assumed that it will have the same name
|
# otherwise it is assumed that it will have the same name
|
||||||
# as the Heads BOARD.
|
# as the Heads BOARD.
|
||||||
linuxboot_board := $(or $(CONFIG_LINUXBOOT_BOARD),$(BOARD))
|
linuxboot_board := $(or $(CONFIG_LINUXBOOT_BOARD),$(BOARD))
|
||||||
|
linuxboot_dir := linuxboot-$(linuxboot_version)/build/$(linuxboot_board)
|
||||||
|
|
||||||
linuxboot_configure := \
|
linuxboot_configure := \
|
||||||
echo >&2 "Pre-building edk2" ; \
|
echo >&2 "Pre-building edk2" ; \
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
|
-C $(build)/$(linuxboot_base_dir) \
|
||||||
BOARD=$(linuxboot_board) \
|
BOARD=$(linuxboot_board) \
|
||||||
edk2.force \
|
edk2.force \
|
||||||
|| exit 1 ; \
|
|| exit 1 ; \
|
||||||
if [ "$(linuxboot_board)" = "qemu" ]; then \
|
if [ "$(linuxboot_board)" = "qemu" ]; then \
|
||||||
echo >&2 "Pre-building edk2 OVMF" ; \
|
echo >&2 "Pre-building edk2 OVMF" ; \
|
||||||
( cd edk2/OvmfPkg ; ./build.sh -n `nproc` ) \
|
( cd $(build)/$(linuxboot_base_dir)/edk2/OvmfPkg ; \
|
||||||
|| exit 1 ; \
|
./build.sh -n `nproc` \
|
||||||
|
) || exit 1 ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
touch .config ; \
|
touch .config ; \
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ ifdef CUSTOM
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
linuxboot_target := \
|
linuxboot_target := \
|
||||||
|
-C $(build)/$(linuxboot_base_dir) \
|
||||||
BOARD=$(linuxboot_board) \
|
BOARD=$(linuxboot_board) \
|
||||||
KERNEL=$(build)/$(BOARD)/bzImage \
|
KERNEL=$(build)/$(BOARD)/bzImage \
|
||||||
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
||||||
@ -45,37 +48,29 @@ ifneq "y" "$(shell [ -r '$(CONFIG_LINUXBOOT_ROM)' ] && echo y)"
|
|||||||
$(error $(CONFIG_LINUXBOOT_ROM): you must provide a ROM file)
|
$(error $(CONFIG_LINUXBOOT_ROM): you must provide a ROM file)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Force a rebuild of the LinuxBoot ROM if the vendor ROM changes
|
|
||||||
linuxboot.intermediate: $(CONFIG_LINUXBOOT_ROM)
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# The output file from the LinuxBoot build is a full ROM
|
# The output file from the LinuxBoot build is a full ROM
|
||||||
# ready to flash onto the mainboard. There might be partial
|
# ready to flash onto the mainboard. There might be partial
|
||||||
# firmware volumes as well, but that depends on the board
|
# firmware volumes as well, but that depends on the board
|
||||||
# so this only retrieves the final one
|
# 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: $(build)/$(linuxboot_dir)/.build
|
||||||
|
$(call do-copy,$(dir $<)linuxboot.rom,$@)
|
||||||
|
@touch $@
|
||||||
|
|
||||||
$(build)/$(BOARD)/linuxboot.rom: $(linuxboot_output)
|
# Also force a rebuild if any of the input files are updated
|
||||||
$(call do-copy,$<,$@)
|
$(build)/$(linuxboot_dir)/.build: \
|
||||||
|
$(CONFIG_LINUXBOOT_ROM) \
|
||||||
# The Linux kernel and Heads initrd must be built before linuxboot
|
$(build)/$(BOARD)/bzImage \
|
||||||
# unless the user has specified "FAST=1" on the make command line,
|
$(build)/$(BOARD)/initrd.cpio.xz \
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
linuxboot.run: $(build)/$(BOARD)/linuxboot.rom
|
linuxboot.run: $(build)/$(BOARD)/linuxboot.rom
|
||||||
$(MAKE) -C $(build)/$(linuxboot_dir) \
|
$(MAKE) -C $(build)/$(linuxboot_base_dir) \
|
||||||
BOARD:=$(linuxboot_board) \
|
BOARD:=$(linuxboot_board) \
|
||||||
KERNEL=$(build)/$(BOARD)/bzImage \
|
KERNEL=$(build)/$(BOARD)/bzImage \
|
||||||
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
||||||
|
@ -38,12 +38,13 @@ musl_depends := musl-cross
|
|||||||
|
|
||||||
# Fake a target so that musl will force a header install by the
|
# Fake a target so that musl will force a header install by the
|
||||||
# Linux kernel sources.
|
# Linux kernel sources.
|
||||||
musl.intermediate: $(INSTALL)/include/linux/limits.h
|
$(build)/$(musl_dir)/.build: $(INSTALL)/include/linux/limits.h
|
||||||
$(INSTALL)/include/linux/limits.h: $(build)/$(linux_dir)/.canary
|
|
||||||
|
$(INSTALL)/include/linux/limits.h: $(build)/$(linux_base_dir)/.canary
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
-C "$(build)/$(linux_dir)" \
|
-C "$(build)/$(linux_base_dir)" \
|
||||||
INSTALL_HDR_PATH="$(INSTALL)" \
|
INSTALL_HDR_PATH="$(INSTALL)" \
|
||||||
O="$(linux_board_dir)" \
|
O="$(linux_dir)" \
|
||||||
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
||||||
headers_install
|
headers_install
|
||||||
|
|
||||||
|
@ -2,12 +2,6 @@ ifeq "$(MUSL_CROSS_ONCE)" ""
|
|||||||
MUSL_CROSS_ONCE := 1
|
MUSL_CROSS_ONCE := 1
|
||||||
|
|
||||||
|
|
||||||
# Allow the path to the musl-cross directory to be passed on
|
|
||||||
# the environment so that the full path doens't need to be spelled out
|
|
||||||
ifneq "$(MUSL_DIR)" ""
|
|
||||||
CROSS := $(MUSL_DIR)/crossgcc/x86_64-linux-musl/bin/x86_64-linux-musl-
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq "$(CROSS)" ""
|
ifneq "$(CROSS)" ""
|
||||||
|
|
||||||
# check that $(CROSS)gcc exists or else things just won't work
|
# check that $(CROSS)gcc exists or else things just won't work
|
||||||
@ -17,7 +11,12 @@ endif
|
|||||||
|
|
||||||
# The cross compiler has already been built, so the musl-cross target
|
# The cross compiler has already been built, so the musl-cross target
|
||||||
# is a NOP.
|
# is a NOP.
|
||||||
musl-cross.intermediate:
|
#musl-cross.intermediate:
|
||||||
|
|
||||||
|
musl-cross_dir := musl-cross-ext
|
||||||
|
$(build)/$(musl-cross_dir)/.build:
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
touch $@
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -28,8 +27,9 @@ musl-cross_version := git
|
|||||||
musl-cross_dir := musl-cross-$(musl-cross_version)
|
musl-cross_dir := musl-cross-$(musl-cross_version)
|
||||||
musl-cross_repo := https://github.com/GregorR/musl-cross
|
musl-cross_repo := https://github.com/GregorR/musl-cross
|
||||||
|
|
||||||
CROSS := $(build)/../crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-
|
CROSS_TOP := crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-
|
||||||
musl-cross_output := $(CROSS)gcc
|
CROSS := $(build)/../$(CROSS_TOP)
|
||||||
|
musl-cross_output := ../../$(CROSS_TOP)gcc
|
||||||
|
|
||||||
musl-cross_configure := \
|
musl-cross_configure := \
|
||||||
/bin/echo -e > Makefile \
|
/bin/echo -e > Makefile \
|
||||||
|
@ -42,6 +42,6 @@ pciutils_output := \
|
|||||||
lspci \
|
lspci \
|
||||||
|
|
||||||
pciutils_libraries := \
|
pciutils_libraries := \
|
||||||
../../install/lib/libpci.so.3 \
|
lib/libpci.so.3.5.4 \
|
||||||
|
|
||||||
pciutils_configure :=
|
pciutils_configure :=
|
||||||
|
@ -47,7 +47,7 @@ CONFIG_HEADS=n
|
|||||||
|
|
||||||
# Since we do not include u-root in modules-y, we have to define our
|
# Since we do not include u-root in modules-y, we have to define our
|
||||||
# own intermediate and clean targets here
|
# own intermediate and clean targets here
|
||||||
u-root.intermediate: $(u-root_output)
|
$(build)/$(u-root_dir)/.build: $(u-root_output)
|
||||||
u-root.clean:
|
u-root.clean:
|
||||||
$(RM) $(u-root_output)
|
$(RM) $(u-root_output)
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user