compat-wireless: adding checks and allowing disable of certain drivers which often fail

This commit is contained in:
Zero_Chaos 2011-06-29 02:43:43 +00:00
parent daf979e7c9
commit 0c38df59d8
2 changed files with 159 additions and 0 deletions

View file

@ -71,5 +71,6 @@ EBUILD compat-wireless-3.0_rc1.ebuild 5703 RMD160 263a5bc297a7a123c8f0e9dfcd5cb1
EBUILD compat-wireless-3.0_rc4-r1.ebuild 5613 RMD160 f70a05365a265407451eed6a74b91cb1d3ab2bc5 SHA1 7ad8bdf1dec216d050807a035cc8e882f8674d1d SHA256 b038e285306f8ec254977b9a59c6157da25168b332c6a689f9290cbb94a20859
EBUILD compat-wireless-3.0_rc4-r2.ebuild 5839 RMD160 85e1636bdfb5e73f3a7d8b9eefc5e637fc6791c0 SHA1 9edfdc1128bbedfea86bdc6bf9e6dc14ce8093a0 SHA256 91caa75920122bf53dc2b015e7973f48d7630c1ce1d0dc9dd30940efc73a5635
EBUILD compat-wireless-3.0_rc4-r3.ebuild 5917 RMD160 a780e9ba7e32b564f04dc4877db0e46546e0111c SHA1 7d7c6668c5d8da77ac2cc94f16dc9f3bdc4f8852 SHA256 ff84d40d5b66662ad9aad0496037ff342fd97474c3c6e4023583e1f34260b0d8
EBUILD compat-wireless-3.0_rc4-r4.ebuild 6008 RMD160 9f9b3c70a5e20591ab26fe95f453d463b84f1aa0 SHA1 4df99ed2cc1ea7765064734c7eb43c24576ff511 SHA256 5a7193a98d31a4aa52a68b4ab413cf1f723a7c372774538e7c43232368c8bb55
EBUILD compat-wireless-3.0_rc4.ebuild 5650 RMD160 bffef5f32337d8eda8d25fd9cc427c3da68c8d97 SHA1 c05e8892f913a642681531977f7b6a18ea528387 SHA256 95d1fdbe4fb38d72bb0ee3f4a814ea6aa9bbee1a4b4da35aa1747605a74c84a3
MISC metadata.xml 228 RMD160 cd3fb26b5d8049ab5dba38f21d7654ec033aa0eb SHA1 3148dfbdced7a623a311d21c6f728ab9c7135dae SHA256 8715828d1bff71d5d96b991ba600bae9376c1c80c96f0f102260fc335ca22487

View file

@ -0,0 +1,158 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="4"
inherit linux-mod linux-info versionator eutils
##Stable
MY_P=${P/_rc/-rc}
MY_PV=v$(get_version_component_range 1-2).0
DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
CRAZY_VERSIONING="1"
SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~arm ~amd64 ~x86"
IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
DEPEND=""
RDEPEND=">=sys-kernel/linux-firmware-20110604
sys-fs/udev"
S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
RESTRICT="strip"
CONFIG_CHECK="!DYNAMIC_FTRACE"
pkg_setup() {
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."
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."
die "Your kernel version is too close to the compat-wireless version to risk installation."
fi
fi
#these things are not optional
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_ !"
if use b43; then
linux_chkconfig_module SSB || die "CONFIG_SSB must _module_ to update b43 !"
fi
}
src_prepare() {
epatch "${FILESDIR}"/make-make.patch
#this patch fixes a trivial typo in the config.mk
epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
#this may or may not HELP the channel -1 issue. this is not a fix
epatch "${FILESDIR}"/channel-negative-one-maxim.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..."
epatch "${FILESDIR}"/ath_regd_optional.patch
fi
if use injection; then
epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.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
epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
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
# Disable B44 ethernet driver
if ! use b44; then
sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
fi
# fixme: there are more bluethooth settings in the config.mk
if ! use bluetooth; then
sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
fi
}
src_compile() {
addpredict "${KERNEL_DIR}"
set_arch_to_kernel
emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
}
src_install() {
for file in $(find -name \*.ko); do
insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
doins "${file}"
done
dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
scripts/madwifi-unload scripts/athload scripts/iwl-load \
scripts/b43enable scripts/unload.sh
dodir /usr/lib/compat-wireless
exeinto /usr/lib/compat-wireless
doexe scripts/modlib.sh
dodoc README
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
if use !livecd; then
if use loadmodules; then
/usr/sbin/unload.sh
/sbin/udevadm trigger
einfo "Your new modules have been loaded for you, sorry for the network hiccup."
fi
fi
einfo "If you didn't USE=loadmodules you can still switch to the new drivers without reboot."
einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the needed drivers."
}
pkg_postrm() {
remove_moduledb
}