package: add usb-net-rtl8152-vendor ethernet driver

This commit is contained in:
Lienol 2024-08-13 23:53:35 +08:00
parent 9103007fac
commit 2d22175dd2
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,40 @@
#
# Download realtek r8152 linux driver from official site:
# [https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software]
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8152
PKG_VERSION:=2.17.1-3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/awesometic/realtek-r8152-dkms/tar.gz/$(PKG_VERSION)?
PKG_HASH:=3e0486d412cb05ede0571b19fa6d402c1448b0220e5ae54aa5b11af918ad9a43
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-dkms-$(PKG_VERSION)
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(INCLUDE_DIR)/package.mk
define KernelPackage/usb-net-rtl8152-vendor
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
TITLE:=Realtek RTL8152/RTL8153/RTL8154/RTL8156 driver
SUBMENU:=USB Support
DEPENDS:=+kmod-usb-net
FILES:=$(PKG_BUILD_DIR)/src/r8152.ko
AUTOLOAD:=$(call AutoProbe,r8152)
CONFLICTS:=kmod-usb-net-rtl8152
endef
define KernelPackage/usb-net-rtl8152-vendor/description
Kernel module for Realtek RTL8152 USB Ethernet chipsets
endef
define Build/Compile
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/src modules
endef
$(eval $(call KernelPackage,usb-net-rtl8152-vendor))

View File

@ -0,0 +1,29 @@
From f409f1cbfbeedc7b35b6651de9873e597f2f78e1 Mon Sep 17 00:00:00 2001
From: W_Y_CPP <383152993@qq.com>
Date: Thu, 10 Aug 2023 23:15:47 +0900
Subject: [PATCH] rework eth hw addr set for kernel 5.4
---
src/compatibility.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/compatibility.h b/src/compatibility.h
index 7738d17..25ffc39 100644
--- a/src/compatibility.h
+++ b/src/compatibility.h
@@ -608,10 +608,12 @@
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)
static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
{
memcpy(dev->dev_addr, addr, 6);
}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251) */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) */
#ifndef FALSE
--
2.17.1