Last active
August 7, 2023 18:35
-
-
Save voran/8d751a547c31be05eb1ec40bae153586 to your computer and use it in GitHub Desktop.
Patching atheros to disable eeprom reading on Arch Linux. (Do not break the law, use at your own responsibility!) Latest Arch Linux Kernel tested - `5.10.1-arch1-1`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- drivers/net/wireless/ath/Kconfig 2020-08-17 14:45:00.611581731 +0300 | |
| +++ drivers/net/wireless/ath/Kconfig 2020-08-17 14:45:23.001863361 +0300 | |
| @@ -1,4 +1,8 @@ | |
| # SPDX-License-Identifier: ISC | |
| +config ATH_USER_REGD | |
| + bool "Do not enforce EEPROM regulatory restrictions" | |
| + default n | |
| + | |
| config ATH_COMMON | |
| tristate | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -xe | |
| LINUX_MAJOR_VER=$(uname -r | cut -d. -f1) | |
| LINUX_DIST=linux-$(uname -r | cut -d- -f1) | |
| wget -nc https://mirrors.edge.kernel.org/pub/linux/kernel/v${LINUX_MAJOR_VER}.x/${LINUX_DIST}.tar.xz | |
| tar -xvJf ${LINUX_DIST}.tar.xz | |
| cd ${LINUX_DIST}/ | |
| cp ../regdom-optional.patch . | |
| cp ../Kconfig.patch . | |
| patch -p0 < regdom-optional.patch | |
| patch -p0 < Kconfig.patch | |
| rm -rf $LINUX_DIST/drivers/net/wireless/ath/ath.ko.xz | |
| cp /usr/lib/modules/$(uname -r)/build/Makefile /usr/lib/modules/$(uname -r)/build/Module.symvers . | |
| # NOTE: sometimes the Makefile in linux-headers will be out of sync with installed kernel | |
| # when I tried this with linux-5.8.1 the EXTRAVERSION parameters was arch-1 in the Makefile | |
| # but on the running kernel it was arch-1-1 . THe line below fixes that issue. | |
| sed -i "s/EXTRAVERSION =.*/EXTRAVERSION = -$(uname -r | cut -d- -f2,3)/" Makefile | |
| zcat /proc/config.gz > .config | |
| cp /usr/lib/modules/$(uname -r)/build/Module.symvers . | |
| cp /usr/lib/modules/$(uname -r)/build/scripts/module.lds scripts/module.lds | |
| make oldconfig && make prepare | |
| make scripts | |
| make M=drivers/net/wireless/ath | |
| xz drivers/net/wireless/ath/ath.ko | |
| sudo cp -f drivers/net/wireless/ath/ath.ko.xz /lib/modules/$(uname -r)/kernel/drivers/net/wireless/ath/ath.ko.xz | |
| sudo depmod -a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- drivers/net/wireless/ath/regd.c.bak 2020-08-17 12:51:05.265869166 +0300 | |
| +++ drivers/net/wireless/ath/regd.c 2020-08-17 12:55:10.820103014 +0300 | |
| @@ -345,6 +345,10 @@ | |
| struct ieee80211_channel *ch; | |
| unsigned int i; | |
| + #ifdef CONFIG_ATH_USER_REGD | |
| + return; | |
| + #endif | |
| + | |
| for (band = 0; band < NUM_NL80211_BANDS; band++) { | |
| if (!wiphy->bands[band]) | |
| continue; | |
| @@ -378,6 +382,10 @@ | |
| { | |
| struct ieee80211_supported_band *sband; | |
| + #ifdef CONFIG_ATH_USER_REGD | |
| + return; | |
| + #endif | |
| + | |
| sband = wiphy->bands[NL80211_BAND_2GHZ]; | |
| if (!sband) | |
| return; | |
| @@ -407,6 +415,11 @@ | |
| struct ieee80211_channel *ch; | |
| unsigned int i; | |
| + | |
| + #ifdef CONFIG_ATH_USER_REGD | |
| + return; | |
| + #endif | |
| + | |
| if (!wiphy->bands[NL80211_BAND_5GHZ]) | |
| return; | |
| @@ -639,6 +652,11 @@ | |
| const struct ieee80211_regdomain *regd; | |
| wiphy->reg_notifier = reg_notifier; | |
| + | |
| + #ifdef CONFIG_ATH_USER_REGD | |
| + return 0; | |
| + #endif | |
| + | |
| wiphy->regulatory_flags |= REGULATORY_STRICT_REG | | |
| REGULATORY_CUSTOM_REG; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment