]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wl12xx/compat-wireless.git/blob - scripts/admin-update.sh
b1028a6046dbf95ae0a21139b2536115d861b060
[wl12xx/compat-wireless.git] / scripts / admin-update.sh
1 #!/bin/bash
2
3 # Copyright 2007, 2008  Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
4 #
5 # Use this to update compat-wireless-2.6 to the latest
6 # wireless-testing.git tree you have.
7 #
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:
13 #
14 # export GIT_TREE=/home/mcgrof/wireless-testing/
15
16 # for example
17 #
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"
28 # For rndis_wext
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"
37 # Pretty colors
38 GREEN="\033[01;32m"
39 YELLOW="\033[01;33m"
40 NORMAL="\033[00m"
41 BLUE="\033[34m"
42 RED="\033[31m"
43 PURPLE="\033[35m"
44 CYAN="\033[36m"
45 UNDERLINE="\033[02m"
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:"
54                 echo
55                 echo "  export GIT_TREE=/home/$USER/linux-next/"
56                 echo
57                 echo "If you do not have one you can clone the repository:"
58                 echo "  git-clone $GIT_URL"
59                 exit 1
60         fi
61 else
62         echo "You said to use git tree at: $GIT_TREE for linux-next"
63 fi
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:"
70                 echo
71                 echo "  export GIT_COMPAT_TREE=/home/$USER/compat/"
72                 echo
73                 echo "If you do not have one you can clone the repository:"
74                 echo "  git-clone $GIT_COMPAT_URL"
75                 exit 1
76         fi
77 else
78         echo "You said to use git tree at: $GIT_COMPAT_TREE for compat"
79 fi
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"
100 # Ethernet drivers
101 DRIVERS="$DRIVERS drivers/net/atl1c"
102 DRIVERS="$DRIVERS drivers/net/atl1e"
103 DRIVERS="$DRIVERS drivers/net/atlx"
105 # Bluetooth drivers
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 \
117         include/linux/spi \
118         net/mac80211/ net/wireless/ \
119         net/rfkill/ \
120         drivers/ssb/ \
121         drivers/net/usb/ \
122         drivers/net/wireless/
123 mkdir -p include/net/bluetooth/
125 # include/linux
126 DIR="include/linux"
127 for i in $INCLUDE_LINUX; do
128         echo "Copying $GIT_TREE/$DIR/$i"
129         cp "$GIT_TREE/$DIR/$i" $DIR/
130 done
132 cp -a $GIT_TREE/include/linux/ssb include/linux/
133 cp -a $GIT_TREE/include/linux/rfkill.h include/linux/rfkill_backport.h
135 # include/net
136 DIR="include/net"
137 for i in $INCLUDE_NET; do
138         echo "Copying $GIT_TREE/$DIR/$i"
139         cp "$GIT_TREE/$DIR/$i" $DIR/
140 done
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/
146 done
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/
152 done
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/
158 done
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/
165         rm -f net/$i/*.mod.c
166 done
168 # net/bluetooth
169 for i in $NET_BT_DIRS; do
170         mkdir -p net/$i
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/
174         rm -f net/$i/*.mod.c
175 done
177 # Drivers in their own directory
178 for i in $DRIVERS; do
179         mkdir -p $i
180         echo "Copying $GIT_TREE/$i/*.[ch]"
181         cp $GIT_TREE/$i/*.[ch] $i/
182         cp $GIT_TREE/$i/Makefile $i/
183         rm -f $i/*.mod.c
184 done
186 for i in $DRIVERS_BT; do
187         mkdir -p $i
188         echo "Copying $GIT_TREE/$i/*.[ch]"
189         cp $GIT_TREE/$i/*.[ch] $i/
190         cp $GIT_TREE/$i/Makefile $i/
191         rm -f $i/*.mod.c
192 done
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/
200 done
202 DIR="drivers/net"
203 echo > $DIR/Makefile
204 cp $GIT_TREE/$DIR/b44.[ch] $DIR
205 # Not yet
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
212 # Misc
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/
221 done
223 # Top level wireless driver Makefile
224 cp $GIT_TREE/$DIR/Makefile $DIR
226 # Compat stuff
227 COMPAT="compat"
228 mkdir -p $COMPAT
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
238 patchRefresh() {
239         if [ -d patches.orig ] ; then
240                 rm -rf .pc patches/series
241         else
242                 mkdir patches.orig
243         fi
245         mv -u patches/* patches.orig/
247         for i in patches.orig/*.patch; do
248                 echo -e "${GREEN}Refresh backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
249                 quilt import $i
250                 quilt push -f
251                 RET=$?
252                 if [[ $RET -ne 0 ]]; then
253                         echo -e "${RED}Refreshing $i failed${NORMAL}, update it"
254                         echo -e "use ${CYAN}quilt edit [filename]${NORMAL} to apply the failed part manually"
255                         echo -e "use ${CYAN}quilt refresh${NORMAL} after the files are corrected and rerun this script"
256                         cp patches.orig/README patches/README
257                         exit $RET
258                 fi
259                 QUILT_DIFF_OPTS="-p" quilt refresh -p ab --no-index --no-timestamp
260         done
261         quilt pop -a
263         cp patches.orig/README patches/README
264         rm -rf patches.orig .pc patches/series
267 if [[ "$1" = "refresh" ]]; then
268         patchRefresh
269 fi
271 for i in patches/*.patch; do
272         echo -e "${GREEN}Applying backport patch${NORMAL}: ${BLUE}$i${NORMAL}"
273         patch -p1 -N -t < $i
274         RET=$?
275         if [[ $RET -ne 0 ]]; then
276                 echo -e "${RED}Patching $i failed${NORMAL}, update it"
277                 exit $RET
278         fi
279 done
281 DIR="$PWD"
282 cd $GIT_TREE
283 GIT_DESCRIBE=$(git describe)
284 echo -e "${GREEN}Updated${NORMAL} from local tree: ${BLUE}${GIT_TREE}${NORMAL}"
285 echo -e "Origin remote URL: ${CYAN}$(git config remote.origin.url)${NORMAL}"
286 cd $DIR
287 if [ -d ./.git ]; then
288         git describe > compat-release
290         cd $GIT_TREE
291         TREE_NAME=$(git config remote.origin.url)
292         TREE_NAME=${TREE_NAME##*/}
294         echo $TREE_NAME > $DIR/git-describe
295         echo $GIT_DESCRIBE >> $DIR/git-describe
297         echo -e "git-describe for $TREE_NAME says: ${PURPLE}$GIT_DESCRIBE${NORMAL}"
299         rm -f $DIR/master-tag
300         case $TREE_NAME in
301         "wireless-testing.git") # John's wireless-testing
302                 MASTER_TAG=$(git tag -l| grep master | tail -1)
303                 echo $MASTER_TAG > $DIR/master-tag
304                 echo -e "This is a ${RED}bleeding edge${NORMAL} compat-wireless release based on: ${PURPLE}$MASTER_TAG${NORMAL}"
305                 ;;
306         "linux-next.git") # The linux-next integration testing tree
307                 MASTER_TAG=$(git tag -l| grep next | tail -1)
308                 echo $MASTER_TAG > $DIR/master-tag
309                 echo -e "This is a ${RED}bleeding edge${NORMAL} compat-wireless release based on: ${PURPLE}$MASTER_TAG${NORMAL}"
310                 ;;
311         "linux-2.6-allstable.git") # HPA's all stable tree
312                 echo -e "This is a ${GREEN}stable${NORMAL} compat-wireless release based on: ${PURPLE}$(git describe --abbrev=0)${NORMAL}"
313                 ;;
314         "linux-2.6.git") # Linus' 2.6 tree
315                 ;;
316         *)
317                 ;;
318         esac
320         cd $DIR
321 fi
323 ./scripts/driver-select restore
325 echo -e "This is compat-release: ${YELLOW}$(cat compat-release)${NORMAL}"