ulli-kroll / rtw88-usb

rtw88 family usb driver for linux rtl8723du rtl8822bu rtl8821cu rtl8822cu
GNU General Public License v2.0
56 stars 15 forks source link

cross compile openwrt #6

Open DittelHome opened 4 years ago

DittelHome commented 4 years ago

Hi, i am a end user. I tried several hours to do a cross compile for my router (Archer C7), without success. Is it possible to make the driver available to the openwrt project ? regards

ulli-kroll commented 4 years ago

currently working on this issue https://github.com/ulli-kroll/rtw88-usb/issues/8

but you should read here https://github.com/ulli-kroll/rtl8821au

If you build openwrt from "source" you should adapt KSRC and CROSS_COMPILE to your needs

If you use -stable binaries you are out of luck or install the SDK also it may be possible this is also true for -development

I know this is hard for a true beginner/end user

caydenm commented 4 years ago

I have sucessfully got this to compile on Openwrt. You be able to check out the source for openwrt as defined here, create a folder in package/kernel called rtw88-usb-new and then put the file below in it. After that simply type make menuconfig, select this package from the kernel modules > wireless devices menu.

You will need to manually copy across the firmware and place in /lib/firmware/rtw88/.

include $(TOPDIR)/rules.mk

PKG_NAME:=rtw88-usb-new
PKG_RELEASE:=2

PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=

PKG_SOURCE_URL:=https://github.com/ulli-kroll/rtw88-usb.git
PKG_SOURCE_PROTO:=git
#PKG_SOURCE_DATE:=2020-10-17
#PKG_SOURCE_VERSION:=f9f4ee862b3e1f9e6a543d503a08d8de9b18b8f9
PKG_SOURCE_VERSION:=d6b859eed430c24cb74301cafaa1eab25f103dab
#PKG_MIRROR_HASH:=60359df8b49fa433d38b968b0df7eaddaca10f13cdd57471394bac1f6e5a162e

# PKG_MAINTAINER:=
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk

define KernelPackage/rtw88-usb-new
  SUBMENU:=Wireless Drivers
  TITLE:=Realtek rtw88-usb new version testing
   DEPENDS:=+kmod-cfg80211 +kmod-mac80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
  FILES:=\
    $(PKG_BUILD_DIR)/rtw88_pci.ko \
    $(PKG_BUILD_DIR)/rtw88_usb.ko \
    $(PKG_BUILD_DIR)/rtw88_core.ko \
    $(PKG_BUILD_DIR)/rtw88_8822cu.ko \
    $(PKG_BUILD_DIR)/rtw88_8822ce.ko \
    $(PKG_BUILD_DIR)/rtw88_8822c.ko \
    $(PKG_BUILD_DIR)/rtw88_8822b.ko \
    $(PKG_BUILD_DIR)/rtw88_8822be.ko \
    $(PKG_BUILD_DIR)/rtw88_8822bu.ko \
    $(PKG_BUILD_DIR)/rtw88_8723d.ko \
    $(PKG_BUILD_DIR)/rtw88_8723de.ko \
    $(PKG_BUILD_DIR)/rtw88_8821c.ko \
    $(PKG_BUILD_DIR)/rtw88_8821cu.ko
  AUTOLOAD:=$(call AutoProbe, rtw88_8821cu)
endef

define Build/Compile
    +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
        $(KERNEL_MAKE_FLAGS) \
        M="$(PKG_BUILD_DIR)" \
        modules
endef

$(eval $(call KernelPackage,rtw88-usb-new))
ulli-kroll commented 4 years ago

You forgot there is (currently) no master branch with all USB-ID's here.

I hope I sort this out after reading some other phy_init/mac_init code and compare this with 8723d
;-)

RezApp commented 1 year ago

I have sucessfully got this to compile on Openwrt. You be able to check out the source for openwrt as defined here, create a folder in package/kernel called rtw88-usb-new and then put the file below in it. After that simply type make menuconfig, select this package from the kernel modules > wireless devices menu.

You will need to manually copy across the firmware and place in /lib/firmware/rtw88/.

include $(TOPDIR)/rules.mk

PKG_NAME:=rtw88-usb-new
PKG_RELEASE:=2

PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=

PKG_SOURCE_URL:=https://github.com/ulli-kroll/rtw88-usb.git
PKG_SOURCE_PROTO:=git
#PKG_SOURCE_DATE:=2020-10-17
#PKG_SOURCE_VERSION:=f9f4ee862b3e1f9e6a543d503a08d8de9b18b8f9
PKG_SOURCE_VERSION:=d6b859eed430c24cb74301cafaa1eab25f103dab
#PKG_MIRROR_HASH:=60359df8b49fa433d38b968b0df7eaddaca10f13cdd57471394bac1f6e5a162e

# PKG_MAINTAINER:=
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk

define KernelPackage/rtw88-usb-new
  SUBMENU:=Wireless Drivers
  TITLE:=Realtek rtw88-usb new version testing
   DEPENDS:=+kmod-cfg80211 +kmod-mac80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
  FILES:=\
  $(PKG_BUILD_DIR)/rtw88_pci.ko \
  $(PKG_BUILD_DIR)/rtw88_usb.ko \
  $(PKG_BUILD_DIR)/rtw88_core.ko \
  $(PKG_BUILD_DIR)/rtw88_8822cu.ko \
  $(PKG_BUILD_DIR)/rtw88_8822ce.ko \
  $(PKG_BUILD_DIR)/rtw88_8822c.ko \
  $(PKG_BUILD_DIR)/rtw88_8822b.ko \
  $(PKG_BUILD_DIR)/rtw88_8822be.ko \
  $(PKG_BUILD_DIR)/rtw88_8822bu.ko \
  $(PKG_BUILD_DIR)/rtw88_8723d.ko \
  $(PKG_BUILD_DIR)/rtw88_8723de.ko \
  $(PKG_BUILD_DIR)/rtw88_8821c.ko \
  $(PKG_BUILD_DIR)/rtw88_8821cu.ko
  AUTOLOAD:=$(call AutoProbe, rtw88_8821cu)
endef

define Build/Compile
  +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
      $(KERNEL_MAKE_FLAGS) \
      M="$(PKG_BUILD_DIR)" \
      modules
endef

$(eval $(call KernelPackage,rtw88-usb-new))

Thanks for your instruction, but it doesn't work for me not even detect my TP-Link Archer T4U V3 (RTL8812BU) on Raspberry Pi 3 Model B Rev 1.2 with OpenWrt 22.03.5 do you have any suggestion for me?