3 # Copyright 2007, 2008 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
5 # Use this to update compat-wireless-2.6 to the latest
6 # wireless-testing.git tree you have.
8 # Usage: you should have the latest pull of wireless-2.6.git
9 # git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
10 # We assume you have it on your ~/devel/wireless-testing/ directory. If you do,
11 # just run this script from the compat-wireless-2.6 directory.
12 # You can specify where your GIT_TREE is by doing:
14 # export GIT_TREE=/home/mcgrof/wireless-testing/
18 GIT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
19 GIT_COMPAT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat.git"
21 INCLUDE_NET_BT="hci_core.h l2cap.h bluetooth.h rfcomm.h hci.h"
22 NET_BT_DIRS="bluetooth bluetooth/bnep bluetooth/cmtp bluetooth/rfcomm bluetooth/hidp"
24 INCLUDE_LINUX="ieee80211.h nl80211.h wireless.h"
25 INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h eeprom_93cx6.h"
26 INCLUDE_LINUX="$INCLUDE_LINUX ath9k_platform.h"
29 INCLUDE_LINUX_USB="usbnet.h rndis_host.h"
31 INCLUDE_LINUX_SPI="wl12xx.h libertas_spi.h"
33 # The good new yummy stuff
34 INCLUDE_NET="cfg80211.h ieee80211_radiotap.h"
35 INCLUDE_NET="$INCLUDE_NET mac80211.h wext.h lib80211.h regulatory.h"
47 NET_DIRS="wireless mac80211 rfkill"
48 # User exported this variable
49 if [ -z $GIT_TREE ]; then
50 GIT_TREE="/home/$USER/linux-next/"
51 if [ ! -d $GIT_TREE ]; then
52 echo "Please tell me where your linux-next git tree is."
53 echo "You can do this by exporting its location as follows:"
55 echo " export GIT_TREE=/home/$USER/linux-next/"
57 echo "If you do not have one you can clone the repository:"
58 echo " git-clone $GIT_URL"
62 echo "You said to use git tree at: $GIT_TREE for linux-next"
65 if [ -z $GIT_COMPAT_TREE ]; then
66 GIT_COMPAT_TREE="/home/$USER/compat/"
67 if [ ! -d $GIT_COMPAT_TREE ]; then
68 echo "Please tell me where your compat git tree is."
69 echo "You can do this by exporting its location as follows:"
71 echo " export GIT_COMPAT_TREE=/home/$USER/compat/"
73 echo "If you do not have one you can clone the repository:"
74 echo " git-clone $GIT_COMPAT_URL"
78 echo "You said to use git tree at: $GIT_COMPAT_TREE for compat"
81 # Drivers that have their own directory
82 DRIVERS="drivers/net/wireless/ath"
83 DRIVERS="$DRIVERS drivers/net/wireless/ath/ar9170"
84 DRIVERS="$DRIVERS drivers/net/wireless/ath/ath5k"
85 DRIVERS="$DRIVERS drivers/net/wireless/ath/ath9k"
86 DRIVERS="$DRIVERS drivers/ssb"
87 DRIVERS="$DRIVERS drivers/net/wireless/b43"
88 DRIVERS="$DRIVERS drivers/net/wireless/b43legacy"
89 DRIVERS="$DRIVERS drivers/net/wireless/iwlwifi"
90 DRIVERS="$DRIVERS drivers/net/wireless/rt2x00"
91 DRIVERS="$DRIVERS drivers/net/wireless/zd1211rw"
92 DRIVERS="$DRIVERS drivers/net/wireless/libertas"
93 DRIVERS="$DRIVERS drivers/net/wireless/p54"
94 DRIVERS="$DRIVERS drivers/net/wireless/rtl818x"
95 DRIVERS="$DRIVERS drivers/net/wireless/libertas_tf"
96 DRIVERS="$DRIVERS drivers/net/wireless/ipw2x00"
97 DRIVERS="$DRIVERS drivers/net/wireless/wl12xx"
98 DRIVERS="$DRIVERS drivers/net/wireless/iwmc3200wifi"
101 DRIVERS="$DRIVERS drivers/net/atl1c"
102 DRIVERS="$DRIVERS drivers/net/atl1e"
103 DRIVERS="$DRIVERS drivers/net/atlx"
106 DRIVERS_BT="drivers/bluetooth"
108 # Drivers that belong the the wireless directory
109 DRIVER_FILES="adm8211.c adm8211.h"
110 DRIVER_FILES="$DRIVER_FILES rndis_wlan.c"
111 DRIVER_FILES="$DRIVER_FILES mac80211_hwsim.c"
112 DRIVER_FILES="$DRIVER_FILES at76c50x-usb.c at76c50x-usb.h"
113 DRIVER_FILES="$DRIVER_FILES mwl8k.c"
115 mkdir -p include/linux/ include/net/ include/linux/usb \
116 include/linux/unaligned \
118 net/mac80211/ net/wireless/ \
122 drivers/net/wireless/
123 mkdir -p include/net/bluetooth/
127 for i in $INCLUDE_LINUX; do
128 echo "Copying $GIT_TREE/$DIR/$i"
129 cp "$GIT_TREE/$DIR/$i" $DIR/
132 cp -a $GIT_TREE/include/linux/ssb include/linux/
133 cp -a $GIT_TREE/include/linux/rfkill.h include/linux/rfkill_backport.h
137 for i in $INCLUDE_NET; do
138 echo "Copying $GIT_TREE/$DIR/$i"
139 cp "$GIT_TREE/$DIR/$i" $DIR/
142 DIR="include/net/bluetooth"
143 for i in $INCLUDE_NET_BT; do
144 echo "Copying $GIT_TREE/$DIR/$i"
145 cp $GIT_TREE/$DIR/$i $DIR/
148 DIR="include/linux/usb"
149 for i in $INCLUDE_LINUX_USB; do
150 echo "Copying $GIT_TREE/$DIR/$i"
151 cp $GIT_TREE/$DIR/$i $DIR/
154 DIR="include/linux/spi"
155 for i in $INCLUDE_LINUX_SPI; do
156 echo "Copying $GIT_TREE/$DIR/$i"
157 cp $GIT_TREE/$DIR/$i $DIR/
160 # net/wireless and net/mac80211
161 for i in $NET_DIRS; do
162 echo "Copying $GIT_TREE/net/$i/*.[ch]"
163 cp $GIT_TREE/net/$i/*.[ch] net/$i/
164 cp $GIT_TREE/net/$i/Makefile net/$i/
169 for i in $NET_BT_DIRS; do
171 echo "Copying $GIT_TREE/net/$i/*.[ch]"
172 cp $GIT_TREE/net/$i/*.[ch] net/$i/
173 cp $GIT_TREE/net/$i/Makefile net/$i/
177 # Drivers in their own directory
178 for i in $DRIVERS; do
180 echo "Copying $GIT_TREE/$i/*.[ch]"
181 cp $GIT_TREE/$i/*.[ch] $i/
182 cp $GIT_TREE/$i/Makefile $i/
186 for i in $DRIVERS_BT; do
188 echo "Copying $GIT_TREE/$i/*.[ch]"
189 cp $GIT_TREE/$i/*.[ch] $i/
190 cp $GIT_TREE/$i/Makefile $i/
194 # For rndis_wlan, we need a new rndis_host.ko, cdc_ether.ko and usbnet.ko
195 RNDIS_REQS="Makefile rndis_host.c cdc_ether.c usbnet.c"
196 DIR="drivers/net/usb"
197 for i in $RNDIS_REQS; do
198 echo "Copying $GIT_TREE/$DIR/$i"
199 cp $GIT_TREE/$DIR/$i $DIR/
204 cp $GIT_TREE/$DIR/b44.[ch] $DIR
206 echo "obj-\$(CONFIG_B44) += b44.o" >> $DIR/Makefile
207 echo "obj-\$(CONFIG_ATL1) += atlx/" >> $DIR/Makefile
208 echo "obj-\$(CONFIG_ATL2) += atlx/" >> $DIR/Makefile
209 echo "obj-\$(CONFIG_ATL1E) += atl1e/" >> $DIR/Makefile
210 echo "obj-\$(CONFIG_ATL1C) += atl1c/" >> $DIR/Makefile
213 mkdir -p drivers/misc/eeprom/
214 cp $GIT_TREE/drivers/misc/eeprom/eeprom_93cx6.c drivers/misc/eeprom/
215 cp $GIT_TREE/drivers/misc/eeprom/Makefile drivers/misc/eeprom/
217 DIR="drivers/net/wireless"
218 # Drivers part of the wireless directory
219 for i in $DRIVER_FILES; do
220 cp $GIT_TREE/$DIR/$i $DIR/
223 # Top level wireless driver Makefile
224 cp $GIT_TREE/$DIR/Makefile $DIR
229 echo "Copying $GIT_COMPAT_TREE/ files..."
230 cp $GIT_COMPAT_TREE/compat/*.c $COMPAT/
231 cp $GIT_COMPAT_TREE/compat/Makefile $COMPAT/
232 cp -a $GIT_COMPAT_TREE/udev/ .
233 cp -a $GIT_COMPAT_TREE/scripts/ $COMPAT/
234 cp -a $GIT_COMPAT_TREE/include/linux/* include/linux/
235 rm -f $COMPAT/*.mod.c
237 # Refresh patches using quilt
239 if [ -d patches.orig ] ; then
240 rm -rf .pc patches/series
245 export QUILT_PATCHES=$1
247 mv -u $1/* patches.orig/
249 for i in patches.orig/*.patch; do
250 if [ ! -f "$i" ]; then
251 echo -e "${RED}No patches found in $1${NORMAL}"
254 echo -e "${GREEN}Refresh backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
258 if [[ $RET -ne 0 ]]; then
259 echo -e "${RED}Refreshing $i failed${NORMAL}, update it"
260 echo -e "use ${CYAN}quilt edit [filename]${NORMAL} to apply the failed part manually"
261 echo -e "use ${CYAN}quilt refresh${NORMAL} after the files are corrected and rerun this script"
262 cp patches.orig/README $1/README
265 QUILT_DIFF_OPTS="-p" quilt refresh -p ab --no-index --no-timestamp
269 cp patches.orig/README $1/README
270 rm -rf patches.orig .pc $1/series
273 if [[ "$1" = "refresh" ]]; then
275 patchRefresh linux-next-cherry-picks
278 for dir in patches linux-next-cherry-picks; do
279 FOUND=$(find $dir/ -name \*.patch | wc -l)
280 if [ $FOUND -eq 0 ]; then
283 for i in $dir/*.patch; do
284 echo -e "${GREEN}Applying backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
287 if [[ $RET -ne 0 ]]; then
288 echo -e "${RED}Patching $i failed${NORMAL}, update it"
296 GIT_DESCRIBE=$(git describe)
297 echo -e "${GREEN}Updated${NORMAL} from local tree: ${BLUE}${GIT_TREE}${NORMAL}"
298 echo -e "Origin remote URL: ${CYAN}$(git config remote.origin.url)${NORMAL}"
300 if [ -d ./.git ]; then
301 git describe > compat-release
304 TREE_NAME=$(git config remote.origin.url)
305 TREE_NAME=${TREE_NAME##*/}
307 echo $TREE_NAME > $DIR/git-describe
308 echo $GIT_DESCRIBE >> $DIR/git-describe
310 echo -e "git-describe for $TREE_NAME says: ${PURPLE}$GIT_DESCRIBE${NORMAL}"
312 rm -f $DIR/master-tag
314 "wireless-testing.git") # John's wireless-testing
315 MASTER_TAG=$(git tag -l| grep master | tail -1)
316 echo $MASTER_TAG > $DIR/master-tag
317 echo -e "This is a ${RED}bleeding edge${NORMAL} compat-wireless release based on: ${PURPLE}$MASTER_TAG${NORMAL}"
319 "linux-next.git") # The linux-next integration testing tree
320 MASTER_TAG=$(git tag -l| grep next | tail -1)
321 echo $MASTER_TAG > $DIR/master-tag
322 echo -e "This is a ${RED}bleeding edge${NORMAL} compat-wireless release based on: ${PURPLE}$MASTER_TAG${NORMAL}"
324 "linux-2.6-allstable.git") # HPA's all stable tree
325 echo -e "This is a ${GREEN}stable${NORMAL} compat-wireless release based on: ${PURPLE}$(git describe --abbrev=0)${NORMAL}"
327 "linux-2.6.git") # Linus' 2.6 tree
336 ./scripts/driver-select restore
338 echo -e "This is compat-release: ${YELLOW}$(cat compat-release)${NORMAL}"