mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-18 10:46:44 +00:00
Merge pull request #1011 from SergiiDmytruk/build-enhancements
Build enhancements
This commit is contained in:
commit
60081318b5
43
Makefile
43
Makefile
@ -9,8 +9,9 @@ GIT_STATUS := $(shell \
|
||||
fi)
|
||||
HEADS_GIT_VERSION := $(shell git describe --tags --dirty)
|
||||
|
||||
CB_OUTPUT_FILE := heads-$(BOARD)-$(HEADS_GIT_VERSION).rom
|
||||
LB_OUTPUT_FILE := linuxboot-$(BOARD)-$(HEADS_GIT_VERSION).rom
|
||||
CB_OUTPUT_FILE := heads-$(BOARD)-$(HEADS_GIT_VERSION).rom
|
||||
CB_BOOTBLOCK_FILE := heads-$(BOARD)-$(HEADS_GIT_VERSION).bootblock
|
||||
LB_OUTPUT_FILE := linuxboot-$(BOARD)-$(HEADS_GIT_VERSION).rom
|
||||
|
||||
all:
|
||||
-include .config
|
||||
@ -123,6 +124,10 @@ BOARD_LOG := $(shell \
|
||||
echo "$(DATE) $(GIT_HASH) $(GIT_STATUS)" > "$(HASHES)" ; \
|
||||
)
|
||||
|
||||
ifeq "y" "$(CONFIG_LINUX_BUNDLED)"
|
||||
# Create empty initrd for initial kernel "without" initrd.
|
||||
$(shell cpio -o < /dev/null > $(build)/$(BOARD)/initrd.cpio)
|
||||
endif
|
||||
|
||||
# If V is set in the environment, do not redirect the tee
|
||||
# command to /dev/null.
|
||||
@ -191,7 +196,12 @@ CROSS_TOOLS := \
|
||||
|
||||
|
||||
ifeq ($(CONFIG_COREBOOT), y)
|
||||
|
||||
all: $(build)/$(BOARD)/$(CB_OUTPUT_FILE)
|
||||
ifneq ($(CONFIG_COREBOOT_BOOTBLOCK),)
|
||||
all: $(build)/$(BOARD)/$(CB_BOOTBLOCK_FILE)
|
||||
endif
|
||||
|
||||
else ifeq ($(CONFIG_LINUXBOOT), y)
|
||||
all: $(build)/$(BOARD)/$(LB_OUTPUT_FILE)
|
||||
else
|
||||
@ -289,20 +299,21 @@ define define_module =
|
||||
$(eval $1_base_dir = $(or $($1_base_dir),$($1_dir)))
|
||||
|
||||
ifneq ("$($1_repo)","")
|
||||
$(eval $1_patch_name = $1$(if $($1_patch_version),-$($1_patch_version),))
|
||||
# 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_base_dir)/.canary:
|
||||
git clone $($1_repo) "$(build)/$($1_base_dir)"
|
||||
cd $(build)/$($1_base_dir) && git submodule update --init --checkout
|
||||
if [ -r patches/$1.patch ]; then \
|
||||
if [ -r patches/$($1_patch_name).patch ]; then \
|
||||
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
|
||||
< patches/$1.patch \
|
||||
< patches/$($1_patch_name).patch \
|
||||
|| exit 1 ; \
|
||||
fi
|
||||
if [ -d patches/$1 ] && \
|
||||
[ -r patches/$1 ] ; then \
|
||||
for patch in patches/$1/*.patch ; do \
|
||||
if [ -d patches/$($1_patch_name) ] && \
|
||||
[ -r patches/$($1_patch_name) ] ; then \
|
||||
for patch in patches/$($1_patch_name)/*.patch ; do \
|
||||
echo "Applying patch file : $$$$patch " ; \
|
||||
( cd $(build)/$($1_base_dir) ; patch -p1 ) \
|
||||
< $$$$patch \
|
||||
@ -311,6 +322,8 @@ define define_module =
|
||||
fi
|
||||
@touch "$$@"
|
||||
else
|
||||
$(eval $1_patch_version ?= $($1_version))
|
||||
$(eval $1_patch_name = $1-$($1_patch_version))
|
||||
# Fetch and verify the source tar file
|
||||
# wget creates it early, so we have to cleanup if it fails
|
||||
$(packages)/$($1_tar):
|
||||
@ -329,14 +342,14 @@ define define_module =
|
||||
$(build)/$($1_base_dir)/.canary: $(packages)/.$1-$($1_version)_verify
|
||||
mkdir -p "$$(dir $$@)"
|
||||
tar -xf "$(packages)/$($1_tar)" $(or $($1_tar_opt),--strip 1) -C "$$(dir $$@)"
|
||||
if [ -r patches/$1-$($1_version).patch ]; then \
|
||||
if [ -r patches/$($1_patch_name).patch ]; then \
|
||||
( cd $$(dir $$@) ; patch -p1 ) \
|
||||
< patches/$1-$($1_version).patch \
|
||||
< patches/$($1_patch_name).patch \
|
||||
|| exit 1 ; \
|
||||
fi
|
||||
if [ -d patches/$1-$($1_version) ] && \
|
||||
[ -r patches/$1-$($1_version) ] ; then \
|
||||
for patch in patches/$1-$($1_version)/*.patch ; do \
|
||||
if [ -d patches/$($1_patch_name) ] && \
|
||||
[ -r patches/$($1_patch_name) ] ; then \
|
||||
for patch in patches/$($1_patch_name)/*.patch ; do \
|
||||
echo "Applying patch file : $$$$patch " ; \
|
||||
( cd $$(dir $$@) ; patch -p1 ) \
|
||||
< $$$$patch \
|
||||
@ -569,6 +582,12 @@ $(build)/$(initrd_dir)/initrd.cpio.xz: $(initrd-y)
|
||||
fi
|
||||
@sha256sum "$(@:$(pwd)/%=%)" | tee -a "$(HASHES)"
|
||||
|
||||
#
|
||||
# At the moment PowerPC can only load initrd bundled with the kernel.
|
||||
#
|
||||
bundle-$(CONFIG_LINUX_BUNDLED) += $(build)/$(BOARD)/$(LINUX_IMAGE_FILE).bundled
|
||||
all: $(bundle-y)
|
||||
|
||||
#
|
||||
# The heads.cpio is built from the initrd directory in the
|
||||
# Heads tree.
|
||||
|
@ -2,6 +2,9 @@ modules-$(CONFIG_COREBOOT) += coreboot
|
||||
|
||||
ifeq "$(CONFIG_COREBOOT)" "y"
|
||||
|
||||
CONFIG_COREBOOT_ROM ?= coreboot.rom
|
||||
CONFIG_COREBOOT_BOOTBLOCK ?=
|
||||
|
||||
ifeq "$(CONFIG_COREBOOT_VERSION)" "4.8.1"
|
||||
coreboot_version := 4.8.1
|
||||
coreboot_hash := f0ddf4db0628c1fe1e8348c40084d9cbeb5771400c963fd419cda3995b69ad23
|
||||
@ -67,7 +70,8 @@ coreboot_target := \
|
||||
CFLAGS_x86_64="$(EXTRA_FLAGS)" \
|
||||
$(MAKE_JOBS)
|
||||
|
||||
coreboot_output := coreboot.rom
|
||||
coreboot_output := $(CONFIG_COREBOOT_ROM)
|
||||
coreboot_output += $(CONFIG_COREBOOT_BOOTBLOCK)
|
||||
coreboot_depend += linux initrd $(musl_dep)
|
||||
|
||||
COREBOOT_TOOLCHAIN="$(build)/$(coreboot_base_dir)/.xcompile"
|
||||
@ -85,10 +89,19 @@ $(build)/$(coreboot_dir)/.build: \
|
||||
|
||||
# This produces a ROM image that is written with the flashrom program
|
||||
ifneq ($(CONFIG_COREBOOT),)
|
||||
|
||||
$(build)/$(BOARD)/$(CB_OUTPUT_FILE): $(build)/$(coreboot_dir)/.build
|
||||
# Use coreboot.rom, because custom output files might not be processed by cbfstool
|
||||
"$(build)/$(coreboot_dir)/cbfstool" "$(dir $<)coreboot.rom" print
|
||||
$(call do-copy,$(dir $<)coreboot.rom,$@)
|
||||
$(call do-copy,$(dir $<)$(CONFIG_COREBOOT_ROM),$@)
|
||||
@touch $@ # update the time stamp
|
||||
|
||||
ifneq ($(CONFIG_COREBOOT_BOOTBLOCK),)
|
||||
$(build)/$(BOARD)/$(CB_BOOTBLOCK_FILE): $(build)/$(coreboot_dir)/.build
|
||||
$(call do-copy,$(dir $<)$(CONFIG_COREBOOT_BOOTBLOCK),$@)
|
||||
@touch $@ # update the time stamp
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
|
@ -172,6 +172,15 @@ $(build)/$(BOARD)/bzImage: $(build)/$(linux_dir)/.build
|
||||
@touch $@ # force a timestamp update
|
||||
@sha256sum "$@" | tee -a "$(HASHES)"
|
||||
|
||||
# Build kernel second time, now that initrd is built.
|
||||
$(build)/$(BOARD)/$(LINUX_IMAGE_FILE).bundled: \
|
||||
$(build)/$(initrd_dir)/initrd.cpio.xz \
|
||||
$(build)/$(BOARD)/$(LINUX_IMAGE_FILE)
|
||||
xz --decompress --stdout --force "$<" > $(build)/$(initrd_dir)/initrd.cpio
|
||||
$(MAKE) -C "$(build)/$(linux_dir)" $(linux_target)
|
||||
$(call do-copy,$(build)/$(linux_dir)/$(linux_output),$@)
|
||||
@touch $@ # force a timestamp update
|
||||
@sha256sum "$@" | tee -a "$(HASHES)"
|
||||
|
||||
# menuconfig target allows us to easily reconfigure this Linux kernel
|
||||
# Afterwars make linux.saveconfig to generate a minimal config from it
|
||||
|
@ -44,6 +44,7 @@ CROSS_PATH ?= $(pwd)/crossgcc
|
||||
musl-cross_target := \
|
||||
OUTPUT="$(CROSS_PATH)" \
|
||||
MAKE="$(MAKE)" \
|
||||
$(MAKE_JOBS) \
|
||||
both
|
||||
|
||||
CROSS := $(CROSS_PATH)/bin/x86_64-linux-musl-
|
||||
|
Loading…
Reference in New Issue
Block a user