openwrt/package/kernel/qca-ssdk/Makefile

98 lines
3.2 KiB
Makefile
Raw Normal View History

include $(TOPDIR)/rules.mk
PKG_NAME:=qca-ssdk
kernel: qca-ssdk: use bash as shell Currently, trying to compile qca-ssdk on macOS will fail in a weird way: make[6]: *** No rule to make target 'openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/qca-ssdk-2024.04.17~3d060f7a/-n', needed by 'openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/qca-ssdk-2024.04.17~3d060f7a/qca-ssdk.o'. Stop. After looking looking at src_list.dep from which KBuild cmd_mod will generate the list of objects to compile it looked like: -n /src/adpt/adpt.c -n -n Which was rather suspicous so after comparing to the same file but with Fedora as host: /src/adpt/adpt.c src/adpt/hppe/adpt_hppe_fdb.c src/adpt/hppe/adpt_hppe_mib.c It was clear that echo -n which was used in SSDK-s target.mk was not working as intented, and it looked like the POSIX only version of echo was being used which does not honor -n. So, after failling to reproduce it externally, replacing the call to echo with a full path to coreutils echo fixed the compilation. After further debugging, it was determined that SSDK does not honor CONFIG_SHELL like other kernel modules so it was defaulting to /bin/sh as the shell make was calling thus calling the /bin/sh built-in echo which on macOS is the old Bash 3.2 one and it does not respect -n. So, we have to explicitly pass SHELL=$(BASH) to SSDK to make it use bash like kernel build or other kernel modules. This is not an issue since on macOS we always build bash anyway. Link: https://github.com/openwrt/openwrt/pull/15459 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-11 15:01:42 +00:00
PKG_RELEASE:=2
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git
PKG_SOURCE_PROTO:=git
kernel: qca-ssdk: update to 12.5 for kernel 6.6 Qualcomm recently committed a new branch (12.5.r2) targeting kernel 6.6. This lets us clean up a few patches particularly the one for "C22/C45" mdio. A quick way to see what changed for IPQ807x/6018 was to list the files produced during build (**/*.o), replace the extension with ".c", and doing a `git log`. Filtering from those commits, ones of particular interest are listed below: ``` 2024-04-16 - 0d8f30aa - fix compile issue on hk with linux style build 2024-01-29 - 636464f7 - update the check for port link notify 2024-01-24 - 30c10e7f - enable and disable loopback for xgmac to fix qm stuck issue 2024-01-15 - b6ea10aa - update the the APIs to access switch 2024-01-08 - a1687502 - Disable Tx bridge mac before power off the PHY 2024-01-07 - 3eafb613 - support led configure for malibu phy 2024-01-07 - 5c1af60d - remove phy type check from mac reset when mode switch 2023-12-17 - 79d0b1e8 - remove the PHY access APIs in ssdk_plat.c 2023-12-16 - b2953740 - Update mii read/write functions 2023-12-11 - 37f2eac3 - add port id check for fdb entry 2023-12-11 - d040ca4d - support mdio clause45 on kernel6.6 2023-12-07 - 11494fbc - use barrier mw() during access fdb entry table 2023-12-03 - 8e40a284 - fix build warnings on kernel6.6 2023-11-10 - 10aa0a02 - change speed value when call ssdk_port_link_notify 2023-11-06 - ee4c4a60 - Update mac bitmap value of L3 table on MAC delete 2023-11-03 - 7cd27d39 - support 10G phy common feature 2023-10-30 - 383cc0d2 - fix mactype and mux select issue 2023-10-24 - decf534a - support autoneg status query on force port 2023-10-11 - 111d574e - move ssdk_led_init to regi_init 2023-10-08 - 6b14c142 - the combo port also need to parse SFP pins 2023-10-03 - fb2e0401 - fix port5 interface mode switch issue in erp case ``` Verified with users on QNAP 301W, NBG7815, and myself on Dynalink DL-WRX36 that everything is functional, including LEDS. Signed-off-by: Sean Khan <datapronix@protonmail.com> Link: https://github.com/openwrt/openwrt/pull/15379 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-04 21:09:08 +00:00
PKG_SOURCE_DATE:=2024-04-17
PKG_SOURCE_VERSION:=3d060f7ad70d087f6b0452abe79ab6d042e8cd53
PKG_MIRROR_HASH:=6f5e390b294e699491584094f5d7eb941de6237ad8c5320191e9e306fbcd8eb5
PKG_FLAGS:=nonshared
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-lto
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/qca-ssdk
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Qualcom SSDK switch driver
DEPENDS:=@(TARGET_qualcommax)
FILES:=$(PKG_BUILD_DIR)/qca-ssdk.ko
AUTOLOAD:=$(call AutoLoad,30,qca-ssdk)
endef
define KernelPackage/qca-ssdk/Description
Driver for Qualcomm Atheros switches.
endef
GCC_VERSION=$(shell echo "$(CONFIG_GCC_VERSION)" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
LNX_CONFIG_OPTS = LNX_MAKEOPTS='$(KERNEL_MAKEOPTS)' PRJ_PATH=$(PKG_BUILD_DIR) MODULE_TYPE=KSLIB modules
MAKE_FLAGS+= \
TARGET_NAME=$(CONFIG_TARGET_NAME) \
TOOL_PATH=$(firstword $(TOOLCHAIN_BIN_DIRS)) \
SYS_PATH=$(LINUX_DIR) \
TOOLPREFIX=$(TARGET_CROSS) \
KVER=$(LINUX_VERSION) \
ARCH=$(LINUX_KARCH) \
TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \
GCC_VERSION=$(GCC_VERSION) \
EXTRA_CFLAGS="-fno-stack-protector -I$(STAGING_DIR)/usr/include" \
SoC=$(CONFIG_TARGET_SUBTARGET) \
kernel: qca-ssdk: use bash as shell Currently, trying to compile qca-ssdk on macOS will fail in a weird way: make[6]: *** No rule to make target 'openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/qca-ssdk-2024.04.17~3d060f7a/-n', needed by 'openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/qca-ssdk-2024.04.17~3d060f7a/qca-ssdk.o'. Stop. After looking looking at src_list.dep from which KBuild cmd_mod will generate the list of objects to compile it looked like: -n /src/adpt/adpt.c -n -n Which was rather suspicous so after comparing to the same file but with Fedora as host: /src/adpt/adpt.c src/adpt/hppe/adpt_hppe_fdb.c src/adpt/hppe/adpt_hppe_mib.c It was clear that echo -n which was used in SSDK-s target.mk was not working as intented, and it looked like the POSIX only version of echo was being used which does not honor -n. So, after failling to reproduce it externally, replacing the call to echo with a full path to coreutils echo fixed the compilation. After further debugging, it was determined that SSDK does not honor CONFIG_SHELL like other kernel modules so it was defaulting to /bin/sh as the shell make was calling thus calling the /bin/sh built-in echo which on macOS is the old Bash 3.2 one and it does not respect -n. So, we have to explicitly pass SHELL=$(BASH) to SSDK to make it use bash like kernel build or other kernel modules. This is not an issue since on macOS we always build bash anyway. Link: https://github.com/openwrt/openwrt/pull/15459 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-11 15:01:42 +00:00
SHELL="$(BASH)" \
PTP_FEATURE=disable SWCONFIG_FEATURE=disable \
ISISC_ENABLE=disable IN_QCA803X_PHY=FALSE \
IN_QCA808X_PHY=FALSE IN_MALIBU_PHY=FALSE \
$(LNX_CONFIG_OPTS)
ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x")
MAKE_FLAGS+= CHIP_TYPE=HPPE
endif
ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq60xx")
MAKE_FLAGS+= CHIP_TYPE=CPPE
endif
define Build/Compile
+$(MAKE) $(PKG_JOBS) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR) $(LNX_CONFIG_OPTS)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/api
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/ref
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/fal
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/sal
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/init
$(CP) -rf $(PKG_BUILD_DIR)/include/api/sw_ioctl.h $(1)/usr/include/qca-ssdk/api
if [ -f $(PKG_BUILD_DIR)/include/ref/ref_vsi.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_vsi.h $(1)/usr/include/qca-ssdk/ref/; \
fi
if [ -f $(PKG_BUILD_DIR)/include/ref/ref_fdb.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_fdb.h $(1)/usr/include/qca-ssdk/ref/; \
fi
if [ -f $(PKG_BUILD_DIR)/include/ref/ref_port_ctrl.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_port_ctrl.h $(1)/usr/include/qca-ssdk/ref/; \
fi
if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_init.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_init.h $(1)/usr/include/qca-ssdk/init/; \
fi
if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h ]; then \
$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h $(1)/usr/include/qca-ssdk/init/; \
fi
$(CP) -rf $(PKG_BUILD_DIR)/include/fal $(1)/usr/include/qca-ssdk
$(CP) -rf $(PKG_BUILD_DIR)/include/common/*.h $(1)/usr/include/qca-ssdk
$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/linux/*.h $(1)/usr/include/qca-ssdk
$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/*.h $(1)/usr/include/qca-ssdk
endef
$(eval $(call KernelPackage,qca-ssdk))