Support generation of bundled kernel

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This commit is contained in:
Sergii Dmytruk 2021-07-18 20:35:59 +03:00
parent 9339394b69
commit 97dc552d28
No known key found for this signature in database
GPG Key ID: 48579AA47429663E
2 changed files with 19 additions and 0 deletions

View File

@ -123,6 +123,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.
@ -568,6 +572,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.

View File

@ -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