mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-09 23:34:51 +01:00
90 lines
3.5 KiB
Makefile
90 lines
3.5 KiB
Makefile
# Copyright (c) 2017 Genexis B.V.
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# version 2 as published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
# 02110-1301 USA
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
PKG_NAME:=gryphon-led-kernel-module
|
|
PKG_RELEASE:=1
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define KernelPackage/$(PKG_NAME)
|
|
SUBMENU:=LED modules
|
|
TITLE:=LED driver for Gryphon
|
|
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_brcmbca):bcmkernel
|
|
PKG_LICENSE:=GPLv2
|
|
PKG_LICENSE_URL:=
|
|
endef
|
|
|
|
define KernelPackage/$(PKG_NAME)/description
|
|
This package contains the LED driver for Gryphon devices.
|
|
endef
|
|
|
|
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
|
|
|
|
define Build/Prepare
|
|
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/
|
|
$(CP) -s `pwd`/src/* $(PKG_BUILD_DIR)/kdevlinks/
|
|
$(CP) src/* $(PKG_BUILD_DIR)
|
|
endef
|
|
|
|
define Build/Compile
|
|
$(MAKE) -C "$(LINUX_DIR)" \
|
|
CROSS_COMPILE="$(TARGET_CROSS)" \
|
|
ARCH="$(LINUX_KARCH)" \
|
|
SUBDIRS="$(PKG_BUILD_DIR)" \
|
|
EXTRA_CFLAGS="-DKERNEL_MODULE $(BUILDFLAGS) -I$(LINUX_DIR)/include -include generated/autoconf.h $(MODULE_INCLUDE)" \
|
|
modules
|
|
endef
|
|
|
|
define Build/InstallDev
|
|
$(INSTALL_DIR) $(1)/usr/include
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,$(PKG_NAME)))
|