kernel: gpio-button-hotplug: Support BCM SDK kernel

Move hacks to support compiling against the kernel built using the BCM SDK and
toolchain into a separate Makefile in the broadcom feed.

Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
This commit is contained in:
Andreas Gnau 2023-05-03 11:54:55 +02:00
parent 97aeb16ee1
commit 953c01f40f

View file

@ -41,32 +41,8 @@ EXTRA_KCONFIG:= CONFIG_RGB_LED=m
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
ifeq ($(CONFIG_TARGET_brcmbca),y)
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
# This assumes that the MODULES_SUBDIR set by OpenWrt is of the form
# lib/modules/4.19.235-abcdef where 4.19.235 is the version of our fake bcmlinux kernel
# and abcdef the git-commit.
# The kernel compiled by the Broadcom SDK has a uname -r of 4.19.235, i.e. without the git-commit.
# The assignment below removes the part after the - which puts modules in the right directory as
# long as the bcmlinux version matches the kernel version in the BCM SDK.
# So, this will only stop working in the time window where the BCM SDK has been updated
# but bcmlinux has not yet been updated.
MODULES_SUBDIR:=$(firstword $(subst -, ,$(MODULES_SUBDIR)))
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_ARM_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_ARM_TOOLCHAIN_PREFIX)-
ifeq ($(CONFIG_BCM_CHIP_ID),$(filter $(CONFIG_BCM_CHIP_ID),"63158" "6856" "6858"))
# These targets use a 64-bit kernel
LINUX_KARCH:=arm64
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_AARCH64_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_AARCH64_TOOLCHAIN_PREFIX)-
else ifeq ($(CONFIG_BCM_CHIP_ID),$(filter $(CONFIG_BCM_CHIP_ID),"6855" "6756" "47622" "63148" "63178"))
# These targets use a 32-bit arm-sfp kernel
LINUX_KARCH:=arm
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_ARMSFP_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_ARMSFP_TOOLCHAIN_PREFIX)-
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
# support compilation against BCM SDK kernel
include ../../broadcom/bcmkernel/bcm-kernel-toolchain.mk
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/