gryphon-led-module: Build against bcmkernel on Broadcom platforms

Due to the complexity of the Broadcom build system which amongst others
puts dynamically generated symlinks into the kernel dir, we have a fake
kernel "bcmlinux" to please the OpenWrt build system. This kernel is not
used for anything but building the OpenWrt toolchain. To compile against
the right kernel that is running on the target, we need to compile the
kernel module against the kernel inside bcmkernel which is the one
compiled by the BCM SDK.
This commit is contained in:
Andreas Gnau 2021-11-11 17:13:24 +01:00
parent 524c718242
commit 90fa843074

View file

@ -28,6 +28,7 @@ define KernelPackage/$(PKG_NAME)
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
DEPENDS:= +(TARGET_iopsys_brcm63xx_arm):bcmkernel
PKG_LICENSE:=GPLv2
PKG_LICENSE_URL:=
endef
@ -40,6 +41,21 @@ EXTRA_KCONFIG:= CONFIG_RGB_LED=m
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
MODULES_SUBDIR:=lib/modules/4.19.183
KERNEL_CROSS:=$(CONFIG_BCM_TOOLCHAIN)/bin/$(CONFIG_BCM_TOOLTUPLE)
ifeq ($(CONFIG_BCM_CHIP_ID),$(filter $(CONFIG_BCM_CHIP_ID),"63158" "6856" "6858"))
# These targets use a 64-bit kernel
LINUX_KARCH:=arm64
KERNEL_CROSS:=/opt/toolchains/crosstools-aarch64-gcc-9.2-linux-4.19-glibc-2.30-binutils-2.32/bin/aarch64-buildroot-linux-gnu-
endif
# For some reason, Broadcom's kernel does not set the include paths correctly when compiling out-of-tree modules
EXTRA_KCPPFLAGS:="-I $(LINUX_DIR)/../bcmkernel/include -I $(LINUX_DIR)/arch/arm/mach-bcm963xx/include"
endif
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/
$(CP) -s `pwd`/src/* $(PKG_BUILD_DIR)/kdevlinks/