mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-23 14:52:27 +00:00
perform per-board Linux builds
This commit is contained in:
parent
47a94da5ed
commit
22f7442710
22
Makefile
22
Makefile
@ -61,7 +61,6 @@ initrd_lib_dir := $(initrd_dir)/lib
|
|||||||
initrd_bin_dir := $(initrd_dir)/bin
|
initrd_bin_dir := $(initrd_dir)/bin
|
||||||
|
|
||||||
$(shell mkdir -p "$(initrd_lib_dir)" "$(initrd_bin_dir)")
|
$(shell mkdir -p "$(initrd_lib_dir)" "$(initrd_bin_dir)")
|
||||||
$(shell echo "Initrd: $initrd_dir")
|
|
||||||
|
|
||||||
#ifeq "$(CONFIG)" ""
|
#ifeq "$(CONFIG)" ""
|
||||||
#CONFIG := config/qemu-moc.config
|
#CONFIG := config/qemu-moc.config
|
||||||
@ -163,7 +162,7 @@ define do-cpio =
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define do-copy =
|
define do-copy =
|
||||||
$(call do,CP,$2,\
|
$(call do,COPY,$(2:$(pwd)/%=%),\
|
||||||
sha256sum "$(1:$(pwd)/%=%)" ; \
|
sha256sum "$(1:$(pwd)/%=%)" ; \
|
||||||
if ! cmp --quiet "$1" "$2" ; then \
|
if ! cmp --quiet "$1" "$2" ; then \
|
||||||
cp -a "$1" "$2"; \
|
cp -a "$1" "$2"; \
|
||||||
@ -209,20 +208,26 @@ define define_module =
|
|||||||
@touch "$$@"
|
@touch "$$@"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Allow the module to override the destination configuration file
|
||||||
|
# via a relative path. Linux uses this to have a per-board build.
|
||||||
|
$(eval $1_config_file_path := $(build)/$($1_dir)/$(or $($1_config_file),.config))
|
||||||
|
|
||||||
ifeq "$($1_config)" ""
|
ifeq "$($1_config)" ""
|
||||||
# There is no official .config file
|
# There is no official .config file
|
||||||
$(build)/$($1_dir)/.config: $(build)/$($1_dir)/.canary
|
$($1_config_file_path): $(build)/$($1_dir)/.canary
|
||||||
|
@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
|
||||||
$(build)/$($1_dir)/.config: config/$($1_config) $(build)/$($1_dir)/.canary
|
$($1_config_file_path): config/$($1_config) $(build)/$($1_dir)/.canary
|
||||||
$(call do,COPY,"$$<",cp "$$<" "$$@")
|
@mkdir -p $$(dir $$@)
|
||||||
|
$(call do-copy,config/$($1_config),$$@)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Use the module's configure variable to build itself
|
# Use the module's configure variable to build itself
|
||||||
$(build)/$($1_dir)/.configured: \
|
$(dir $($1_config_file_path))/.configured: \
|
||||||
$(build)/$($1_dir)/.canary \
|
$(build)/$($1_dir)/.canary \
|
||||||
$(build)/$($1_dir)/.config \
|
$($1_config_file_path) \
|
||||||
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
||||||
modules/$1
|
modules/$1
|
||||||
@echo "$(DATE) CONFIG $1"
|
@echo "$(DATE) CONFIG $1"
|
||||||
@ -247,7 +252,8 @@ define define_module =
|
|||||||
$1.intermediate: \
|
$1.intermediate: \
|
||||||
$(foreach d,$($1_depends),$d.intermediate) \
|
$(foreach d,$($1_depends),$d.intermediate) \
|
||||||
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
$(foreach d,$($1_depends),$(call outputs,$d)) \
|
||||||
$(build)/$($1_dir)/.configured
|
$(dir $($1_config_file_path))/.configured \
|
||||||
|
|
||||||
@echo "$(DATE) MAKE $1"
|
@echo "$(DATE) MAKE $1"
|
||||||
@( \
|
@( \
|
||||||
echo "$(MAKE) \
|
echo "$(MAKE) \
|
||||||
|
@ -5,15 +5,23 @@ linux_dir := linux-$(linux_version)
|
|||||||
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)
|
||||||
|
|
||||||
linux-4.9.7_hash := 0b61283b71c7397cb6b5ac3497845d3cdf8137ecd16ab39c8ac6cf5bb90e33dc
|
|
||||||
linux-4.9.20_hash := 48660806dd32fb8dcbcf5932291bf6cc7d29240070372230871e0f56fea81341
|
|
||||||
linux-4.9.38_hash := 76d789d87dd51d2fd58c095727171984fa4a992f5e25b9e3eb1e5fd5cd129074
|
linux-4.9.38_hash := 76d789d87dd51d2fd58c095727171984fa4a992f5e25b9e3eb1e5fd5cd129074
|
||||||
|
|
||||||
linux_hash := $(linux-$(linux_version)_hash)
|
linux_hash := $(linux-$(linux_version)_hash)
|
||||||
|
|
||||||
|
linux_board_dir := $(build)/$(linux_dir)/$(BOARD)
|
||||||
|
|
||||||
|
# input file in the heads config/ dir
|
||||||
|
# Allow board config to specialize Linux configuration if necessary
|
||||||
|
linux_config ?= linux.config
|
||||||
|
|
||||||
|
# output file in the build dir
|
||||||
|
linux_config_file := $(BOARD)/.config
|
||||||
|
|
||||||
linux_configure := \
|
linux_configure := \
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
CROSS_COMPILE="$(CROSS)" \
|
CROSS_COMPILE="$(CROSS)" \
|
||||||
|
O="$(linux_board_dir)" \
|
||||||
oldconfig \
|
oldconfig \
|
||||||
|
|
||||||
linux_output += $(build)/$(BOARD)/bzImage
|
linux_output += $(build)/$(BOARD)/bzImage
|
||||||
@ -21,7 +29,6 @@ linux_output += $(build)/$(BOARD)/bzImage
|
|||||||
# linux.intermediate: $(linux_output)
|
# linux.intermediate: $(linux_output)
|
||||||
#linux_output += $(build)/$(BOARD)/modules.cpio
|
#linux_output += $(build)/$(BOARD)/modules.cpio
|
||||||
|
|
||||||
linux_config ?= linux.config # Allow board config to specialize Linux
|
|
||||||
|
|
||||||
# qemu
|
# qemu
|
||||||
linux_modules-$(CONFIG_LINUX_E1000) += drivers/net/ethernet/intel/e1000/e1000.ko
|
linux_modules-$(CONFIG_LINUX_E1000) += drivers/net/ethernet/intel/e1000/e1000.ko
|
||||||
@ -61,6 +68,7 @@ linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/storage/usb-storage.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)" \
|
||||||
CROSS_COMPILE="$(CROSS)" \
|
CROSS_COMPILE="$(CROSS)" \
|
||||||
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
||||||
CFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
CFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
||||||
@ -87,13 +95,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
|
||||||
$(build)/$(linux_dir)/$1: linux.intermediate # $(build)/$(BOARD)/bzImage
|
$(linux_board_dir)/$1: linux.intermediate # $(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): $(build)/$(linux_dir)/$1
|
$(module_initrd_lib_dir)/$(notdir $1): $(linux_board_dir)/$1
|
||||||
$(call do,INSTALL-MODULE,$1, \
|
$(call do,INSTALL-MODULE,$1, \
|
||||||
$(CROSS)strip \
|
$(CROSS)strip \
|
||||||
--preserve-dates \
|
--preserve-dates \
|
||||||
@ -113,6 +121,6 @@ $(build)/$(BOARD)/modules.cpio: linux.intermediate
|
|||||||
|
|
||||||
# hack for the coreboot to find the linux kernel
|
# hack for the coreboot to find the linux kernel
|
||||||
$(build)/$(BOARD)/bzImage: linux.intermediate
|
$(build)/$(BOARD)/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,$<,$@)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user