2017-03-31 15:18:46 +00:00
|
|
|
modules-y += linux
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2017-07-18 18:25:15 +00:00
|
|
|
linux_version := 4.9.38
|
2016-08-03 01:23:18 +00:00
|
|
|
linux_dir := linux-$(linux_version)
|
|
|
|
linux_tar := linux-$(linux_version).tar.xz
|
|
|
|
linux_url := https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux_tar)
|
2016-08-05 16:24:16 +00:00
|
|
|
|
2017-07-18 18:25:15 +00:00
|
|
|
linux-4.9.38_hash := 76d789d87dd51d2fd58c095727171984fa4a992f5e25b9e3eb1e5fd5cd129074
|
2016-08-05 16:24:16 +00:00
|
|
|
|
|
|
|
linux_hash := $(linux-$(linux_version)_hash)
|
2016-08-03 01:23:18 +00:00
|
|
|
|
2018-02-05 20:28:33 +00:00
|
|
|
linux_board_dir := $(build)/$(linux_dir)/$(BOARD)
|
|
|
|
|
|
|
|
# input file in the heads config/ dir
|
|
|
|
# Allow board config to specialize Linux configuration if necessary
|
2018-02-05 22:27:12 +00:00
|
|
|
linux_kconfig := $(or $(CONFIG_LINUX_CONFIG),config/linux.config)
|
2018-02-05 20:28:33 +00:00
|
|
|
|
|
|
|
# output file in the build dir
|
2018-02-05 22:27:12 +00:00
|
|
|
linux_config_file := .config-$(BOARD)
|
2018-02-05 20:28:33 +00:00
|
|
|
|
2017-01-27 22:55:44 +00:00
|
|
|
linux_configure := \
|
|
|
|
$(MAKE) \
|
2017-04-16 18:18:46 +00:00
|
|
|
CROSS_COMPILE="$(CROSS)" \
|
2018-02-05 20:28:33 +00:00
|
|
|
O="$(linux_board_dir)" \
|
2018-02-05 22:27:12 +00:00
|
|
|
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
2017-01-27 22:55:44 +00:00
|
|
|
oldconfig \
|
|
|
|
|
2018-02-05 16:27:45 +00:00
|
|
|
linux_output += $(build)/$(BOARD)/bzImage
|
|
|
|
|
|
|
|
# linux.intermediate: $(linux_output)
|
|
|
|
#linux_output += $(build)/$(BOARD)/modules.cpio
|
|
|
|
|
2017-01-27 22:55:44 +00:00
|
|
|
|
2017-04-05 23:20:53 +00:00
|
|
|
# qemu
|
2017-03-31 15:18:46 +00:00
|
|
|
linux_modules-$(CONFIG_LINUX_E1000) += drivers/net/ethernet/intel/e1000/e1000.ko
|
2017-04-05 23:20:53 +00:00
|
|
|
|
|
|
|
# x230
|
2017-03-31 15:18:46 +00:00
|
|
|
linux_modules-$(CONFIG_LINUX_E1000E) += drivers/net/ethernet/intel/e1000e/e1000e.ko
|
2017-04-05 23:20:53 +00:00
|
|
|
|
2017-09-21 20:54:48 +00:00
|
|
|
# Dell R630 ethernet and RAID controller
|
2017-09-20 14:29:14 +00:00
|
|
|
linux_modules-$(CONFIG_LINUX_IGB) += drivers/net/ethernet/intel/igb/igb.ko
|
2017-09-21 20:54:48 +00:00
|
|
|
linux_modules-$(CONFIG_LINUX_MEGARAID) += drivers/scsi/megaraid/megaraid_mm.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_MEGARAID) += drivers/scsi/megaraid/megaraid_sas.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_MEGARAID) += drivers/scsi/megaraid/megaraid_mbox.ko
|
2017-09-20 14:29:14 +00:00
|
|
|
|
2017-12-04 21:00:35 +00:00
|
|
|
# Intel s2600wf scsi controller
|
|
|
|
linux_modules-$(CONFIG_LINUX_SCSI_GDTH) += drivers/scsi/gdth.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_ATA) += drivers/ata/libata.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_AHCI) += drivers/ata/ahci.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_AHCI) += drivers/ata/ahci_platform.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_AHCI) += drivers/ata/libahci.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_AHCI) += drivers/ata/libahci_platform.ko
|
|
|
|
|
2018-02-02 20:57:11 +00:00
|
|
|
# Solarflare network card
|
|
|
|
linux_modules-$(CONFIG_LINUX_SFC) += drivers/net/ethernet/sfc/sfc.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_SFC) += drivers/net/mdio.ko
|
|
|
|
|
2018-02-05 16:27:45 +00:00
|
|
|
# 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
|
|
|
|
|
2017-09-21 20:54:48 +00:00
|
|
|
# USB modules for both types of controllers
|
2017-03-31 15:18:46 +00:00
|
|
|
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/xhci-hcd.ko
|
|
|
|
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/host/xhci-pci.ko
|
2017-04-05 23:20:53 +00:00
|
|
|
linux_modules-$(CONFIG_LINUX_USB) += drivers/usb/storage/usb-storage.ko
|
2017-03-28 20:32:58 +00:00
|
|
|
|
2017-01-28 23:38:29 +00:00
|
|
|
EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches
|
|
|
|
|
2017-01-27 22:55:44 +00:00
|
|
|
linux_target := \
|
2018-02-05 20:28:33 +00:00
|
|
|
O="$(linux_board_dir)" \
|
2018-02-05 22:27:12 +00:00
|
|
|
KCONFIG_CONFIG="$(pwd)/$(linux_kconfig)" \
|
2017-04-16 18:18:46 +00:00
|
|
|
CROSS_COMPILE="$(CROSS)" \
|
2017-01-28 23:38:29 +00:00
|
|
|
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
|
|
|
CFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
|
|
|
CFLAGS_MODULE="$(EXTRA_FLAGS)" \
|
2018-02-02 20:57:11 +00:00
|
|
|
KBUILD_BUILD_USER="$(GIT_HASH)" \
|
|
|
|
KBUILD_BUILD_HOST=linuxboot \
|
2017-01-28 23:38:29 +00:00
|
|
|
KBUILD_BUILD_TIMESTAMP="1970-00-00" \
|
|
|
|
KBUILD_BUILD_VERSION=0 \
|
2017-04-16 18:18:46 +00:00
|
|
|
$(MAKE_JOBS) \
|
2017-03-20 18:52:03 +00:00
|
|
|
|
|
|
|
# We cross compile linux now
|
2017-04-09 06:11:18 +00:00
|
|
|
linux_depends := musl-cross
|
2018-02-05 16:27:45 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
2018-02-05 20:28:33 +00:00
|
|
|
$(linux_board_dir)/$1: linux.intermediate # $(build)/$(BOARD)/bzImage
|
2018-02-05 16:27:45 +00:00
|
|
|
|
|
|
|
# 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
|
2018-02-05 20:28:33 +00:00
|
|
|
$(module_initrd_lib_dir)/$(notdir $1): $(linux_board_dir)/$1
|
2018-02-05 16:27:45 +00:00
|
|
|
$(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
|
2018-02-05 20:28:33 +00:00
|
|
|
$(build)/$(BOARD)/bzImage: $(linux_board_dir)/arch/x86/boot/bzImage
|
2018-02-05 16:27:45 +00:00
|
|
|
$(call do-copy,$<,$@)
|