compat-wireless: force atheros to respect iw/crda setting of regulatory domains (via useflag).

READ THE EWARNS IF YOU PLAN TO USE IT
This commit is contained in:
Zero_Chaos 2010-06-21 21:49:48 +00:00
parent 427402add6
commit 3c3a5f99c3
3 changed files with 210 additions and 0 deletions

View file

@ -8,6 +8,7 @@ AUX 4012_openwrt-b43-disable_qos_when_openfw.patch 721 RMD160 cd67c2425cd5b29f63
AUX 4013-runtime-enable-disable-of-mac80211-packet-injection.patch 1490 RMD160 53c728303c77b2ffd93917bceaaad6a38ee80236 SHA1 3b6aa934cf4c09deb8e93fcb08b10bfb1f6bdbb9 SHA256 88f997a54768feeb40a9f985e412e90e9fda2491f32cf6b078eb2a0a9f81e785
AUX 4099-2.6.32-rc7-mac80211-security-fixes.patch 5951 RMD160 fb07610df222a12f81e66b4e69f35737ccf8003c SHA1 089a6ab27f14db15ce3b9280bd173f2cba124406 SHA256 61d0c5e5681f0fb20cf65925b49eeebf34d3b026906e052c086f1f17147a9359
AUX WEXT-EXT-nuts.patch 3150 RMD160 a89ceb7e6f34e4b2be1b8c35ed8ed141c20a2f20 SHA1 d71520c21765fcec6f710970df40e1091d2feb75 SHA256 be6a5f2746ff6cf5963e95b1c7a895cc343c930de22a47e41b4ed0d24a60a6f0
AUX ath_ignore_eeprom.patch 2096 RMD160 87f268cfcf06115464b64377e5dd05bfc467203d SHA1 ffb607d19a8622f0a9ea11ee09269f0af2a1ea28 SHA256 def6985a8c1486bfe78c8cf72333f620d88730fc1c3116d016a03725a6ba2226
AUX blinky.patch 357 RMD160 6c93e916efc56412f316076e836c1c5d98e58047 SHA1 e23568801309cdf2a01fa5be8cd3b9a3fcff5edd SHA256 1c2f0e18ecbcf2c07ba732671e77408326d2566d260f0252002c5698f9e65e30
AUX compat-chaos.patch 6187 RMD160 2b8477fbf8b8bde456c5c32a8146330232ae355f SHA1 7bd56bcb3c50eb6f22be7ec24b886ae70bf747cd SHA256 5e8c11b46bc8acf10a2ce8b934fec32662b57c003c99e5e0ca4717a8c6b19474
AUX driver-debug.patch 2801 RMD160 9f060be68ffa41d7db4c6dd2c46eaa7326f9b16d SHA1 fcde4a43b165d4dda201663c107c23e8db3afd43 SHA256 06a37359ac7129a6f7db2f4e7f72d67c1f7014fd0adf439a89d119415a4316c2
@ -65,5 +66,6 @@ EBUILD compat-wireless-2.6.35_rc1.ebuild 3919 RMD160 380650a0684f84a2224fd52b678
EBUILD compat-wireless-2.6.35_rc2-r1.ebuild 4233 RMD160 4375ab9a967d25115ee242fab3ed569151bcc9e6 SHA1 6c76de2792d02c63f3af0e31d0b0a9a2ea53ec82 SHA256 8d191166fd6152b8f8616ffa348a55cf6c43bd07827ba7017b59f0c7153d1463
EBUILD compat-wireless-2.6.35_rc2-r2.ebuild 4461 RMD160 21f448a52cc0a4496466d8758e88c30f3cd5ae8b SHA1 079025518fe5f7017475955b0ec108ee9702aa36 SHA256 90d0812cc29fa9171a41aa544be3c165088ad1b3b7117858295107a8e5d87e00
EBUILD compat-wireless-2.6.35_rc2-r3.ebuild 4681 RMD160 c743c4d1778fa0b85701a59610362bef9e45fa4d SHA1 febdb112f1bd611fc4cc49c59be32e1ea1643e29 SHA256 0bd4a805ffbe4b1885a7eb6576ff49cc38d0998de8d9d7714a19a7ada6f8117a
EBUILD compat-wireless-2.6.35_rc2-r4.ebuild 5338 RMD160 c958feaf0ad9754019ceefdf61d45d7f07abbe40 SHA1 cf7f85f33d61c92cd5a10b46cc32e5aad7fbfffa SHA256 7d35e3a1dd9b3f4a0762ae2778d81414be8e23df861f783826da3ec84f812559
EBUILD compat-wireless-2.6.35_rc2.ebuild 4171 RMD160 9f8506a4323e2ebb98aa19097c3e1fabdd8ddd59 SHA1 d63d5ee7b18f4f7d12eb85114a687db88ec5157c SHA256 391b2399765f37e1421c30a3f6171072a338d39ec891a7fe9ff472dc1af10b0b
MISC metadata.xml 228 RMD160 cd3fb26b5d8049ab5dba38f21d7654ec033aa0eb SHA1 3148dfbdced7a623a311d21c6f728ab9c7135dae SHA256 8715828d1bff71d5d96b991ba600bae9376c1c80c96f0f102260fc335ca22487

View file

@ -0,0 +1,138 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
inherit linux-mod linux-info versionator
##Stable
MY_P=${P/_rc/-rc}
MY_PV=v$(get_version_component_range 1-3)
DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="atheros_obey_crda debugfs debug-driver full-debug injection noleds tinyversionoverride"
DEPEND=">=sys-devel/gcc-4.4.3-r2"
RDEPEND="=sys-kernel/linux-firmware-99999999"
S=${WORKDIR}/${MY_P}
RESTRICT="strip"
CONFIG_CHECK="!DYNAMIC_FTRACE"
pkg_setup() {
if ! version_is_at_least 4.4.3 "$(gcc-fullversion)"; then
die
fi
linux-mod_pkg_setup
kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
if use tinyversionoverride; then
ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
ewarn "kernel is older than the compat-wireless you are installing."
ewarn "Most likely you have no clue what you are doing and should hit control-C now"
ewarn "before you downgrade your system. Ten seconds to think about it."
epause 10
else
ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
ewarn "trying to install. If you are certain that your kernel is older then you can set"
ewarn "the tinyversionoverride use flag to override this safety check."
epause 5
die "Your kernel version is too close to the compat-wireless version to risk installation."
fi
fi
linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
}
src_prepare() {
#whynot patch is against the makefile to fix general brokeness
epatch "${FILESDIR}"/whynot-2.6.32.patch
#this patch fixes a trivial typo in the config.mk
epatch "${FILESDIR}"/fix-typos-2.6.35_rc2.patch
#this patch is needed to forcibly enable new ralink chips because the shipped config.mk doesn't enable them
epatch "${FILESDIR}"/force-enable-new-ralink.patch
epatch "${FILESDIR}"/force-enable-new-ralink-pci.patch
#this patch is needed for general craziness of WEXT being removed from the kernel
epatch "${FILESDIR}"/WEXT-EXT-nuts.patch
#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
if use atheros_obey_crda; then
ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
ewarn "This use flag will cause the eeprom of the card to be ignored and force"
ewarn "world roaming on the device until crda provides a valid regdomain."
ewarn "Short version, this is not a way to break the law, this will automatically"
ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
ewarn "Pausing for 10 secs..."
epause 10
epatch "${FILESDIR}"/ath_ignore_eeprom.patch
fi
if use injection; then
epatch "${FILESDIR}"/400[24]_*.patch
epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
epatch "${FILESDIR}"/compat-chaos.patch
epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
# epatch "${FILESDIR}"/super_secret_patch.diff
fi
use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
if use full-debug; then
if use debug-driver ; then
sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
else
ewarn "Enabling full-debug includes debug-driver."
sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
fi
fi
}
src_compile() {
addpredict "${KERNEL_DIR}"
set_arch_to_kernel
emake KVER="${KV_FULL}" || die "emake failed"
}
src_install() {
for file in $(find -name \*.ko); do
insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
doins "${file}" || die "failed to install module ${file}"
done
dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
scripts/madwifi-unload scripts/athload scripts/iwl-load \
scripts/b43enable scripts/load.sh \
scripts/unload.sh || die "script installation failed"
dodir /usr/lib/compat-wireless
exeinto /usr/lib/compat-wireless
doexe scripts/modlib.sh || die
dodoc README || die
dodir /$(get_libdir)/udev/rules.d/
insinto /$(get_libdir)/udev/rules.d/
doins udev/50-compat_firmware.rules
exeinto /$(get_libdir)/udev/
doexe udev/compat_firmware.sh
}
pkg_postinst() {
update_depmod
update_moduledb
einfo 'You may have problem if you do not run "depmod -ae" after this installation'
einfo 'To switch to the new drivers without reboot run unload.sh then load.sh'
}
pkg_postrm() {
remove_moduledb
}

View file

@ -0,0 +1,70 @@
diff -Naur /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c
--- /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c 2010-06-11 14:16:36.000000000 -0400
+++ /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c 2010-06-21 17:20:13.000000000 -0400
@@ -18,6 +18,9 @@
#include <net/cfg80211.h>
#include <net/mac80211.h>
#include "regd.h"
+
+#ifdef ATH_FORCE_REGD
+
#include "regd_common.h"
/*
@@ -587,3 +590,5 @@
}
}
EXPORT_SYMBOL(ath_regd_get_band_ctl);
+
+#endif
diff -Naur /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h
--- /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h 2010-06-11 14:16:36.000000000 -0400
+++ /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h 2010-06-21 17:21:33.000000000 -0400
@@ -250,6 +250,41 @@
CTRY_BELGIUM2 = 5002
};
+#ifndef ATH_FORCE_REGD
+
+static inline bool
+ath_is_world_regd(struct ath_regulatory *reg)
+{
+ return true;
+}
+
+static inline int
+ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
+ int (*reg_notifier)(struct wiphy *wiphy,
+ struct regulatory_request *request))
+{
+ return 0;
+}
+
+
+static inline u32
+ath_regd_get_band_ctl(struct ath_regulatory *reg,
+ enum ieee80211_band band)
+{
+ return SD_NO_CTL;
+}
+
+static inline int
+ath_reg_notifier_apply(struct wiphy *wiphy,
+ struct regulatory_request *request,
+ struct ath_regulatory *reg)
+{
+ return 0;
+}
+
+
+#else
+
bool ath_is_world_regd(struct ath_regulatory *reg);
int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
int (*reg_notifier)(struct wiphy *wiphy,
@@ -261,3 +296,5 @@
struct ath_regulatory *reg);
#endif
+
+#endif