Skip to content

Instantly share code, notes, and snippets.

@lenew
Created August 13, 2017 08:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save lenew/9b41ba901c3393047ede0766760f9d55 to your computer and use it in GitHub Desktop.
Save lenew/9b41ba901c3393047ede0766760f9d55 to your computer and use it in GitHub Desktop.
realtek r8168 driver module for OpenWRT or LEDE
#Download realtek r8168 linux driver from official site [http://www.realtek.com/downloads/downloadsView.aspx?PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3]
#Unpack source file
#Replace orginal Makefile with this file
#Put this source to 'package' folder of OpenWRT/LEDE SDK
#Build(make menuconfig, make defconfig, make)
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8168
PKG_VERSION:=8.044.02
PKG_RELEASE:=1
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
#PKG_CAT:=bzcat
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8168
TITLE:=Driver for Realtek r8168 chipsets
SUBMENU:=Realtek r8168 Drivers
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
FILES:= $(PKG_BUILD_DIR)/r8168.ko
AUTOLOAD:=$(call AutoProbe,r8168)
endef
define Package/r8168/description
This package contains a driver for Realtek r8168 chipsets.
endef
R8168_MAKEOPTS= -C $(PKG_BUILD_DIR) \
PATH="$(TARGET_PATH)" \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
TARGET="$(HAL_TARGET)" \
TOOLPREFIX="$(KERNEL_CROSS)" \
TOOLPATH="$(KERNEL_CROSS)" \
KERNELPATH="$(LINUX_DIR)" \
KERNELDIR="$(LINUX_DIR)" \
LDOPTS=" " \
DOMULTI=1
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)
endef
define Build/Compile
$(MAKE) $(R8168_MAKEOPTS) modules
endef
$(eval $(call KernelPackage,r8168))
@heri16
Copy link

heri16 commented Apr 19, 2019

@lenew

Any idea how to solve this error?
make[4]: Entering directory '/home/multipass/openwrt-sdk/build_dir/target-x86_64_musl/linux-x86_64/r8168-8.046.00' make -C /home/multipass/openwrt-sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.95 SUBDIRS=/home/multipass/openwrt-sdk/build_dir/target-x86_64_musl/linux-x86_64/r8168-8.046.00 modules make[5]: Entering directory '/home/multipass/openwrt-sdk/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.95' make[6]: *** No rule to make target '/home/multipass/openwrt-sdk/build_dir/target-x86_64_musl/linux-x86_64/r8168-8.046.00/r8168_n.o', needed by '/home/multipass/openwrt-sdk/build_dir/target-x86_64_musl/linux-x86_64/r8168-8.046.00/r8168.o'. Stop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment