mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-19 04:57:55 +00:00
Add LinuxBoot as a module, prep for nerf branch merge (#305)
Move board configuration into `boards/` instead of `config/` Fix mistake in building kernel module tree before kernel was done. Allow per-board initrd builds (#278) Allow per-board configurations for things (#304)
This commit is contained in:
parent
755c9e91ea
commit
cf8509e0f5
169
Makefile
169
Makefile
@ -4,16 +4,25 @@ modules-y :=
|
|||||||
pwd := $(shell pwd)
|
pwd := $(shell pwd)
|
||||||
packages := $(pwd)/packages
|
packages := $(pwd)/packages
|
||||||
build := $(pwd)/build
|
build := $(pwd)/build
|
||||||
config := $(pwd)/build
|
config := $(pwd)/config
|
||||||
INSTALL := $(pwd)/install
|
INSTALL := $(pwd)/install
|
||||||
log_dir := $(build)/log
|
log_dir := $(build)/log
|
||||||
|
|
||||||
|
BOARD ?= qemu
|
||||||
|
CONFIG := $(pwd)/boards/$(BOARD).config
|
||||||
|
|
||||||
|
ifneq "y" "$(shell [ -r '$(CONFIG)' ] && echo y)"
|
||||||
|
$(error $(CONFIG): board configuration does not exist)
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(CONFIG)
|
||||||
|
|
||||||
# Controls how many parallel jobs are invoked in subshells
|
# Controls how many parallel jobs are invoked in subshells
|
||||||
CPUS := $(shell nproc)
|
CPUS := $(shell nproc)
|
||||||
MAKE_JOBS ?= -j$(CPUS) --max-load 16
|
MAKE_JOBS ?= -j$(CPUS) --max-load 16
|
||||||
|
|
||||||
# Create the log directory if it doesn't already exist
|
# Create the log directory if it doesn't already exist
|
||||||
BUILD_LOG := $(shell [ -d "$(log_dir)" ] || mkdir -p "$(log_dir)")
|
BUILD_LOG := $(shell mkdir -p "$(log_dir)" "$(build)/$(BOARD)" )
|
||||||
|
|
||||||
# Some things want usernames, we use the current checkout
|
# Some things want usernames, we use the current checkout
|
||||||
# so that they are reproducible
|
# so that they are reproducible
|
||||||
@ -28,13 +37,13 @@ ifeq "$V" ""
|
|||||||
VERBOSE_REDIRECT := > /dev/null
|
VERBOSE_REDIRECT := > /dev/null
|
||||||
# Not verbose, so we only show the header
|
# Not verbose, so we only show the header
|
||||||
define do =
|
define do =
|
||||||
@echo "$(DATE) $1 $2"
|
@echo "$(DATE) $1 $(2:$(pwd)/%=%)"
|
||||||
@$3
|
@$3
|
||||||
endef
|
endef
|
||||||
else
|
else
|
||||||
# Verbose, so we display what we are doing
|
# Verbose, so we display what we are doing
|
||||||
define do =
|
define do =
|
||||||
@echo "$(DATE) $1 $2"
|
@echo "$(DATE) $1 $(2:$(pwd)/%=%)"
|
||||||
$3
|
$3
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
@ -54,12 +63,12 @@ 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")
|
$(shell echo "Initrd: $initrd_dir")
|
||||||
|
|
||||||
ifeq "$(CONFIG)" ""
|
#ifeq "$(CONFIG)" ""
|
||||||
CONFIG := config/qemu-moc.config
|
#CONFIG := config/qemu-moc.config
|
||||||
$(eval $(shell echo >&2 "$(DATE) CONFIG is not set, defaulting to $(CONFIG)"))
|
#$(eval $(shell echo >&2 "$(DATE) CONFIG is not set, defaulting to $(CONFIG)"))
|
||||||
endif
|
#endif
|
||||||
|
#
|
||||||
include $(CONFIG)
|
#include $(CONFIG)
|
||||||
|
|
||||||
# We are running our own version of make,
|
# We are running our own version of make,
|
||||||
# proceed with the build.
|
# proceed with the build.
|
||||||
@ -68,9 +77,6 @@ include $(CONFIG)
|
|||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
.SHELLFLAGS := -o pipefail -c
|
.SHELLFLAGS := -o pipefail -c
|
||||||
|
|
||||||
# Currently supported targets are x230, chell and qemu
|
|
||||||
BOARD ?= qemu
|
|
||||||
|
|
||||||
# If musl-libc is being used in the initrd, set the heads_cc
|
# If musl-libc is being used in the initrd, set the heads_cc
|
||||||
# variable to point to it.
|
# variable to point to it.
|
||||||
musl_dep := musl
|
musl_dep := musl
|
||||||
@ -95,8 +101,10 @@ CROSS_TOOLS := \
|
|||||||
|
|
||||||
ifeq "$(CONFIG_COREBOOT)" "y"
|
ifeq "$(CONFIG_COREBOOT)" "y"
|
||||||
all: $(BOARD).rom
|
all: $(BOARD).rom
|
||||||
|
else ifeq "$(CONFIG_LINUXBOOT)" "y"
|
||||||
|
all: $(build)/$(BOARD)/linuxboot.rom
|
||||||
else
|
else
|
||||||
all: linux.intermediate initrd-$(BOARD).cpio.xz
|
$(error "$(BOARD): neither CONFIG_COREBOOT nor CONFIG_LINUXBOOT is set?")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Disable all built in rules
|
# Disable all built in rules
|
||||||
@ -134,6 +142,36 @@ $(foreach m,$1,\
|
|||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build a cpio from a directory
|
||||||
|
#
|
||||||
|
define do-cpio =
|
||||||
|
$(call do,CPIO,$1,\
|
||||||
|
( cd "$2"; \
|
||||||
|
find . \
|
||||||
|
| cpio \
|
||||||
|
--quiet \
|
||||||
|
-H newc \
|
||||||
|
-o \
|
||||||
|
) > "$1.tmp" \
|
||||||
|
)
|
||||||
|
@if ! cmp --quiet "$1.tmp" "$1" ; then \
|
||||||
|
mv "$1.tmp" "$1" ; \
|
||||||
|
else \
|
||||||
|
rm "$1.tmp" ; \
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
define do-copy =
|
||||||
|
$(call do,CP,$2,\
|
||||||
|
sha256sum "$(1:$(pwd)/%=%)" ; \
|
||||||
|
if ! cmp --quiet "$1" "$2" ; then \
|
||||||
|
cp -a "$1" "$2"; \
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generate the targets for a module.
|
# Generate the targets for a module.
|
||||||
#
|
#
|
||||||
@ -257,7 +295,7 @@ endef
|
|||||||
#
|
#
|
||||||
define initrd_bin_add =
|
define initrd_bin_add =
|
||||||
$(initrd_bin_dir)/$(notdir $1): $1
|
$(initrd_bin_dir)/$(notdir $1): $1
|
||||||
$(call do,INSTALL-BIN,$$<,cp -a "$$<" "$$@")
|
$(call do,INSTALL-BIN,$$(<:$(pwd)/%=%),cp -a "$$<" "$$@")
|
||||||
@$(CROSS)strip --preserve-dates "$$@" 2>&-; true
|
@$(CROSS)strip --preserve-dates "$$@" 2>&-; true
|
||||||
initrd_bins += $(initrd_bin_dir)/$(notdir $1)
|
initrd_bins += $(initrd_bin_dir)/$(notdir $1)
|
||||||
endef
|
endef
|
||||||
@ -265,11 +303,13 @@ endef
|
|||||||
|
|
||||||
define initrd_lib_add =
|
define initrd_lib_add =
|
||||||
$(initrd_lib_dir)/$(notdir $1): $1
|
$(initrd_lib_dir)/$(notdir $1): $1
|
||||||
$(call do,INSTALL-LIB,$$@,$(CROSS)strip --preserve-dates -o "$$@" "$$<")
|
$(call do,INSTALL-LIB,$(1:$(pwd)/%=%),\
|
||||||
|
$(CROSS)strip --preserve-dates -o "$$@" "$$<")
|
||||||
initrd_libs += $(initrd_lib_dir)/$(notdir $1)
|
initrd_libs += $(initrd_lib_dir)/$(notdir $1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Only some modules have binaries that we install
|
# Only some modules have binaries that we install
|
||||||
|
# Shouldn't this be specified in the module file?
|
||||||
bin_modules-$(CONFIG_KEXEC) += kexec
|
bin_modules-$(CONFIG_KEXEC) += kexec
|
||||||
bin_modules-$(CONFIG_TPMTOTP) += tpmtotp
|
bin_modules-$(CONFIG_TPMTOTP) += tpmtotp
|
||||||
bin_modules-$(CONFIG_PCIUTILS) += pciutils
|
bin_modules-$(CONFIG_PCIUTILS) += pciutils
|
||||||
@ -292,7 +332,7 @@ $(foreach m, $(modules-y), \
|
|||||||
#$(foreach _, $(call outputs,xen), $(eval $(call initrd_bin,$_)))
|
#$(foreach _, $(call outputs,xen), $(eval $(call initrd_bin,$_)))
|
||||||
|
|
||||||
# hack to install busybox into the initrd
|
# hack to install busybox into the initrd
|
||||||
initrd-$(BOARD).cpio: busybox.intermediate
|
$(build)/$(BOARD)/heads.cpio: busybox.intermediate
|
||||||
initrd_bins += $(initrd_bin_dir)/busybox
|
initrd_bins += $(initrd_bin_dir)/busybox
|
||||||
|
|
||||||
$(initrd_bin_dir)/busybox: $(build)/$(busybox_dir)/busybox
|
$(initrd_bin_dir)/busybox: $(build)/$(busybox_dir)/busybox
|
||||||
@ -320,22 +360,6 @@ $(build)/$(coreboot_dir)/util/cbmem/cbmem: \
|
|||||||
$(MAKE) -C "$(dir $@)" CC="$(heads_cc)" \
|
$(MAKE) -C "$(dir $@)" CC="$(heads_cc)" \
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
|
||||||
# Linux kernel module installation
|
|
||||||
#
|
|
||||||
# This is special cases since we have to do a special strip operation on
|
|
||||||
# the kernel modules to make them fit into the ROM image.
|
|
||||||
#
|
|
||||||
define linux_module =
|
|
||||||
$(build)/$(linux_dir)/$1: linux.intermediate
|
|
||||||
initrd-$(BOARD).cpio: $(initrd_lib_dir)/modules/$(notdir $1)
|
|
||||||
$(initrd_lib_dir)/modules/$(notdir $1): $(build)/$(linux_dir)/$1
|
|
||||||
@-mkdir -p "$(initrd_lib_dir)/modules"
|
|
||||||
$(call do,INSTALL-MODULE,$$@,$(CROSS)strip --preserve-dates --strip-debug -o "$$@" "$$<")
|
|
||||||
endef
|
|
||||||
$(call map,linux_module,$(linux_modules-y))
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# initrd image creation
|
# initrd image creation
|
||||||
#
|
#
|
||||||
@ -349,24 +373,47 @@ $(call map,linux_module,$(linux_modules-y))
|
|||||||
# is a chance the build will not be reproducible (although
|
# is a chance the build will not be reproducible (although
|
||||||
# unlikely that their device file has a different major/minor)
|
# unlikely that their device file has a different major/minor)
|
||||||
#
|
#
|
||||||
#
|
|
||||||
initrd-$(BOARD).cpio: $(initrd_bins) $(initrd_libs) blobs/dev.cpio FORCE
|
|
||||||
$(call do,OVERLAY,initrd,\
|
|
||||||
tar -C ./initrd -cf - . | tar -C "$(initrd_dir)" -xf - \
|
|
||||||
)
|
|
||||||
$(call do,INSTALL,$(CONFIG),cp "$(CONFIG)" "$(initrd_dir)/etc/config")
|
|
||||||
$(call do,CPIO,$@, \
|
|
||||||
cd "$(initrd_dir)"; \
|
|
||||||
find . \
|
|
||||||
| cpio --quiet -H newc -o \
|
|
||||||
| $(pwd)/bin/cpio-clean \
|
|
||||||
$(pwd)/blobs/dev.cpio \
|
|
||||||
- \
|
|
||||||
> "$(pwd)/$@" \
|
|
||||||
)
|
|
||||||
$(call do,RM,$(initrd_dir),$(RM) -rf "$(initrd_dir)")
|
|
||||||
|
|
||||||
initrd.intermediate: initrd-$(BOARD).cpio
|
initrd-y += $(pwd)/blobs/dev.cpio
|
||||||
|
initrd-y += $(build)/$(BOARD)/heads.cpio
|
||||||
|
initrd-y += $(build)/$(BOARD)/modules.cpio
|
||||||
|
initrd-y += $(build)/$(BOARD)/tools.cpio
|
||||||
|
|
||||||
|
initrd.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
|
||||||
|
$(build)/$(BOARD)/initrd.cpio.xz: $(initrd-y)
|
||||||
|
$(call do,CPIO-CLEAN,$@,\
|
||||||
|
$(pwd)/bin/cpio-clean \
|
||||||
|
$^ \
|
||||||
|
| xz \
|
||||||
|
--check=crc32 \
|
||||||
|
--lzma2=dict=1MiB \
|
||||||
|
-9 \
|
||||||
|
| dd bs=512 conv=sync > "$@" \
|
||||||
|
)
|
||||||
|
@sha256sum "$(@:$(pwd)/%=%)"
|
||||||
|
|
||||||
|
#
|
||||||
|
# The heads.cpio is built from the initrd directory in the
|
||||||
|
# Heads tree.
|
||||||
|
#
|
||||||
|
$(build)/$(BOARD)/heads.cpio: FORCE
|
||||||
|
$(call do-cpio,$@,$(pwd)/initrd)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The tools initrd is made from all of the things that we've
|
||||||
|
# created during the submodule build.
|
||||||
|
#
|
||||||
|
$(build)/$(BOARD)/tools.cpio: \
|
||||||
|
$(initrd_bins) \
|
||||||
|
$(initrd_libs) \
|
||||||
|
|
||||||
|
$(call do,INSTALL,$(CONFIG), \
|
||||||
|
mkdir -p "$(initrd_dir)/etc" ; \
|
||||||
|
cp "$(CONFIG)" "$(initrd_dir)/etc/config" \
|
||||||
|
)
|
||||||
|
$(call do-cpio,$@,$(initrd_dir))
|
||||||
|
@$(RM) -rf "$(initrd_dir)"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -375,26 +422,10 @@ initrd.intermediate: initrd-$(BOARD).cpio
|
|||||||
# and the extra padding is to ensure that it can be concatenated to
|
# and the extra padding is to ensure that it can be concatenated to
|
||||||
# other cpio files.
|
# other cpio files.
|
||||||
#
|
#
|
||||||
coreboot.intermediate: $(build)/$(coreboot_dir)/initrd-$(BOARD).cpio.xz
|
coreboot.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
|
||||||
$(build)/$(coreboot_dir)/initrd-$(BOARD).cpio.xz: initrd-$(BOARD).cpio.xz
|
coreboot.intermediate: $(build)/$(BOARD)/bzImage
|
||||||
|
#$(build)/$(coreboot_dir)/initrd-$(BOARD).cpio.xz: initrd-$(BOARD).cpio.xz
|
||||||
|
|
||||||
%.xz: %
|
|
||||||
$(call do,COMPRESS,$<,\
|
|
||||||
xz \
|
|
||||||
--check=crc32 \
|
|
||||||
--lzma2=dict=1MiB \
|
|
||||||
-9 \
|
|
||||||
< "$<" \
|
|
||||||
| dd bs=512 conv=sync > "$@" \
|
|
||||||
)
|
|
||||||
@sha256sum "$@"
|
|
||||||
|
|
||||||
# hack for the coreboot to find the linux kernel
|
|
||||||
$(build)/$(coreboot_dir)/bzImage: $(build)/$(linux_dir)/arch/x86/boot/bzImage
|
|
||||||
$(call do,COPY,$@,cp "$^" "$@")
|
|
||||||
@sha256sum "$@"
|
|
||||||
|
|
||||||
coreboot.intermediate: $(build)/$(coreboot_dir)/bzImage
|
|
||||||
|
|
||||||
|
|
||||||
# Each board output has its own fixup required to turn the coreboot.rom
|
# Each board output has its own fixup required to turn the coreboot.rom
|
||||||
|
35
boards/qemu-linuxboot.config
Normal file
35
boards/qemu-linuxboot.config
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Configuration for emulating LinuxBoot+Heads with qemu
|
||||||
|
#
|
||||||
|
BOARD=qemu-linuxboot
|
||||||
|
|
||||||
|
CONFIG_LINUXBOOT=y
|
||||||
|
linuxboot-board := qemu
|
||||||
|
|
||||||
|
#CONFIG_CRYPTSETUP=y
|
||||||
|
#CONFIG_FLASHROM=y
|
||||||
|
#CONFIG_GPG=y
|
||||||
|
CONFIG_KEXEC=y
|
||||||
|
CONFIG_UTIL_LINUX=y
|
||||||
|
#CONFIG_LVM2=y
|
||||||
|
#CONFIG_MBEDTLS=y
|
||||||
|
CONFIG_PCIUTILS=y
|
||||||
|
#CONFIG_POPT=y
|
||||||
|
#CONFIG_QRENCODE=y
|
||||||
|
#CONFIG_TPMTOTP=y
|
||||||
|
#CONFIG_XEN=y
|
||||||
|
CONFIG_DROPBEAR=y
|
||||||
|
|
||||||
|
CONFIG_LINUX_USB=y
|
||||||
|
#CONFIG_LINUX_IGB=y
|
||||||
|
#CONFIG_LINUX_MEGARAID=y
|
||||||
|
#CONFIG_LINUX_E1000E=y
|
||||||
|
CONFIG_LINUX_SCSI_GDTH=y
|
||||||
|
CONFIG_LINUX_ATA=y
|
||||||
|
CONFIG_LINUX_AHCI=y
|
||||||
|
|
||||||
|
CONFIG_BOOTSCRIPT=/bin/generic-init
|
||||||
|
|
||||||
|
CONFIG_BOOT_REQ_HASH=n
|
||||||
|
CONFIG_BOOT_REQ_ROLLBACK=n
|
||||||
|
CONFIG_BOOT_DEV="/dev/sda1"
|
||||||
|
CONFIG_USB_BOOT_DEV="/dev/sdb1"
|
@ -3,6 +3,9 @@
|
|||||||
# and it is NERF, not coreboot.
|
# and it is NERF, not coreboot.
|
||||||
BOARD=r630
|
BOARD=r630
|
||||||
|
|
||||||
|
CONFIG_LINUXBOOT=y
|
||||||
|
CONFIG_LINUXBOOT_ROM=blobs/r630-1.3.6.rom
|
||||||
|
|
||||||
#CONFIG_CRYPTSETUP=y
|
#CONFIG_CRYPTSETUP=y
|
||||||
CONFIG_FLASHROM=y
|
CONFIG_FLASHROM=y
|
||||||
#CONFIG_GPG=y
|
#CONFIG_GPG=y
|
@ -11,6 +11,9 @@
|
|||||||
#
|
#
|
||||||
BOARD=s2600wf
|
BOARD=s2600wf
|
||||||
|
|
||||||
|
CONFIG_LINUXBOOT=y
|
||||||
|
CONFIG_LINUXBOOT_ROM=blobs/s2600wf.rom
|
||||||
|
|
||||||
#CONFIG_CRYPTSETUP=y
|
#CONFIG_CRYPTSETUP=y
|
||||||
#CONFIG_FLASHROM=y
|
#CONFIG_FLASHROM=y
|
||||||
CONFIG_GPG=y
|
CONFIG_GPG=y
|
@ -2,6 +2,9 @@
|
|||||||
# and it is NERF, not coreboot.
|
# and it is NERF, not coreboot.
|
||||||
BOARD=winterfell
|
BOARD=winterfell
|
||||||
|
|
||||||
|
CONFIG_LINUXBOOT=y
|
||||||
|
CONFIG_LINUXBOOT_ROM=blobs/winterfell.rom
|
||||||
|
|
||||||
#CONFIG_CRYPTSETUP=y
|
#CONFIG_CRYPTSETUP=y
|
||||||
CONFIG_FLASHROM=y
|
CONFIG_FLASHROM=y
|
||||||
#CONFIG_GPG=y
|
#CONFIG_GPG=y
|
||||||
@ -17,8 +20,6 @@ CONFIG_TPMTOTP=y
|
|||||||
CONFIG_DROPBEAR=y
|
CONFIG_DROPBEAR=y
|
||||||
|
|
||||||
CONFIG_LINUX_USB=y
|
CONFIG_LINUX_USB=y
|
||||||
CONFIG_LINUX_IGB=y
|
|
||||||
CONFIG_LINUX_MEGARAID=y
|
|
||||||
CONFIG_LINUX_MLX4=y
|
CONFIG_LINUX_MLX4=y
|
||||||
|
|
||||||
CONFIG_BOOTSCRIPT=/bin/generic-init
|
CONFIG_BOOTSCRIPT=/bin/generic-init
|
@ -16,8 +16,12 @@ linux_configure := \
|
|||||||
CROSS_COMPILE="$(CROSS)" \
|
CROSS_COMPILE="$(CROSS)" \
|
||||||
oldconfig \
|
oldconfig \
|
||||||
|
|
||||||
linux_output := arch/x86/boot/bzImage
|
linux_output += $(build)/$(BOARD)/bzImage
|
||||||
linux_config := linux.config
|
|
||||||
|
# linux.intermediate: $(linux_output)
|
||||||
|
#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
|
||||||
@ -43,6 +47,10 @@ linux_modules-$(CONFIG_LINUX_AHCI) += drivers/ata/libahci_platform.ko
|
|||||||
linux_modules-$(CONFIG_LINUX_SFC) += drivers/net/ethernet/sfc/sfc.ko
|
linux_modules-$(CONFIG_LINUX_SFC) += drivers/net/ethernet/sfc/sfc.ko
|
||||||
linux_modules-$(CONFIG_LINUX_SFC) += drivers/net/mdio.ko
|
linux_modules-$(CONFIG_LINUX_SFC) += drivers/net/mdio.ko
|
||||||
|
|
||||||
|
# Mellanox ConnectX-3 (winterfell)
|
||||||
|
linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko
|
||||||
|
linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko
|
||||||
|
|
||||||
# USB modules for both types of controllers
|
# USB modules for both types of controllers
|
||||||
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-hcd.ko
|
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-hcd.ko
|
||||||
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-pci.ko
|
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/ehci-pci.ko
|
||||||
@ -50,9 +58,6 @@ linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/xhci-hcd.ko
|
|||||||
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/xhci-pci.ko
|
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/xhci-pci.ko
|
||||||
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/storage/usb-storage.ko
|
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/storage/usb-storage.ko
|
||||||
|
|
||||||
linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko
|
|
||||||
linux_modules-$(CONFIG_LINUX_MLX4) += drivers/net/ethernet/mellanox/mlx4/mlx4_en.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 := \
|
||||||
@ -68,3 +73,46 @@ linux_target := \
|
|||||||
|
|
||||||
# We cross compile linux now
|
# We cross compile linux now
|
||||||
linux_depends := musl-cross
|
linux_depends := musl-cross
|
||||||
|
|
||||||
|
#
|
||||||
|
# Linux kernel module installation
|
||||||
|
#
|
||||||
|
# This is special cases since we have to do a special strip operation on
|
||||||
|
# the kernel modules to make them fit into the ROM image.
|
||||||
|
#
|
||||||
|
module_initrd_dir := $(shell mktemp -d)
|
||||||
|
module_initrd_lib_dir := $(module_initrd_dir)/lib/modules
|
||||||
|
FOO := $(shell mkdir -p "$(module_initrd_lib_dir)")
|
||||||
|
|
||||||
|
define linux_module =
|
||||||
|
|
||||||
|
# Each module depends on building the Linux kernel
|
||||||
|
$(build)/$(linux_dir)/$1: linux.intermediate # $(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): $(build)/$(linux_dir)/$1
|
||||||
|
$(call do,INSTALL-MODULE,$1, \
|
||||||
|
$(CROSS)strip \
|
||||||
|
--preserve-dates \
|
||||||
|
--strip-debug \
|
||||||
|
-o "$$@" \
|
||||||
|
"$$<" \
|
||||||
|
)
|
||||||
|
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
|
||||||
|
$(call do-cpio,$@,$(module_initrd_dir))
|
||||||
|
@$(RM) -rf "$(module_initrd_dir)"
|
||||||
|
|
||||||
|
|
||||||
|
# hack for the coreboot to find the linux kernel
|
||||||
|
$(build)/$(BOARD)/bzImage: linux.intermediate
|
||||||
|
$(build)/$(BOARD)/bzImage: $(build)/$(linux_dir)/arch/x86/boot/bzImage
|
||||||
|
$(call do-copy,$<,$@)
|
||||||
|
|
||||||
|
63
modules/linuxboot
Normal file
63
modules/linuxboot
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
modules-$(CONFIG_LINUXBOOT) += linuxboot
|
||||||
|
|
||||||
|
linuxboot_version := git
|
||||||
|
linuxboot_repo := https://github.com/osresearch/linuxboot
|
||||||
|
linuxboot_dir := linuxboot-$(linuxboot_version)
|
||||||
|
|
||||||
|
|
||||||
|
linuxboot_configure := \
|
||||||
|
touch .config
|
||||||
|
|
||||||
|
# linuxboot builds are specialized on a per-target basis.
|
||||||
|
# They can be specialized by defining $(linuxboot-board),
|
||||||
|
# otherwise it is assumed that it will have the same name
|
||||||
|
# as the Heads BOARD.
|
||||||
|
linuxboot-board ?= $(BOARD)
|
||||||
|
|
||||||
|
linuxboot_target := \
|
||||||
|
BOARD:=$(linuxboot-board) \
|
||||||
|
KERNEL=$(build)/$(BOARD)/bzImage \
|
||||||
|
INITRD=$(build)/$(BOARD)/initrd.cpio.xz \
|
||||||
|
all
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Most mainboards will define a ROM file that contains the vendor ROM
|
||||||
|
# for the image. If so, we copy it into the linuxboot tree.
|
||||||
|
#
|
||||||
|
ifneq "$(CONFIG_LINUXBOOT_ROM)" ""
|
||||||
|
|
||||||
|
ifneq "y" "$(shell [ -r '$(CONFIG_LINUXBOOT_ROM)' ] && echo y)"
|
||||||
|
$(error $(CONFIG_LINUXBOOT_ROM): you must provide a ROM file)
|
||||||
|
endif
|
||||||
|
|
||||||
|
linuxboot-vendor-rom := $(build)/$(linuxboot_dir)/boards/$(linuxboot-board)/$(notdir $(CONFIG_LINUXBOOT_ROM))
|
||||||
|
linuxboot.intermediate: $(linuxboot-vendor-rom)
|
||||||
|
$(linuxboot-vendor-rom): $(CONFIG_LINUXBOOT_ROM)
|
||||||
|
$(call do-copy,$<,$@)
|
||||||
|
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): linuxboot.intermediate
|
||||||
|
|
||||||
|
$(build)/$(BOARD)/linuxboot.rom: $(linuxboot_output)
|
||||||
|
$(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
|
||||||
|
ifneq "$(FAST)" "1"
|
||||||
|
linuxboot_depends := linux initrd
|
||||||
|
endif
|
||||||
|
|
||||||
|
# The bzImage and initrd must be built, but the dependency
|
||||||
|
# might not be there if FAST is defined.
|
||||||
|
linuxboot.intermediate: \
|
||||||
|
$(build)/$(BOARD)/bzImage \
|
||||||
|
$(build)/$(BOARD)/initrd.cpio.xz \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user