From 90fa843074254ebbc9f2fbb8f2a7a54f78ebdf3c Mon Sep 17 00:00:00 2001 From: Andreas Gnau Date: Thu, 11 Nov 2021 17:13:24 +0100 Subject: [PATCH] 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. --- gryphon-led-module/Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gryphon-led-module/Makefile b/gryphon-led-module/Makefile index 959e33769..bd4cad7a3 100644 --- a/gryphon-led-module/Makefile +++ b/gryphon-led-module/Makefile @@ -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/