Skip to content
Anoncheg1 edited this page Jun 2, 2023 · 6 revisions

To add driver to Linux kernel sources

  • I copied aircrack-ng/rtl8812au to kernel folder: drivers/net/wireless/realtek/rtlwifi/
  • I add line to drivers/net/wireless/realtek/rtlwifi/Makefile: obj-$(CONFIG_88XXAU) += rtl8812au/
  • I add lines to drivers/net/wireless/realtek/rtlwifi/Kconfig:
config 88XXAU
	tristate "Realtek RTL8812AU USB Wireless Network Adapter"
	depends on USB
	select RTLWIFI
	select RTLWIFI_USB
	help
	This is the driver for Realtek RTL8812AU USB
  • I replaced line in file rtl8812au/Makefile : export CONFIG_88XXAU = m with: export CONFIG_88XXAU = y

Script that do it:

#!/bin/bash
rm -r /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/rtl8812au
cp -r /usr/local/src/rtl8812au /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/
cat /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/rtl8812au/Makefile | sed 's/export CONFIG_88XXAU = m/export CONFIG_88XXAU = y/' > /tmp/Makefile
mv /tmp/Makefile /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/rtl8812au/Makefile

echo 'obj-$(CONFIG_88XXAU)                 += rtl8812au/' >> /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Makefile
if [ -e /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig.back ] ; then
    mv /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig.back /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig
fi
cp /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig.back
head -n -1 /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig > /tmp/Kconfig
cat /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/rtl8812au/Kconfig | sed 's/depends on USB/depends on USB\n\tselect RTLWIFI\n\tselect RTLWIFI_USB/' >> /tmp/Kconfig
echo endif >> /tmp/Kconfig

mv /tmp/Kconfig /usr/src/linux/drivers/net/wireless/realtek/rtlwifi/Kconfig
Clone this wiki locally