M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
if [ -d net ] ; then
make clean
fi
rm -rf net
rm -rf drivers
rm -rf include
rm -rf compat
rm -rf udev
rm -f .compat_base_tree
rm -f .compat_base_tree_version
rm -f .compat_version
rm -f code-metrics.txt
echo "Cleaned compat-drivers"

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./scripts/admin-clean.sh $@
./scripts/admin-update.sh $@

View File

@ -0,0 +1,741 @@
#!/usr/bin/env bash
#
# Copyright 2007, 2008, 2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Use this to update compat-drivers to the latest
# linux-next.git tree you have.
#
# Usage: you should have the latest pull of linux-next.git
# git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
# We assume you have it on your ~/linux-next/ directory. If you do,
# just run this script from the compat-drivers directory.
# You can specify where your GIT_TREE is by doing:
#
# export GIT_TREE=/home/mcgrof/linux-next/
# Pretty colors
GREEN="\033[01;32m"
YELLOW="\033[01;33m"
NORMAL="\033[00m"
BLUE="\033[34m"
RED="\033[31m"
PURPLE="\033[35m"
CYAN="\033[36m"
UNDERLINE="\033[02m"
# File in which code metrics will be written
CODE_METRICS=code-metrics.txt
# The GIT URL's for linux-next and compat trees
GIT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
GIT_COMPAT_URL="git://github.com/mcgrof/compat.git"
####################
# Helper functions #
# ##################
# Refresh patches using quilt
patchRefresh() {
if [ -d patches.orig ] ; then
rm -rf .pc patches/series
else
mkdir patches.orig
fi
export QUILT_PATCHES=$1
mv -u $1/* patches.orig/
for i in patches.orig/*.patch; do
if [ ! -f "$i" ]; then
echo -e "${RED}No patches found in $1${NORMAL}"
break;
fi
echo -e "${GREEN}Refresh backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
quilt import $i
quilt push -f
RET=$?
if [[ $RET -ne 0 ]]; then
echo -e "${RED}Refreshing $i failed${NORMAL}, update it"
echo -e "use ${CYAN}quilt edit [filename]${NORMAL} to apply the failed part manually"
echo -e "use ${CYAN}quilt refresh${NORMAL} after the files are corrected and rerun this script"
cp patches.orig/README $1/README
exit $RET
fi
QUILT_DIFF_OPTS="-p" quilt refresh -p ab --no-index --no-timestamp
done
quilt pop -a
cp patches.orig/README $1/README
rm -rf patches.orig .pc $1/series
}
###
# usage() function
###
usage() {
printf "Usage: $0 [refresh] [ --help | -h | -s | -n | -p | -c ] [subsystems]
where subsystems can be network, drm or both. Network is enabled by default.\n\n"
printf "${GREEN}%10s${NORMAL} - Update all your patch offsets using quilt\n" "refresh"
printf "${GREEN}%10s${NORMAL} - Get and apply pending-stable/ fixes purging old files there\n" "-s"
printf "${GREEN}%10s${NORMAL} - Apply the patches from linux-next-cherry-picks directory\n" "-n"
printf "${GREEN}%10s${NORMAL} - Apply the patches from linux-next-pending directory\n" "-p"
printf "${GREEN}%10s${NORMAL} - Apply the patches from crap directory\n" "-c"
}
###
# Code metrics related functions
# 4 parameters get passed to them:
# (ORIG_CODE, CHANGES, ADD, DEL)
###
brag_backport() {
COMPAT_FILES_CODE=$(find ./ -type f -name \*.[ch] | egrep "^./compat/|include/linux/compat" |
xargs wc -l | tail -1 | awk '{print $1}')
let COMPAT_ALL_CHANGES=$2+$COMPAT_FILES_CODE
printf "${GREEN}%10s${NORMAL} - backport code changes\n" $2
printf "${GREEN}%10s${NORMAL} - backport code additions\n" $3
printf "${GREEN}%10s${NORMAL} - backport code deletions\n" $4
printf "${GREEN}%10s${NORMAL} - backport from compat module\n" $COMPAT_FILES_CODE
printf "${GREEN}%10s${NORMAL} - total backport code\n" $COMPAT_ALL_CHANGES
printf "${RED}%10s${NORMAL} - %% of code consists of backport work\n" \
$(perl -e 'printf("%.4f", 100 * '$COMPAT_ALL_CHANGES' / '$1');')
}
nag_pending_stable() {
printf "${YELLOW}%10s${NORMAL} - Code changes brought in from pending-stable\n" $2
printf "${YELLOW}%10s${NORMAL} - Code additions brought in from pending-stable\n" $3
printf "${YELLOW}%10s${NORMAL} - Code deletions brought in from pending-stable\n" $4
printf "${RED}%10s${NORMAL} - %% of code being cherry picked from pending-stable\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');')
}
nag_next_cherry_pick() {
printf "${YELLOW}%10s${NORMAL} - Code changes brought in from linux-next\n" $2
printf "${YELLOW}%10s${NORMAL} - Code additions brought in from linux-next\n" $3
printf "${YELLOW}%10s${NORMAL} - Code deletions brought in from linux-next\n" $4
printf "${RED}%10s${NORMAL} - %% of code being cherry picked from linux-next\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');')
}
nag_pending() {
printf "${YELLOW}%10s${NORMAL} - Code changes posted but not yet merged\n" $2
printf "${YELLOW}%10s${NORMAL} - Code additions posted but not yet merged\n" $3
printf "${YELLOW}%10s${NORMAL} - Code deletions posted but not yet merged\n" $4
printf "${RED}%10s${NORMAL} - %% of code not yet merged\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');')
}
nag_crap() {
printf "${RED}%10s${NORMAL} - Crap changes not yet posted\n" $2
printf "${RED}%10s${NORMAL} - Crap additions not yet posted\n" $3
printf "${RED}%10s${NORMAL} - Crap deletions not yet posted\n" $4
printf "${RED}%10s${NORMAL} - %% of crap code\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');')
}
nagometer() {
CHANGES=0
ORIG_CODE=$2
ADD=$(grep -Hc ^+ $1/*.patch| awk -F":" 'BEGIN {sum=0} {sum += $2} END { print sum}')
DEL=$(grep -Hc ^- $1/*.patch| awk -F":" 'BEGIN {sum=0} {sum += $2} END { print sum}')
# Total code is irrelevant unless you take into account each part,
# easier to just compare against the original code.
# let TOTAL_CODE=$ORIG_CODE+$ADD-$DEL
let CHANGES=$ADD+$DEL
case `dirname $1` in
"patches")
brag_backport $ORIG_CODE $CHANGES $ADD $DEL
;;
"pending-stable")
nag_pending_stable $ORIG_CODE $CHANGES $ADD $DEL
;;
"linux-next-cherry-picks")
nag_next_cherry_pick $ORIG_CODE $CHANGES $ADD $DEL
;;
"linux-next-pending")
nag_pending $ORIG_CODE $CHANGES $ADD $DEL
;;
"crap")
nag_crap $ORIG_CODE $CHANGES $ADD $DEL
;;
*)
;;
esac
}
# Copy each file in $1 into $2
copyFiles() {
FILES=$1
TARGET=$2
for file in $FILES; do
echo "Copying $GIT_TREE/$TARGET/$file"
cp "$GIT_TREE/$TARGET/$file" $TARGET/
done
}
copyDirectories() {
DIRS=$1
for dir in $DIRS; do
echo "Copying $GIT_TREE/$dir/*.[ch]"
cp $GIT_TREE/$dir/{Kconfig,Makefile,*.[ch]} $dir/ &> /dev/null
done
}
# First check cmdline args to understand
# which patches to apply and which release tag to set.
#
# Release tags (with corresponding cmdline switches):
# ---------------------------------------------------
# s: Include pending-stable/ patches (-s)
# n: Include linux-next-cherry-picks/ patches (-n)
# p: Include linux-next-pending/ patches (-p)
# c: Include crap/ patches (-c)
# Note that the patches under patches/{subsystem} are applied by default.
#
# If "refresh" is given as a cmdline argument, the script
# uses quilt to refresh the patches. This is useful if patches
# can not be applied correctly after a code update in $GIT_URL.
#
# A final parameter drm, wlan or both determines which subsystem
# drivers will be fetched in from the GIT repository. To retain
# compatibility with compat-wireless, wlan/bt/eth drivers are
# fetched in by default.
ENABLE_NETWORK=1
ENABLE_DRM=0
SUBSYSTEMS=
EXTRA_PATCHES="patches"
REFRESH="n"
GET_STABLE_PENDING="n"
POSTFIX_RELEASE_TAG=""
if [ $# -ge 1 ]; then
if [ $# -gt 6 ]; then
usage $0
exit
fi
while [ $# -ne 0 ]; do
case $1 in
"-s")
GET_STABLE_PENDING="y"
EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable"
EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable/backports/"
POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}s"
shift
;;
"-n")
EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-cherry-picks"
POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}n"
shift
;;
"-p")
EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-pending"
POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}p"
shift
;;
"-c")
EXTRA_PATCHES="${EXTRA_PATCHES} crap"
POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}c"
shift
;;
"refresh")
REFRESH="y"
shift
;;
"network")
ENABLE_NETWORK=1
shift
;;
"drm")
ENABLE_DRM=1
shift
;;
"-h" | "--help")
usage $0
exit
;;
*)
echo "Unexpected argument passed: $1"
usage $0
exit
;;
esac
done
fi
# SUBSYSTEMS is used to select which patches to apply
if [[ "$ENABLE_NETWORK" == "1" ]]; then
SUBSYSTEMS="network"
fi
if [[ "$ENABLE_DRM" == "1" ]]; then
SUBSYSTEMS+=" drm"
fi
# User exported this variable
if [ -z $GIT_TREE ]; then
GIT_TREE="$HOME/linux-next"
if [ ! -d $GIT_TREE ]; then
echo "Please tell me where your linux-next git tree is."
echo "You can do this by exporting its location as follows:"
echo
echo " export GIT_TREE=$HOME/linux-next"
echo
echo "If you do not have one you can clone the repository:"
echo " git clone $GIT_URL"
echo
echo "Alternatively, you can use get-compat-trees script "
echo "from compat.git tree to fetch the necessary trees."
exit 1
fi
else
echo "You said to use git tree at: $GIT_TREE for linux-next"
fi
if [ -z $GIT_COMPAT_TREE ]; then
GIT_COMPAT_TREE="$HOME/compat"
if [ ! -d $GIT_COMPAT_TREE ]; then
echo "Please tell me where your compat git tree is."
echo "You can do this by exporting its location as follows:"
echo
echo " export GIT_COMPAT_TREE=$HOME/compat"
echo
echo "If you do not have one you can clone the repository:"
echo " git clone $GIT_COMPAT_URL"
echo
echo "Alternatively, you can use get-compat-trees script "
echo "from compat.git tree to fetch the necessary trees."
exit 1
fi
else
echo "You said to use git tree at: $GIT_COMPAT_TREE for compat"
fi
# Now define what files to copy from $GIT_URL
INCLUDE_NET_BT="hci_core.h
l2cap.h
bluetooth.h
rfcomm.h
hci.h
hci_mon.h
mgmt.h
sco.h
smp.h
a2mp.h"
# Required wlan headers from include/linux
INCLUDE_LINUX_WLAN="ieee80211.h
nl80211.h
pci_ids.h
eeprom_93cx6.h
ath9k_platform.h
wl12xx.h
rndis.h"
# For rndis_wext
INCLUDE_LINUX_USB_WLAN="usbnet.h
rndis_host.h"
# For rndis_wlan, we need a new rndis_host.ko, cdc_ether.ko and usbnet.ko
RNDIS_REQUIREMENTS="Makefile
rndis_host.c
cdc_ether.c
usbnet.c"
# For libertas driver
INCLUDE_LINUX_LIBERTAS_WLAN="libertas_spi.h"
# 802.11 related headers
INCLUDE_NET="cfg80211.h
cfg80211-wext.h
ieee80211_radiotap.h
lib80211.h
mac80211.h
regulatory.h"
# Network related directories
NET_WLAN_DIRS="net/wireless
net/mac80211
net/rfkill"
# Bluetooth related directories
NET_BT_DIRS="net/bluetooth
net/bluetooth/bnep
net/bluetooth/cmtp
net/bluetooth/rfcomm
net/bluetooth/hidp"
# Drivers that have their own directory
DRIVERS_WLAN="drivers/net/wireless/ath
drivers/net/wireless/ath/carl9170
drivers/net/wireless/ath/ath5k
drivers/net/wireless/ath/ath6kl
drivers/net/wireless/ath/ath9k
drivers/ssb
drivers/bcma
drivers/net/wireless/b43
drivers/net/wireless/b43legacy
drivers/net/wireless/brcm80211
drivers/net/wireless/brcm80211/brcmfmac
drivers/net/wireless/brcm80211/brcmsmac
drivers/net/wireless/brcm80211/brcmsmac/phy
drivers/net/wireless/brcm80211/brcmutil
drivers/net/wireless/brcm80211/include
drivers/net/wireless/iwlegacy
drivers/net/wireless/iwlwifi
drivers/net/wireless/iwlwifi/pcie
drivers/net/wireless/iwlwifi/dvm
drivers/net/wireless/rt2x00
drivers/net/wireless/zd1211rw
drivers/net/wireless/libertas
drivers/net/wireless/p54
drivers/net/wireless/rtl818x
drivers/net/wireless/rtl818x/rtl8180
drivers/net/wireless/rtl818x/rtl8187
drivers/net/wireless/rtlwifi
drivers/net/wireless/rtlwifi/rtl8192c
drivers/net/wireless/rtlwifi/rtl8192ce
drivers/net/wireless/rtlwifi/rtl8192cu
drivers/net/wireless/rtlwifi/rtl8192se
drivers/net/wireless/rtlwifi/rtl8192de
drivers/net/wireless/libertas_tf
drivers/net/wireless/ipw2x00
drivers/net/wireless/ti
drivers/net/wireless/ti/wl12xx
drivers/net/wireless/ti/wl1251
drivers/net/wireless/ti/wlcore
drivers/net/wireless/ti/wl18xx
drivers/net/wireless/orinoco
drivers/net/wireless/mwifiex"
# Staging drivers
STAGING_DRIVERS=""
# Ethernet drivers having their own directory
DRIVERS_ETH="drivers/net/ethernet/atheros
drivers/net/ethernet/atheros/atl1c
drivers/net/ethernet/atheros/atl1e
drivers/net/ethernet/atheros/atlx
drivers/net/ethernet/atheros/alx"
# Bluetooth drivers
DRIVERS_BT="drivers/bluetooth"
# Drivers that belong the the wireless directory
DRIVERS_WLAN_FILES="adm8211.c
adm8211.h
at76c50x-usb.c
at76c50x-usb.h
mac80211_hwsim.c
mac80211_hwsim.h
mwl8k.c
rndis_wlan.c"
# DRM drivers
DRIVERS_DRM="drivers/gpu/drm/ast
drivers/gpu/drm/cirrus
drivers/gpu/drm/gma500
drivers/gpu/drm/i2c
drivers/gpu/drm/i810
drivers/gpu/drm/i915
drivers/gpu/drm/mgag200
drivers/gpu/drm/nouveau
drivers/gpu/drm/radeon
drivers/gpu/drm/ttm
drivers/gpu/drm/via
drivers/gpu/drm/vmwgfx"
# UDL uses the new dma-buf API, let's disable this for now
#DRIVERS="$DRIVERS drivers/gpu/drm/udl"
rm -rf drivers/
mkdir -p include/net/bluetooth \
include/linux/usb \
include/linux/unaligned \
include/linux/spi \
include/trace \
include/pcmcia \
include/crypto \
drivers/bcma \
drivers/misc/eeprom \
drivers/net/usb \
drivers/net/ethernet/broadcom \
drivers/platform/x86 \
drivers/ssb \
drivers/staging \
$NET_WLAN_DIRS \
$NET_BT_DIRS \
$DRIVERS_WLAN \
$DRIVERS_ETH \
$DRIVERS_BT \
$DRIVERS_DRM
if [[ "$ENABLE_NETWORK" == "1" ]]; then
# WLAN and bluetooth files
copyFiles "$INCLUDE_LINUX_WLAN" "include/linux"
copyFiles "$INCLUDE_NET" "include/net"
copyFiles "$INCLUDE_NET_BT" "include/net/bluetooth"
copyFiles "$INCLUDE_LINUX_USB_WLAN" "include/linux/usb"
copyFiles "$INCLUDE_LINUX_LIBERTAS_WLAN" "include/linux/spi"
copyFiles "$DRIVERS_WLAN_FILES" "drivers/net/wireless"
copyFiles "$RNDIS_REQUIREMENTS" "drivers/net/usb"
copyDirectories "$NET_WLAN_DIRS"
copyDirectories "$NET_BT_DIRS"
copyDirectories "$DRIVERS_BT"
copyDirectories "$DRIVERS_WLAN"
copyDirectories "$DRIVERS_ETH"
cp -a $GIT_TREE/include/linux/ssb include/linux/
cp -a $GIT_TREE/include/linux/bcma include/linux/
cp -a $GIT_TREE/include/linux/rfkill.h include/linux/rfkill_backport.h
# Misc
cp $GIT_TREE/drivers/misc/eeprom/{Makefile,eeprom_93cx6.c} drivers/misc/eeprom/
# Copy files needed for statically compiled regulatory rules database
cp $GIT_TREE/net/wireless/{db.txt,genregdb.awk} net/wireless/
# Top level wireless driver Makefile
cp $GIT_TREE/drivers/net/wireless/Makefile drivers/net/wireless
# Broadcom case
DIR="drivers/net/ethernet/broadcom"
cp $GIT_TREE/$DIR/b44.[ch] drivers/net/ethernet/broadcom
# Not yet
echo "obj-\$(CONFIG_B44) += b44.o" > drivers/net/ethernet/broadcom/Makefile
fi
if [[ "$ENABLE_DRM" == "1" ]]; then
# DRM drivers
copyDirectories "$DRIVERS_DRM"
# Copy standalone drivers
echo "Copying $GIT_TREE/drivers/gpu/drm/*.[ch]"
cp $GIT_TREE/drivers/gpu/drm/{Makefile,*.[ch]} drivers/gpu/drm/
# Copy DRM headers
cp -a $GIT_TREE/include/drm include/
# drivers/gpu/drm/i915/intel_pm.c requires this
cp $GIT_TREE/drivers/platform/x86/intel_ips.h drivers/platform/x86
# Copy radeon reg_srcs for hostprogs
cp -a $GIT_TREE/drivers/gpu/drm/radeon/reg_srcs drivers/gpu/drm/radeon
# Finally get the DRM top-level makefile
cp $GIT_TREE/drivers/gpu/drm/Makefile drivers/gpu/drm
fi
# Staging drivers in their own directory
for i in $STAGING_DRIVERS; do
if [ ! -d $GIT_TREE/$i ]; then
continue
fi
rm -rf $i
echo -e "Copying ${RED}STAGING${NORMAL} $GIT_TREE/$i/*.[ch]"
# staging drivers tend to have their own subdirs...
cp -a $GIT_TREE/$i drivers/staging/
done
# Finally copy MAINTAINERS file
cp $GIT_TREE/MAINTAINERS ./
# Compat stuff
COMPAT="compat"
mkdir -p $COMPAT
echo "Copying $GIT_COMPAT_TREE/ files..."
cp $GIT_COMPAT_TREE/compat/*.[ch] $COMPAT/
cp $GIT_COMPAT_TREE/compat/Makefile $COMPAT/
cp -a $GIT_COMPAT_TREE/udev .
cp -a $GIT_COMPAT_TREE/scripts $COMPAT/
cp $GIT_COMPAT_TREE/bin/ckmake $COMPAT/
cp -a $GIT_COMPAT_TREE/include/linux/* include/linux/
cp -a $GIT_COMPAT_TREE/include/net/* include/net/
cp -a $GIT_COMPAT_TREE/include/trace/* include/trace/
cp -a $GIT_COMPAT_TREE/include/pcmcia/* include/pcmcia/
cp -a $GIT_COMPAT_TREE/include/crypto/* include/crypto/
# Clean up possible *.mod.c leftovers
find -type f -name "*.mod.c" -exec rm -f {} \;
# files we suck in for wireless drivers
export WSTABLE="
net/wireless/
net/mac80211/
net/rfkill/
drivers/net/wireless/
net/bluetooth/
drivers/bluetooth/
drivers/net/ethernet/atheros/atl1c/
drivers/net/ethernet/atheros/atl1e/
drivers/net/ethernet/atheros/atlx/
include/linux/nl80211.h
include/linux/rfkill.h
include/net/mac80211.h
include/net/regulatory.h
include/net/cfg80211.h"
# Stable pending, if -n was passed
if [[ "$GET_STABLE_PENDING" = y ]]; then
if [ -z $NEXT_TREE ]; then
NEXT_TREE="/$HOME/linux-next"
if [ ! -d $NEXT_TREE ]; then
echo "Please tell me where your linux-next git tree is."
echo "You can do this by exporting its location as follows:"
echo
echo " export NEXT_TREE=$HOME/linux-next"
echo
echo "If you do not have one you can clone the repository:"
echo " git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
exit 1
fi
else
echo "You said to use git tree at: $NEXT_TREE for linux-next"
fi
LAST_DIR=$PWD
cd $GIT_TREE
if [ -f localversion* ]; then
echo -e "You should be using a stable tree to use the -s option"
exit 1
fi
# we now assume you are using a stable tree
cd $GIT_TREE
LAST_STABLE_UPDATE=$(git describe --abbrev=0)
cd $NEXT_TREE
PENDING_STABLE_DIR="pending-stable/"
rm -rf $PENDING_STABLE_DIR
git tag -l | grep $LAST_STABLE_UPDATE 2>&1 > /dev/null
if [[ $? -ne 0 ]]; then
echo -e "${BLUE}Tag $LAST_STABLE_UPDATE not found on $NEXT_TREE tree: bailing out${NORMAL}"
exit 1
fi
echo -e "${GREEN}Generating stable cherry picks... ${NORMAL}"
echo -e "\nUsing command on directory $PWD:"
echo -e "\ngit format-patch --grep=\"stable@vger.kernel.org\" -o $PENDING_STABLE_DIR ${LAST_STABLE_UPDATE}.. $WSTABLE"
git format-patch --grep="stable@vger.kernel.org" -o $PENDING_STABLE_DIR ${LAST_STABLE_UPDATE}.. $WSTABLE
if [ ! -d ${LAST_DIR}/${PENDING_STABLE_DIR} ]; then
echo -e "Assumption that ${LAST_DIR}/${PENDING_STABLE_DIR} directory exists failed"
exit 1
fi
echo -e "${GREEN}Purging old stable cherry picks... ${NORMAL}"
rm -f ${LAST_DIR}/${PENDING_STABLE_DIR}/*.patch
cp ${PENDING_STABLE_DIR}/*.patch ${LAST_DIR}/${PENDING_STABLE_DIR}/
if [ -f ${LAST_DIR}/${PENDING_STABLE_DIR}/.ignore ]; then
for i in $(cat ${LAST_DIR}/${PENDING_STABLE_DIR}/.ignore) ; do
echo -e "Skipping $i from generated stable patches..."
rm -f ${LAST_DIR}/${PENDING_STABLE_DIR}/*$i*
done
fi
echo -e "${GREEN}Updated stable cherry picks, review with git diff and update hunks with ./scripts/admin-update.sh -s refresh${NORMAL}"
cd $LAST_DIR
fi
ORIG_CODE=$(find ./ -type f -name \*.[ch] |
egrep -v "^./compat/|include/linux/compat" |
xargs wc -l | tail -1 | awk '{print $1}')
printf "\n${CYAN}compat-drivers code metrics${NORMAL}\n\n" > $CODE_METRICS
printf "${PURPLE}%10s${NORMAL} - Total upstream lines of code being pulled\n" $ORIG_CODE >> $CODE_METRICS
for subsystem in $SUBSYSTEMS; do
for dir in $EXTRA_PATCHES; do
LAST_ELEM=$dir
done
for dir in $EXTRA_PATCHES; do
PATCHDIR="$dir/$subsystem"
if [[ ! -d $PATCHDIR ]]; then
echo -e "${RED}Patches: $PATCHDIR empty, skipping...${NORMAL}"
continue
fi
if [[ $LAST_ELEM = $dir && "$REFRESH" = y ]]; then
patchRefresh $PATCHDIR
fi
FOUND=$(find $PATCHDIR/ -maxdepth 1 -name \*.patch | wc -l)
if [ $FOUND -eq 0 ]; then
continue
fi
for i in $(ls -v $PATCHDIR/*.patch); do
echo -e "${GREEN}Applying backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
patch -p1 -N -t < $i
RET=$?
if [[ $RET -ne 0 ]]; then
echo -e "${RED}Patching $i failed${NORMAL}, update it"
exit $RET
fi
done
nagometer $PATCHDIR $ORIG_CODE >> $CODE_METRICS
done
done
DIR="$PWD"
cd $GIT_TREE
GIT_DESCRIBE=$(git describe)
GIT_BRANCH=$(git branch --no-color |sed -n 's/^\* //p')
GIT_BRANCH=${GIT_BRANCH:-master}
GIT_REMOTE=$(git config branch.${GIT_BRANCH}.remote)
GIT_REMOTE=${GIT_REMOTE:-origin}
GIT_REMOTE_URL=$(git config remote.${GIT_REMOTE}.url)
GIT_REMOTE_URL=${GIT_REMOTE_URL:-unknown}
cd $GIT_COMPAT_TREE
git describe > $DIR/.compat_base
cd $DIR
echo -e "${GREEN}Updated${NORMAL} from local tree: ${BLUE}${GIT_TREE}${NORMAL}"
echo -e "Origin remote URL: ${CYAN}${GIT_REMOTE_URL}${NORMAL}"
cd $DIR
if [ -d ./.git ]; then
if [[ ${POSTFIX_RELEASE_TAG} != "" ]]; then
echo -e "$(git describe)-${POSTFIX_RELEASE_TAG}" > .compat_version
else
echo -e "$(git describe)" > .compat_version
fi
cd $GIT_TREE
TREE_NAME=${GIT_REMOTE_URL##*/}
echo $TREE_NAME > $DIR/.compat_base_tree
echo $GIT_DESCRIBE > $DIR/.compat_base_tree_version
case $TREE_NAME in
"wireless-testing.git") # John's wireless-testing
echo -e "This is a ${RED}wireless-testing.git${NORMAL} compat-drivers release"
;;
"linux-next.git") # The linux-next integration testing tree
echo -e "This is a ${RED}linux-next.git${NORMAL} compat-drivers release"
;;
"linux-stable.git") # Greg's all stable tree
echo -e "This is a ${GREEN}linux-stable.git${NORMAL} compat-drivers release"
;;
"linux-2.6.git") # Linus' 2.6 tree
echo -e "This is a ${GREEN}linux-2.6.git${NORMAL} compat-drivers release"
;;
*)
;;
esac
cd $DIR
echo -e "\nBase tree: ${GREEN}$(cat .compat_base_tree)${NORMAL}" >> $CODE_METRICS
echo -e "Base tree version: ${PURPLE}$(cat .compat_base_tree_version)${NORMAL}" >> $CODE_METRICS
echo -e "compat.git: ${CYAN}$(cat .compat_base)${NORMAL}" >> $CODE_METRICS
echo -e "compat-drivers release: ${YELLOW}$(cat .compat_version)${NORMAL}" >> $CODE_METRICS
fi
echo -e "Code metrics archive: ${GREEN}http://bit.ly/H6BTF7${NORMAL}" >> $CODE_METRICS
cat $CODE_METRICS
./scripts/driver-select restore

46
external/compat-wireless/scripts/athenable vendored Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
#
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Makes sure either ath5k or MadWifi are ready to be used. This allows
# us to choose any driver without blacklisting each other.
. /usr/lib/compat-drivers/modlib.sh
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
ATH5K="ath5k"
ATH9K="ath9k"
MADWIFI="ath_pci"
# Appended to module file at the end when we want to ignore one
IGNORE_SUFFIX=".ignore"
USAGE="Usage: $0 [ ath5k | madwifi ]"
# Default behavior: disables any MadWifi driver present and makes sure
# ath5k is enabled
if [ $# -eq 0 ]; then
module_disable $MADWIFI
module_enable $ATH5K
module_enable $ATH9K
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "ath5k" ]; then
module_disable $MADWIFI
module_enable $ATH5K
module_enable $ATH9K
elif [ "$MODULE" == "madwifi" ]; then
module_disable $ATH5K
module_disable $ATH9K
module_enable $MADWIFI
else
echo "$USAGE"
exit
fi

57
external/compat-wireless/scripts/athload vendored Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Loads ath5k or madwifi
. /usr/lib/compat-drivers/modlib.sh
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
USAGE="Usage: $0 [ ath5k | madwifi ]"
# Default behavior: unload MadWifi and load ath5k
if [ $# -eq 0 ]; then
athenable ath5k
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "ath5k" ]; then
madwifi-unload
athenable ath5k
modprobe ath5k
CHECK=`modprobe -l ath5k`
if [ ! -z $CHECK ]; then
echo "ath5k loaded successfully"
fi
modprobe ath9k
CHECK=`modprobe -l ath9k`
if [ ! -z $CHECK ]; then
echo "ath9k loaded successfully"
fi
elif [ "$MODULE" == "madwifi" ]; then
CHECK=`modprobe -l ath5k`
if [ ! -z $CHECK ]; then
echo "ath5k currently loaded, going to try to unload the module..."
modprobe -r --ignore-remove ath5k
fi
athenable madwifi
# MadWifi may be loaded, but it doesn't mean devices
# currently available were picked up
madwifi-unload 2>&1 > /dev/null
modprobe ath_pci
CHECK=`modprobe -l ath_pci`
if [ ! -z $CHECK ]; then
echo "MadWifi loaded successfully!"
fi
else
echo "$USAGE"
exit
fi

59
external/compat-wireless/scripts/b43enable vendored Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
#
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Makes sure either b43, b43legacy (new mac80211 drivers) or bcm43xx
# is enabled to be used. This allows us to choose any driver without
# blacklisting each other.
. /usr/lib/compat-drivers/modlib.sh
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
B43S="b43 b43legacy"
B43_OLD="bcm43xx"
B43_PROP="wl"
# Appended to module file at the end when we want to ignore one
USAGE="Usage: $0 [ b43 | bcm43xx | wl ]"
function enable_b43 {
module_disable $B43_OLD
module_disable $B43_PROP
for i in $B43S; do
module_enable $i
done
}
# Default behavior: disables the old bcm43xx driver and enables b43
# and b43legacy
if [ $# -eq 0 ]; then
enable_b43
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "bcm43xx" ]; then
for i in $B43S; do
module_disable $i
done
module_disable $B43_PROP
module_enable $B43_OLD
elif [ "$MODULE" == "wl" ]; then
for i in $B43S; do
module_disable $i
done
module_disable $B43_OLD
module_enable $B43_PROP
elif [ "$MODULE" == "b43" ]; then
enable_b43
else
echo "$USAGE"
exit
fi

65
external/compat-wireless/scripts/b43load vendored Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Loads new broadcom drivers (b43 and b43legacy) or the old ones (bcm43xx)
. /usr/lib/compat-drivers/modlib.sh
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
USAGE="Usage: $0 [ b43 | bcm43xx ]"
# Default behavior: unload bcm43xx and load b43 and b43legacy
if [ $# -eq 0 ]; then
1=b43
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "b43" ]; then
grep bcm43xx /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo Unloading $i...
modprobe -r --ignore-remove bcm43xx
fi
# Enables both b43 and b43legacy
b43enable b43
modprobe b43
modprobe b43legacy
CHECK=`modprobe -l b43`
if [ ! -z $CHECK ]; then
echo "b43 loaded successfully"
fi
CHECK=`modprobe -l b43legacy`
if [ ! -z $CHECK ]; then
echo "b43legacy loaded successfully"
fi
elif [ "$MODULE" == "bcm43xx" ]; then
CHECK=`modprobe -l b43`
if [ ! -z $CHECK ]; then
echo "b43 currently loaded, going to try to unload the module..."
modprobe -r --ignore-remove b43
fi
CHECK=`modprobe -l b43legacy`
if [ ! -z $CHECK ]; then
echo "b43legacy currently loaded, going to try to unload the module..."
modprobe -r --ignore-remove b43legacy
fi
b43enable bcm43xx
# bcm43xx may be loaded already lets remove them first
modprobe -r --ignore-remov bcm43xx 2>&1 > /dev/null
modprobe bcm43xx
CHECK=`modprobe -l bcm43xx`
if [ ! -z $CHECK ]; then
echo "bcm43xx loaded successfully!"
fi
else
echo "$USAGE"
exit
fi

14
external/compat-wireless/scripts/btunload.sh vendored Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
MODULES="$MODULES ath3k bcm203x bluecard_cs bnep bpa10x bt3c_cs btmrvl btmrvl_sdio btsdio"
MODULES="$MODULES btusb btuart_cs cmtp dtl1_cs hidp hci_vhci hci_uart rfcomm sco bluetooth l2cap"
echo Stoping bluetooth service..
/etc/init.d/bluetooth stop
/etc/init.d/bluetooth status
for i in $MODULES; do
grep ^$i /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo Unloading $i...
modprobe -r --ignore-remove $i
fi
done

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# This script checks the compat-drivers configuration file and if changes were made
# regenerates the compat_autoconf header.
# These variables are expected to be exported:
#COMPAT_CONFIG=".config"
#COMPAT_CONFIG_CW="config"
#CONFIG_CHECK=".${COMPAT_CONFIG}.md5"
#COMPAT_AUTOCONF="include/linux/compat_autoconf.h"
function gen_compat_autoconf {
echo "./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG $COMPAT_CONFIG_CW > $COMPAT_AUTOCONF"
./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG $COMPAT_CONFIG_CW > $COMPAT_AUTOCONF
md5sum $COMPAT_CONFIG $COMPAT_CONFIG_CW > $CONFIG_CHECK
}
which md5sum 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo "md5sum required to detect changes on config file"
exit -1
fi
if [ ! -f $CONFIG_CHECK ]; then
gen_compat_autoconf
exit
fi
md5sum -c $CONFIG_CHECK 2> /dev/null 1>/dev/null
if [ $? -ne 0 ]; then
echo "Changes to compat-drivers's configuration was detected, regenerating autoconf..."
gen_compat_autoconf
fi

83
external/compat-wireless/scripts/check_depmod vendored Executable file
View File

@ -0,0 +1,83 @@
#!/bin/bash
# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com>
#
# Ensures your distribution likes to prefer updates/ over the kernel/
# search updates built-in
# Seems Mandriva has an $DEPMOD_DIR but it doesn't have any files,
# so lets deal with those distributions.
DEPMOD_CONF="/etc/depmod.conf"
DEPMOD_CONF_TMP="$DEPMOD_CONF.compat-drivers.old"
DEPMOD_DIR="/etc/depmod.d/"
COMPAT_DEPMOD_FILE=compat-drivers.conf
GREP_REGEX_UPDATES="^[[:space:]]*search.*[[:space:]]updates\([[:space:]]\|$\)"
GREP_REGEX_SEARCH="^[[:space:]]*search[[:space:]].\+$"
DEPMOD_CMD="depmod"
function add_compat_depmod_conf {
echo "NOTE: Your distribution lacks an $DEPMOD_DIR directory with "
echo "updates/ directory being prioritized for modules, we're adding "
echo "one for you."
mkdir -p $DEPMOD_DIR
FIRST_FILE=$(ls $DEPMOD_DIR|head -1)
[ -n "$FIRST_FILE" ] && while [[ $FIRST_FILE < $COMPAT_DEPMOD_FILE ]]; do
COMPAT_DEPMOD_FILE="0$COMPAT_DEPMOD_FILE"
done
echo "search updates" > $DEPMOD_DIR/$COMPAT_DEPMOD_FILE
}
function add_global_depmod_conf {
echo "NOTE: Your distribution lacks updates/ directory being"
echo "prioritized for modules, we're adding it to $DEPMOD_CONF."
rm -f $DEPMOD_CONF_TMP
[ -f $DEPMOD_CONF ] && cp -f $DEPMOD_CONF $DEPMOD_CONF_TMP
echo "search updates" > $DEPMOD_CONF
[ -f $DEPMOD_CONF_TMP ] && cat $DEPMOD_CONF_TMP >> $DEPMOD_CONF
}
function depmod_updates_ok {
echo "depmod will prefer updates/ over kernel/ -- OK!"
}
function add_depmod_conf {
if [ -f "$DEPMOD_CONF" ]; then
add_global_depmod_conf
else
DEPMOD_VERSION=$($DEPMOD_CMD --version | cut -d" " -f2 | sed "s/\.//")
if [[ $DEPMOD_VERSION -gt 36 ]]; then
add_compat_depmod_conf
else
add_global_depmod_conf
fi
fi
}
# =============================================================================
# === MAIN ====================================================================
# =============================================================================
GREP_FILES=""
[ -f $DEPMOD_CONF ] && GREP_FILES="$DEPMOD_CONF"
if [ -d $DEPMOD_DIR ]; then
DEPMOD_FILE_COUNT=$(ls $DEPMOD_DIR | wc -l)
[[ $DEPMOD_FILE_COUNT -gt 0 ]] && GREP_FILES="$GREP_FILES $DEPMOD_DIR/*"
fi
if [ -n "$GREP_FILES" ]; then
grep -q "$GREP_REGEX_SEARCH" $GREP_FILES
if [[ $? -eq 0 ]]; then
grep -q "$GREP_REGEX_UPDATES" $GREP_FILES
if [[ $? -eq 0 ]]; then
depmod_updates_ok
else
add_depmod_conf
fi
else
depmod_updates_ok
fi
else
depmod_updates_ok
fi
exit 0

View File

@ -0,0 +1,40 @@
#!/bin/bash
# To be used by distributions using compressed modules
COMPRESSION_FOUND="n"
COUNT=0;
for i in $(modprobe -l mac80211); do
let COUNT=$COUNT+1
i=${i##*/}
if [ "$i" = "mac80211.ko.gz" ]; then
COMPRESSION_FOUND="y"
continue
fi
done
if [ $COUNT -gt 2 ]; then
echo "More than two mac80211 modules are detected, please report this."
exit
fi
if [ $COMPRESSION_FOUND = "n" ]; then
exit
fi
DIRS="$KLIB/$KMODDIR/net/mac80211/"
# This handles both drivers/net/ and drivers/net/wireless/
DIRS="$DIRS $KLIB/$KMODDIR/net/"
DIRS="$DIRS $KLIB/$KMODDIR/drivers/ssb/"
DIRS="$DIRS $KLIB/$KMODDIR/drivers/net/usb/"
DIRS="$DIRS $KLIB/$KMODDIR/drivers/net/wireless/"
DIRS="$DIRS $KLIB/$KMODDIR/drivers/misc/eeprom/"
for i in $DIRS; do
if [ ! -d $i ]; then
continue;
fi
for driver in $(find $i -type f -name *.ko); do
gzip -9 $driver
done
done

517
external/compat-wireless/scripts/driver-select vendored Executable file
View File

@ -0,0 +1,517 @@
#!/usr/bin/env bash
# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com>
#
# This script allows you to select your compat-drivers driver and
# reduce compilation time.
COMPAT_CONFIG_CW="config.mk"
DRIVERS_MAKEFILE="drivers/net/wireless/Makefile"
ATH_MAKEFILE="drivers/net/wireless/ath/Makefile"
ATH9K_MAKEFILE="drivers/net/wireless/ath/ath9k/Makefile"
BRCM80211_MAKEFILE="drivers/net/wireless/brcm80211/Makefile"
RT2X00_MAKEFILE="drivers/net/wireless/rt2x00/Makefile"
TI_MAKEFILE="drivers/net/wireless/ti/Makefile"
NET_WIRELESS_MAKEFILE="net/wireless/Makefile"
EEPROM_MAKEFILE="drivers/misc/eeprom/Makefile"
DRIVERS_NET_ATHEROS="drivers/net/ethernet/atheros/Makefile"
DRIVERS_NET_BROADCOM="drivers/net/ethernet/broadcom/Makefile"
DRIVERS_NET_USB_MAKEFILE="drivers/net/usb/Makefile"
SSB_MAKEFILE="drivers/ssb/Makefile"
BCMA_MAKEFILE="drivers/bcma/Makefile"
# used to backup files from foo to foo.${BACKUP_EXT}
# If you change this also modify restore_compat() and
# restore_file() below I couldn't find a way to use
# the $BACKUP_EXT there.
BACKUP_EXT="bk"
# Pretty colors
GREEN="\033[01;32m"
YELLOW="\033[01;33m"
NORMAL="\033[00m"
BLUE="\033[34m"
RED="\033[31m"
PURPLE="\033[35m"
CYAN="\033[36m"
UNDERLINE="\033[02m"
SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170 ath6kl wil6210 b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac brcmfmac"
# b43 needs some more work for driver-select, the SSB stuff, plus
# what if you update b44 but not b43? It will bust.
SUPPORTED_ETH_DRIVERS="atl1 atl2 atl1e atl1c alx"
function usage {
echo -e "${GREEN}Usage${NORMAL}: ${BOLD}$0${NORMAL} [ ${PURPLE}<driver-name>${NORMAL} | ${CYAN}<driver-group-name>${NORMAL} | ${GREEN}restore${NORMAL} ]"
# These should match the switch below.
echo -e "Supported 802.11 drivers:"
for i in $SUPPORTED_80211_DRIVERS; do
echo -e "\t${PURPLE}${i}${NORMAL}"
done
echo
echo -e "Supported Ethernet drivers:"
for i in $SUPPORTED_ETH_DRIVERS; do
echo -e "\t${PURPLE}${i}${NORMAL}"
done
# These should match the switch below.
echo -e "\nSupported group drivers:"
echo -e "\t${CYAN}atheros${NORMAL} < ${PURPLE} ath5k ath9k carl9170 zd1211rw ath6kl wil6210${NORMAL}>"
echo -e "\t${CYAN}ath${NORMAL} < ${PURPLE} ath5k ath9k carl9170 ath6kl wil6210${NORMAL}>"
echo -e "\t${CYAN}brcm80211${NORMAL} < ${PURPLE} brcmsmac brcmfmac ${NORMAL}>"
echo -e "\t${CYAN}intel${NORMAL} < ${PURPLE} iwlwifi, iwlegacy ${NORMAL}>"
echo -e "\t${CYAN}rtl818x${NORMAL} < ${PURPLE} rtl8180 rtl8187 ${NORMAL}>"
echo -e "\t${CYAN}rtlwifi${NORMAL} < ${PURPLE} rtl8192ce ${NORMAL}>"
echo -e "\t${CYAN}ti${NORMAL} < ${PURPLE} wl1251 wl12xx (SPI and SDIO)${NORMAL}>"
echo -e "\nSupported group drivers: Bluetooth & Ethernet:"
echo -e "\t${CYAN}atlxx${NORMAL} < ${PURPLE} atl1 atl2 atl1e alx${NORMAL}>"
echo -e "\t${CYAN}bt${NORMAL} < ${PURPLE} Linux bluetooth drivers ${NORMAL}>"
echo -e "Restoring compat-drivers:"
echo -e "\t${GREEN}restore${NORMAL}: you can use this option to restore compat-drivers to the original state"
}
function backup_file {
if [ -f $1.${BACKUP_EXT} ]; then
echo -e "Backup exists: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}"
return
fi
echo -e "Backing up makefile: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}"
cp $1 $1.bk
}
function disable_makefile
{
backup_file $1
echo > $1
}
function select_drivers_from_makefile
{
MAKEFILE="$1"
shift
backup_file $MAKEFILE
CONFIGS=""
COUNT=0
for i in $@; do
if [[ "$CONFIGS" = "" ]]; then
CONFIGS="$i"
else
CONFIGS="${CONFIGS}|$i"
fi
done
egrep "$CONFIGS" $MAKEFILE > ${MAKEFILE}.tmp
mv ${MAKEFILE}.tmp ${MAKEFILE}
}
function select_drivers
{
select_drivers_from_makefile $DRIVERS_MAKEFILE $@
}
function disable_lib80211
{
backup_file $NET_WIRELESS_MAKEFILE
perl -i -ne 'print if ! /LIB80211/ ' $NET_WIRELESS_MAKEFILE
}
function disable_b44 {
backup_file $DRIVERS_NET_BROADCOM
perl -i -ne 'print if ! /CONFIG_B44/ ' $DRIVERS_NET_BROADCOM
}
function disable_ssb
{
disable_makefile ${SSB_MAKEFILE}
perl -i -ne 'print if ! /drivers\/ssb\//' Makefile
}
function disable_bcma
{
disable_makefile ${BCMA_MAKEFILE}
perl -i -ne 'print if ! /drivers\/bcma\//' Makefile
}
function disable_rfkill
{
backup_file Makefile
perl -i -ne 'print if ! /CONFIG_COMPAT_RFKILL/' Makefile
}
function disable_eeprom
{
disable_makefile ${EEPROM_MAKEFILE}
perl -i -ne 'print if ! /drivers\/misc\/eeprom\//' Makefile
}
function disable_usbnet
{
disable_makefile ${DRIVERS_NET_USB_MAKEFILE}
perl -i -ne 'print if ! /drivers\/net\/usb\//' Makefile
}
function disable_usbnet {
perl -i -ne 'print if ! /CONFIG_COMPAT_NET_USB_MODULES/' Makefile
}
function disable_ethernet {
perl -i -ne 'print if ! /CONFIG_COMPAT_NETWORK_MODULES/' Makefile
}
function disable_var_03 {
perl -i -ne 'print if ! /CONFIG_COMPAT_VAR_MODULES/' Makefile
}
function disable_bt {
perl -i -ne 'print if ! /CONFIG_COMPAT_BLUETOOTH/' Makefile
}
function disable_80211 {
perl -i -ne 'print if ! /CONFIG_COMPAT_WIRELESS/' Makefile
}
function disable_bt_usb_ethernet {
backup_file Makefile
disable_usbnet
disable_ethernet
disable_bt
disable_update-initramfs
}
function disable_bt_usb_ethernet_var {
backup_file Makefile
disable_bt_usb_ethernet
disable_var_03
}
function enable_only_ethernet {
backup_file Makefile
backup_file $DRIVERS_NET_BROADCOM
backup_file $DRIVERS_NET_ATHEROS
disable_staging
disable_usbnet
disable_var_03
disable_bt
# rfkill may be needed if you enable b44 as you may have b43
disable_rfkill
disable_80211
}
function disable_var {
disable_ssb
disable_bcma
disable_usbnet
disable_eeprom
disable_update-initramfs
}
function disable_var_01 {
disable_lib80211
disable_var
}
function disable_var_02 {
#var_01 with eeprom not disabled
disable_lib80211
disable_ssb
disable_bcma
disable_usbnet
disable_update-initramfs
}
function disable_staging {
backup_file Makefile
perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' Makefile
}
function disable_update-initramfs
{
backup_file Makefile
perl -i -ne 'print if ! /update-initramfs/' Makefile
}
function select_ath_driver
{
backup_file $ATH_MAKEFILE
perl -i -ne 'print if /'$1'/ || /CONFIG_ATH_/ || /ath-objs/ || /regd.o/ || /hw.o/ || /key.o/' $ATH_MAKEFILE
disable_var_01
}
function select_ath9k_driver
{
select_ath_driver CONFIG_ATH9K_HW
# In the future here we'll add stuff to disable ath9k_htc
}
function select_ath9k_driver_ap
{
select_ath9k_driver
backup_file $COMPAT_CONFIG_CW
perl -i -ne 'print if ! /CONFIG_COMPAT_ATH9K_RATE_CONTROL/ ' $COMPAT_CONFIG_CW
}
function select_ti_drivers
{
select_drivers CONFIG_WL_TI
select_drivers_from_makefile $TI_MAKEFILE $@
}
function select_brcm80211_driver
{
backup_file $BRCM80211_MAKEFILE
perl -i -ne 'print if /'$1'/ || /CONFIG_BRCMUTIL/ ' $BRCM80211_MAKEFILE
}
function restore_file {
#ORIG=$(shell ${1%%.${BACKUP_EXT}})
ORIG=${1%%.bk}
cp $1 $ORIG
rm -f $1
echo -e "Restored makefile: ${CYAN}${ORIG}${NORMAL} (and removed backup)"
}
function restore_compat {
#FILES=$(find ./ -type f -name *.$BACKUP_EXT)
FILES=$(find ./ -type f -name *.bk)
for i in $FILES; do
restore_file $i
done
}
if [ $# -ne 1 ]; then
usage
exit
fi
if [ ! -f .compat_version ]; then
echo "Must run $0 from the compat-drivers top level directory"
exit
fi
if [[ ! -f built-in.o ]]; then
if [[ "$1" != "restore" ]]; then
echo -e "${PURPLE}Processing new driver-select request...${NORMAL}"
fi
fi
# Always backup the top level Makefile, unless restoring
if [[ "$1" != "restore" ]]; then
backup_file Makefile
fi
# If a user selects a new driver make sure we clean up for them
# first and also restore the backup makefiles then. Otherwise
# we'll be trying to leave drivers on Makefiles which are not
# already there from a previous run.
if [ -f built-in.o ]; then
echo -e "${PURPLE}Old build found, going to clean this up first...${NORMAL}"
make clean
echo -e "${PURPLE}Restoring Makefiles...${NORMAL}"
./$0 restore
fi
case $1 in
restore)
restore_compat
;;
# Group drivers
atheros)
select_drivers CONFIG_ATH_COMMON \
CONFIG_COMPAT_ZD1211RW
disable_staging
disable_bt_usb_ethernet_var
disable_var_01
;;
ath)
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
disable_var_01
;;
intel)
select_drivers CONFIG_IWLWIFI \
CONFIG_IWLEGACY \
CONFIG_IPW
disable_staging
disable_var
disable_bt
disable_ethernet
disable_usbnet
;;
iwlwifi)
select_drivers CONFIG_IWLWIFI
disable_staging
disable_var_01
disable_bt
disable_ethernet
disable_usbnet
;;
iwlegacy)
select_drivers CONFIG_IWLEGACY
disable_staging
disable_var_01
disable_bt
disable_ethernet
disable_usbnet
;;
rtl818x)
select_drivers CONFIG_RTL8180 CONFIG_RTL8187
disable_staging
disable_bt_usb_ethernet
disable_ssb
disable_bcma
disable_lib80211
;;
rtlwifi)
select_drivers CONFIG_RTL8192CE CONFIG_RTLWIFI
disable_staging
disable_bt_usb_ethernet_var
disable_lib80211
;;
ti)
select_drivers CONFIG_WL_TI
disable_staging
disable_var_01
;;
brcm80211)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_BRCMUTIL \
CONFIG_BRCMFMAC \
CONFIG_BRCMSMAC
;;
# Singular modules
ath5k)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath_driver CONFIG_ATH5K
#patch -p1 < enable-older-kernels/enable-2.6.23.patch
;;
ath9k)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath9k_driver
;;
ath9k_ap)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath9k_driver_ap
;;
carl9170)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath_driver CONFIG_CARL9170
;;
ath9k_htc)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath9k_driver
;;
ath6kl)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath_driver CONFIG_ATH6KL
;;
wil6210)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_ATH_COMMON
select_ath_driver CONFIG_WIL6210
;;
brcmsmac)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_BRCMSMAC
select_brcm80211_driver CONFIG_BRCMSMAC CONFIG_BRCMUTIL
;;
brcmfmac)
disable_staging
disable_bt_usb_ethernet_var
select_drivers CONFIG_BRCMFMAC
select_brcm80211_driver CONFIG_BRCMFMAC CONFIG_BRCMUTIL
;;
zd1211rw)
select_drivers CONFIG_COMPAT_ZD1211RW
disable_staging
disable_var_01
;;
b43)
disable_staging
disable_bt_usb_ethernet
disable_eeprom
disable_lib80211
select_drivers CONFIG_B43
;;
rt2x00)
select_drivers CONFIG_RT2X00
disable_staging
disable_bt_usb_ethernet
disable_var_02
;;
wl1251)
select_ti_drivers CONFIG_WL1251
disable_staging
disable_var_01
;;
wl12xx)
select_ti_drivers CONFIG_WL12XX
disable_staging
disable_var_01
;;
wl18xx)
select_ti_drivers CONFIG_WL18XX
disable_staging
disable_var_01
;;
# Ethernet and Bluetooth drivers
atl1)
enable_only_ethernet
disable_b44
echo -e "obj-\$(CONFIG_ATL1) += atlx/" > $DRIVERS_NET_ATHEROS
;;
atl2)
enable_only_ethernet
disable_b44
echo -e "obj-\$(CONFIG_ATL2) += atlx/" > $DRIVERS_NET_ATHEROS
;;
atl1e)
enable_only_ethernet
disable_b44
echo -e "obj-\$(CONFIG_ATL1E) += atl1e/" > $DRIVERS_NET_ATHEROS
;;
atl1c)
enable_only_ethernet
disable_b44
echo -e "obj-\$(CONFIG_ATL1C) += atl1c/" > $DRIVERS_NET_ATHEROS
;;
alx)
enable_only_ethernet
disable_b44
echo -e "obj-\$(CONFIG_ALX) += alx/" > $DRIVERS_NET_ATHEROS
;;
atlxx)
select_drivers CONFIG_ATL1 CONFIG_ATL2 CONFIG_ATL1E CONFIG_ALX
enable_only_ethernet
disable_b44
disable_update-initramfs
;;
bt)
select_drivers CONFIG_BT
disable_var
disable_ethernet
disable_staging
disable_80211
;;
*)
echo "Unsupported driver"
exit
;;
esac

View File

@ -0,0 +1,204 @@
#!/usr/bin/env bash
#
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Use this to parse a small .config equivalent looking file to generate
# our own autoconf.h. This file has defines for each config option
# just like the kernels include/linux/autoconf.h
#
# XXX: consider using scripts/kconfig/confdata.c instead.
# On the downside this would require the user to have libc though.
# This indicates which is the oldest kernel we support
# Update this if you are adding support for older kernels.
OLDEST_KERNEL_SUPPORTED="2.6.24"
COMPAT_RELEASE=".compat_version"
KERNEL_RELEASE=".compat_base_tree_version"
MULT_DEP_FILE=".compat_pivot_dep"
if [ $# -ne 2 ]; then
echo "Usage $0 <generic-compat-config-file> <compat-drivers-config-file>"
exit
fi
COMPAT_CONFIG_1="$1"
COMPAT_CONFIG_2="$2"
if [[ ! -f $COMPAT_CONFIG_1 || ! -f $COMPAT_CONFIG_2 ]]; then
echo "File $COMPAT_CONFIG_1 and $COMPAT_CONFIG_2 files must be present"
exit
fi
if [ ! -f $COMPAT_RELEASE -o ! -f $KERNEL_RELEASE ]; then
echo "Error: $COMPAT_RELEASE or $KERNEL_RELEASE file is missing"
exit
fi
CREL=$(cat $COMPAT_RELEASE | tail -1)
KREL=$(cat $KERNEL_RELEASE | tail -1)
DATE=$(date)
# Defines a CONFIG_ option if not defined yet, this helps respect
# linux/autoconf.h
function define_config {
VAR=$1
VALUE=$2
case $VALUE in
n) # Try to undefine it
echo "#undef $VAR"
;;
y)
echo "#ifndef $VAR"
echo "#define $VAR 1"
echo "#endif /* $VAR */ "
;;
m)
echo "#ifndef $VAR"
echo "#define $VAR 1"
echo "#endif /* $VAR */ "
;;
*) # Assume string
# XXX: add better checks to make sure what was on
# the right was indeed a string
echo "#ifndef $VAR"
echo "#define $VAR \"$VALUE\""
echo "#endif /* $VAR */ "
;;
esac
}
# This deals with core compat-drivers kernel requirements.
function define_config_req {
VAR=$1
echo "#ifndef $VAR"
echo -n "#error Compat-drivers requirement: $VAR must be enabled "
echo "in your kernel"
echo "#endif /* $VAR */"
}
# This handles modules which have dependencies from the kernel
# which compat-drivers isn't providing yet either because
# the dependency is not available as kernel module or
# the module simply isn't provided by compat-drivers.
function define_config_dep {
VAR=$1
VALUE=$2
DEP=$3
WARN_VAR="COMPAT_WARN_$VAR"
echo "#ifdef $DEP"
define_config $VAR $VALUE
echo "#else"
# XXX: figure out a way to warn only once
# define only once in case user tried to enable config option
# twice in config.mk
echo "#ifndef $WARN_VAR"
# Lets skip these for now.. they might be too annoying
#echo "#warning Skipping $VAR as $DEP was needed... "
#echo "#warning This just means $VAR won't be built and is not fatal."
echo "#define $WARN_VAR"
echo "#endif /* $VAR */"
echo "#endif /* $WARN_VAR */"
}
# This handles options which have *multiple* dependencies from the kernel
function define_config_multiple_deps {
VAR=$1
VALUE=$2
DEP_ARRAY=$3
# First, put all ifdefs
for i in $(cat $MULT_DEP_FILE); do
echo "#ifdef $i"
done
# Now put our option in the middle
define_config $VAR $VALUE
# Now close all ifdefs
# First, put all ifdefs
for i in $(cat $MULT_DEP_FILE); do
echo "#endif"
done
}
function kernel_version_req {
VERSION=$(echo $1 | sed -e 's/\./,/g')
echo "#if (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION))"
echo "#error Compat-wireless requirement: Linux >= $VERSION"
echo "#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION) */ "
}
cat <<EOF
#ifndef COMPAT_AUTOCONF_INCLUDED
#define COMPAT_AUTOCONF_INCLUDED
/*
* Automatically generated C config: don't edit
* $DATE
* compat-drivers: $CREL
* linux: $KREL
*/
#define COMPAT_RELEASE "$CREL"
#define COMPAT_KERNEL_RELEASE "$KREL"
EOF
# Checks user is compiling against a kernel we support
kernel_version_req $OLDEST_KERNEL_SUPPORTED
# For each CONFIG_FOO=x option
for i in $(egrep -h '^export CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG_1 $COMPAT_CONFIG_2 | \
sed 's/export //' | \
sed 's/ /+/'); do
case $i in
'ifdef+CONFIG_'* )
echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(ifdef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (defined(RHEL_MAJOR) \&\& RHEL_MAJOR == \2 \&\& RHEL_MINOR >= \3)/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/'
continue
;;
'ifndef+CONFIG_'* )
echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,\2,0))/' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(ifndef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (!defined(RHEL_MAJOR) || RHEL_MAJOR != \2 || RHEL_MINOR < \3)/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) \&\& !defined(\2_MODULE)/'
continue
;;
'else+#CONFIG_'* | 'endif+#CONFIG_'* )
echo "#$i */" |sed -e 's/+#/ \/* /g'
continue
;;
CONFIG_* )
# Get the element on the left of the "="
VAR=$(echo $i | cut -d"=" -f 1)
# Get the element on the right of the "="
VALUE=$(echo $i | cut -d"=" -f 2)
# Handle core kernel module depenencies here.
case $VAR in
# ignore this, we have a special hanlder for this at the botttom
# instead. We still need to keep this in config.mk to let Makefiles
# know its enabled so just ignore it here.
CONFIG_MAC80211_QOS)
continue
;;
esac
# Any other module which can *definitely* be built as a module goes here
define_config $VAR $VALUE
continue
;;
esac
done
# Deal with special cases. CONFIG_MAC80211_QOS is such a case.
# We handle this specially for different kernels we support.
if [ -f $KLIB_BUILD/Makefile ]; then
MAJORLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
SUBLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^\(2\.6\|[3-9]\)\.\([0-9]\+\).*/\2/p')
if [ $MAJORLEVEL -eq 2 -a $SUBLEVEL -le 22 ]; then
define_config CONFIG_MAC80211_QOS y
else # kernel >= 2.6.23
# CONFIG_MAC80211_QOS on these kernels requires
# CONFIG_NET_SCHED and CONFIG_NETDEVICES_MULTIQUEUE
rm -f $MULT_DEP_FILE
echo CONFIG_NET_SCHED >> $MULT_DEP_FILE
echo CONFIG_NETDEVICES_MULTIQUEUE >> $MULT_DEP_FILE
define_config_multiple_deps CONFIG_MAC80211_QOS y $ALL_DEPS
rm -f $MULT_DEP_FILE
fi
fi
echo "#endif /* COMPAT_AUTOCONF_INCLUDED */"

56
external/compat-wireless/scripts/iwl-enable vendored Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
#
# Copyright 2007 Luis R. Rodriguez <lrodriguez@atheros.com>
#
# Makes sure either iwlagn (new) or iwl4965 (old)
# is enabled to be used. This allows us to choose any driver without
# blacklisting each other.
. /usr/lib/compat-drivers/modlib.sh
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
IWL_NEW="iwlagn"
IWL_OLD="iwl4965"
# Appended to module file at the end when we want to ignore one
USAGE="Usage: $0 [ $IWL_NEW | $IWL_OLD | iwlwifi ]"
function enable_iwlwifi {
for i in $IWL_OLD $IWL_NEW; do
module_disable $i
done
module_enable iwlwifi
}
function enable_iwlagn {
module_disable $IWL_OLD
for i in $IWL_NEW; do
module_enable $i
done
}
# Default behavior: disables the old iwl4965 driver and enables iwlagn
if [ $# -eq 0 ]; then
enable_iwlagn
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "iwl4965" ]; then
module_disable $IWL_NEW
module_enable $IWL_OLD
elif [ "$MODULE" == "iwlagn" ]; then
enable_iwlagn
elif [ "$MODULE" == "iwlwifi" ]; then
enable_iwlwifi
else
echo "$USAGE"
exit
fi

58
external/compat-wireless/scripts/iwl-load vendored Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
# Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
#
# Loads new Intel iwl (iwlagn) or the old ones (iwl4965)
. /usr/lib/compat-drivers/modlib.sh
IWL_OLD="iwl4965"
IWL_NEW="iwlagn"
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
USAGE="Usage: $0 [ iwlagn | iwl4965 ]"
# Default behavior: unload iwl4965 and load iwlagn
if [ $# -eq 0 ]; then
1=iwlagn
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "iwlagn" ]; then
grep iwl4965 /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo Unloading $i...
modprobe -r --ignore-remove iwl4965
fi
# Enables both b43 and b43legacy
iwl-enable iwlagn
modprobe iwlagn
CHECK=`modprobe -l iwlagn`
if [ ! -z $CHECK ]; then
echo "iwlagn loaded successfully"
fi
elif [ "$MODULE" == "iwl4965" ]; then
CHECK=`modprobe -l iwlagn`
if [ ! -z $CHECK ]; then
echo "iwlagn currently loaded, going to try to unload the module..."
modprobe -r --ignore-remove iwlagn
fi
iwl-enable iwl4965
# iwl4965 may be loaded already lets remove it first
modprobe -r --ignore-remov iwl4965 2>&1 > /dev/null
modprobe iwl4965
CHECK=`modprobe -l iwl4965`
if [ ! -z $CHECK ]; then
echo "iwl4965 loaded successfully!"
fi
else
echo "$USAGE"
exit
fi

View File

@ -0,0 +1,58 @@
#!/bin/sh
# Copyright 2006 Kel Modderman <kelrin@tpg.com.au>
#
# Taken from madwifi scripts. This unloads madwifi
: ${PATTERN='\(ath_.*\|wlan_.*\|wlan\)$'}
: ${MAX_TRIES=10}
test "`id -u`" = 0 || {
echo "ERROR: You must be root to run this script" >&2
exit 1
}
test -r /proc/modules || {
echo "ERROR: Cannot read /proc/modules" >&2
exit 1
}
tries="$MAX_TRIES"
while test "$tries" != "0"; do
skipped=0
IFS='
'
for line in `cat /proc/modules`; do
IFS=' '
set x $line
name="$2"
size="$3"
use_count="$4"
use_name="$5"
state="$6"
expr "$name" : "$PATTERN" >/dev/null || continue
# Compatibility for Linux 2.4.x
test -z "$state" && { use_name="-"; state="Live"; }
if test "$state" != "Live" || test "$use_count" != "0" || \
test "$use_name" != "-"; then
# Don't skip unload in the last run
if test "$tries" != "1"; then
skipped=1
continue
fi
fi
echo "Unloading \"$name\""
sync # to be safe
/sbin/rmmod "$name" || {
echo "ERROR: cannot unload module \"$name\"" >&2
exit 1
}
sync # to be even safer
done
test "$skipped" = "0" && break
tries=$(($tries - 1))
done
exit 0

87
external/compat-wireless/scripts/modlib.sh vendored Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# You can use these to enable/disable modules without blacklisting them
# Make sure our imporant paths are included
PATH=$PATH:/usr/sbin:/sbin
# Appended to module file at the end when we want to ignore one
IGNORE_SUFFIX=".ignore"
VER=`uname -r`
# If 'module' is found, its renamed to 'module.ignore'
function module_disable {
# Basic check to see if this is a module available for loading
MODULE_CHECK=`modprobe -l $1`
if [ -z $MODULE_CHECK ]; then
echo "Module $1 not detected -- this is fine"
return
fi
MODULE=$1
MODULE_KO=${MODULE}.ko
# In case there are more than one of these modules. This can
# happen, for example if your distribution provides one and you have
# compiled one in yourself later.
MODULE_COUNT=`find /lib/modules/$VER/ -name $MODULE_KO | wc -l`
ALL_MODULES=`find /lib/modules/$VER/ -name $MODULE_KO`
COUNT=1
CHECK=`modprobe -l $MODULE`
for i in $ALL_MODULES; do
if [[ $MODULE_COUNT -gt 1 ]]; then
if [[ $COUNT -eq 1 ]]; then
echo -en "$MODULE_COUNT $MODULE modules found "
echo -e "we'll disable all of them"
fi
echo -en "Disabling $MODULE ($COUNT) ..."
else
echo -en "Disabling $MODULE ..."
fi
mv -f $i ${i}${IGNORE_SUFFIX}
depmod -a
CHECK_AGAIN=`modprobe -l $MODULE`
if [ "$CHECK" != "$CHECK_AGAIN" ]; then
echo -e "\t[OK]\tModule disabled:"
echo "$CHECK"
else
echo -e "[ERROR]\tModule is still being detected:"
echo "$CHECK"
fi
let COUNT=$COUNT+1
done
}
# If 'module.ignore' is found, rename it back to 'module'
function module_enable {
MODULE=$1
MODULE_KO=${MODULE}.ko
IGNORED_MODULE=${MODULE_KO}${IGNORE_SUFFIX}
# In case there are more than one of these modules. This can
# happen, for example if your distribution provides one and you have
# compiled one in yourself later.
ALL_MODULES=`find /lib/modules/$VER/ -name $IGNORED_MODULE`
for i in $ALL_MODULES; do
echo -en "Enabling $MODULE ..."
DIR=`dirname $i`
mv $i $DIR/$MODULE_KO
depmod -a
CHECK=`modprobe -l $MODULE`
if [ "$DIR/$MODULE_KO" != $CHECK ]; then
if [ -z $CHECK ]; then
echo -e "\t[ERROR]\tModule could not be enabled"
else
echo -en "\t[OK]\tModule renamed but another "
echo "module file is being preferred"
echo -e "Renamed module:\t\t$DIR/$MODULE_KO"
echo -e "Preferred module:\t$CHECK"
fi
else
echo -e "\t[OK]\tModule enabled: "
echo "$DIR/$MODULE_KO"
fi
# Lets only do this for the first module found
break
done
}

View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
perl -pe 's|(\e)\[(\d+)(;*)(\d*)(\w)||g'

67
external/compat-wireless/scripts/unload.sh vendored Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# The old stack drivers and the mac80211 rc80211_simple modules
# which is no longer on recent kernels (its internal)
OLD_MODULES="iwlwifi_mac80211 rc80211_simple zd1211rw-mac80211"
OLD_MODULES="$OLD_MODULES ieee80211_crypt_tkip ieee80211_crypt_ccmp"
OLD_MODULES="$OLD_MODULES ieee80211softmac ieee80211_crypt ieee80211"
OLD_MODULES="$OLD_MODULES bcm43xx rndis_wext iwl4965"
MODULES="$OLD_MODULES"
MODULES="$MODULES ipw2100 ipw2200 libipw"
MODULES="$MODULES wl1251 wl12xx"
MODULES="$MODULES libertas_cs usb8xxx libertas libertas_sdio libertas_spi"
MODULES="$MODULES libertas_tf libertas_tf_usb"
MODULES="$MODULES adm8211 zd1211rw"
MODULES="$MODULES orinoco_cs orinoco_nortel orinoco_pci orinoco_plx"
MODULES="$MODULES orinoco_tld orinoco_usb spectrum_cs orinoco"
MODULES="$MODULES b43 b44 b43legacy brcm80211 ssb"
MODULES="$MODULES iwl3945 iwlwifi iwlagn iwlcore"
MODULES="$MODULES ath9k ath9k_htc ath9k_common ath9k_hw "
MODULES="$MODULES ath5k ath ath6kl ar9170usb carl9170"
MODULES="$MODULES p54pci p54usb p54spi p54common"
MODULES="$MODULES rt2400pci rt2500pci rt61pci"
MODULES="$MODULES rt2500usb rt73usb"
MODULES="$MODULES rt2800usb rt2800pci rt2800lib"
MODULES="$MODULES rt2x00usb rt2x00pci rt2x00lib"
MODULES="$MODULES rtl8180 rtl8187 rtl8192ce rtlwifi"
MODULES="$MODULES mwl8k mac80211_hwsim"
MODULES="$MODULES at76c50x_usb at76_usb"
MODULES="$MODULES rndis_wlan rndis_host cdc_ether usbnet"
# eeprom_93cx6 is used by rt2x00 (rt61pci, rt2500pci, rt2400pci)
# and Realtek drivers ( rtl8187, rtl8180)
MODULES="$MODULES eeprom_93cx6"
MODULES="$MODULES lib80211_crypt_ccmp lib80211_crypt_tkip lib80211_crypt_wep"
MODULES="$MODULES mac80211 cfg80211 lib80211"
MODULES="$MODULES compat"
# Bluetooth modules
MODULES="$MODULES ath3k bcm203x bluecard_cs bnep bpa10x bt3c_cs btmrvl btmrvl_sdio btsdio"
MODULES="$MODULES btusb btuart_cs cmtp dtl1_cs hidp hci_vhci hci_uart rfcomm sco bluetooth l2cap"
MODULES="$MODULES atl1 atl2 atl1e atl1c alx"
echo Stoping bluetooth service..
/etc/init.d/bluetooth stop
/etc/init.d/bluetooth status
MADWIFI_MODULES="ath_pci ath_rate_sample wlan_scan_sta wlan ath_hal"
IPW3945D="/sbin/ipw3945d-`uname -r`"
if [ -f $IPW3945D ]; then
$IPW3945D --isrunning
if [ ! $? ]; then
echo -n "Detected ipw3945 daemon loaded we're going to "
echo "shut the daemon down now and remove the module."
modprobe -r --ignore-remove ipw3945
fi
fi
grep ath_pci /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo "MadWifi driver is loaded, going to try to unload it..."
./scripts/madwifi-unload
fi
for i in $MODULES; do
grep ^$i /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo Unloading $i...
modprobe -r --ignore-remove $i
fi
done

View File

@ -0,0 +1,33 @@
#!/bin/bash
# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com>
#
# Since we provide ssb, the Ethernet module b44 some people may
# rely on it to netboot, so update the initrafms for each
# distribution.
#
# Note that in the future people may want to wireless-boot
# so this will help with that as well.
LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
KLIB=/lib/modules/$(uname -r)/build
ver=$(echo $KLIB | awk -F "/lib/modules/" '{print $2}' | awk -F"/" '{print $1}')
dir=/boot/
case $LSB_RED_ID in
"Ubuntu")
echo "Updating Ubuntu's initramfs for $ver under $dir ..."
mkinitramfs -o $dir/initrd.img-$ver $ver
echo "Will now run update-grub to ensure grub will find the new initramfs ..."
update-grub
;;
*)
echo "Warning:"
echo "You may or may not need to update your initframfs, you should if"
echo "any of the modules installed are part of your initramfs. To add"
echo "support for your distribution to do this automatically send a"
echo "patch against $0. If your distribution does not require this"
echo "send a patch against the '/usr/bin/lsb_release -i -s': $LSB_RED_ID"
echo "tag for your distribution to avoid this warning."
;;
esac

59
external/compat-wireless/scripts/wlunload.sh vendored Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
# The old stack drivers and the mac80211 rc80211_simple modules
# which is no longer on recent kernels (its internal)
OLD_MODULES="iwlwifi_mac80211 rc80211_simple zd1211rw-mac80211"
OLD_MODULES="$OLD_MODULES ieee80211_crypt_tkip ieee80211_crypt_ccmp"
OLD_MODULES="$OLD_MODULES ieee80211softmac ieee80211_crypt ieee80211"
OLD_MODULES="$OLD_MODULES bcm43xx rndis_wext iwl4965"
MODULES="$OLD_MODULES"
MODULES="$MODULES ipw2100 ipw2200 libipw"
MODULES="$MODULES wl1251 wl12xx"
MODULES="$MODULES libertas_cs usb8xxx libertas libertas_sdio libertas_spi"
MODULES="$MODULES libertas_tf libertas_tf_usb"
MODULES="$MODULES adm8211 zd1211rw"
MODULES="$MODULES orinoco_cs orinoco_nortel orinoco_pci orinoco_plx"
MODULES="$MODULES orinoco_tld orinoco_usb spectrum_cs orinoco"
MODULES="$MODULES b43 b44 b43legacy brcm80211 ssb"
MODULES="$MODULES iwl3945 iwlwifi iwlagn iwlcore"
MODULES="$MODULES ath9k ath9k_htc ath9k_common ath9k_hw "
MODULES="$MODULES ath5k ath ath6kl ar9170usb carl9170"
MODULES="$MODULES p54pci p54usb p54spi p54common"
MODULES="$MODULES rt2400pci rt2500pci rt61pci"
MODULES="$MODULES rt2500usb rt73usb"
MODULES="$MODULES rt2800usb rt2800lib"
MODULES="$MODULES rt2x00usb rt2x00lib"
MODULES="$MODULES rtl8180 rtl8187 rtl8192ce rtlwifi"
MODULES="$MODULES mwl8k mac80211_hwsim"
MODULES="$MODULES at76c50x_usb at76_usb"
MODULES="$MODULES rndis_wlan rndis_host cdc_ether usbnet"
# eeprom_93cx6 is used by rt2x00 (rt61pci, rt2500pci, rt2400pci)
# and Realtek drivers ( rtl8187, rtl8180)
MODULES="$MODULES eeprom_93cx6"
MODULES="$MODULES lib80211_crypt_ccmp lib80211_crypt_tkip lib80211_crypt_wep"
MODULES="$MODULES mac80211 cfg80211 lib80211"
MADWIFI_MODULES="ath_pci ath_rate_sample wlan_scan_sta wlan ath_hal"
IPW3945D="/sbin/ipw3945d-`uname -r`"
if [ -f $IPW3945D ]; then
$IPW3945D --isrunning
if [ ! $? ]; then
echo -n "Detected ipw3945 daemon loaded we're going to "
echo "shut the daemon down now and remove the module."
modprobe -r --ignore-remove ipw3945
fi
fi
grep ath_pci /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo "MadWifi driver is loaded, going to try to unload it..."
./scripts/madwifi-unload
fi
for i in $MODULES; do
grep ^$i /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo Unloading $i...
modprobe -r --ignore-remove $i
fi
done