~ubuntu-branches/ubuntu/hardy/linux-backports-modules-2.6.24/hardy-security

« back to all changes in this revision

Viewing changes to updates/wireless/iwlwifi/mac80211/scripts/generate_compatible

  • Committer: Bazaar Package Importer
  • Author(s): , Ben Collins
  • Date: 2008-04-02 06:59:04 UTC
  • Revision ID: james.westby@ubuntu.com-20080402065904-e5knh2gn2hms3xbb
Tags: 2.6.24-14.11
[Ben Collins]

* iwlwifi: Update to iwlwifi-1.2.25 and mac80211-10.0.4
  - LP: #200950
* ubuntu: Slight cleanups to module hiearchy and Makefiles
* mac80211: Enable LED triggers
* iwlwifi: Add LED trigger support (rx and tx only)
  - LP: #176090

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env /bin/bash
 
2
# Copyright (C) 2007 Intel Corporation
 
3
script=generate_compatible
 
4
prog=$0
 
5
[ "${prog/*$script/$script}" = "$script" ] || {
 
6
    echo "This script must not be sourced."
 
7
    return 1
 
8
} || return 1
 
9
 
 
10
DEBUG=1
 
11
 
 
12
function die() {
 
13
    ret=$1
 
14
    shift
 
15
    echo -e $@ >&2
 
16
        (( DEBUG )) && 
 
17
                echo "If patch or script failed, check pre/ and post/ for current stage." ||
 
18
                echo "Try setting DEBUG=1 to maintain pre/ and post/ staging."
 
19
    exit $ret
 
20
}
 
21
 
 
22
[ -z "$KSRC" ] && 
 
23
KSRC="/lib/modules/$(uname -r)/build"
 
24
 
 
25
[ ! -e "${KSRC}/Makefile" ] && 
 
26
die 1 "Kernel Makefile not found at '$KSRC'"
 
27
 
 
28
. scripts/determine_compat 
 
29
determine_compat || 
 
30
die $? "\nCould not provide compatible version. Try 2.6.18 or newer.\n\nTerminating."
 
31
 
 
32
SRC=$1
 
33
DST=compatible
 
34
 
 
35
[ -d "$SRC" ] ||
 
36
die 5 "\n$SRC/ tree does not exist.  Run 'make $SRC' to build the\n$SRC directory."
 
37
 
 
38
SRC=${SRC/%\/}/
 
39
DST=${DST/%\/}/
 
40
 
 
41
[ ! -e $DST ] || {
 
42
    die 1 "$DST already exists.  You must remove it before continuing."
 
43
}
 
44
 
 
45
echo "Building compatibility version in '$DST' directory:"
 
46
 
 
47
mkdir "$DST"
 
48
echo -n "Copying $DST from $SRC..."
 
49
cp -r ${SRC}* $DST || die $? "Copy failed."
 
50
echo "done"
 
51
 
 
52
(( DEBUG )) && rsync --delete -aprl $DST post/ > /dev/null
 
53
 
 
54
(( DEBUG )) && {
 
55
        OUT=post/
 
56
} || {
 
57
        OUT=$DST
 
58
}
 
59
 
 
60
 
 
61
function do_patch {
 
62
    (( DEBUG )) && 
 
63
        rsync --delete -aprl post/ pre/ > /dev/null
 
64
    
 
65
    [ -e patches/"$1" ] ||
 
66
    die 3 "patches/$1 does not exist.  Terminating."
 
67
    echo -ne " + Applying: patches/$1\n\t"
 
68
    cat "patches/$1" | while read command rest; do
 
69
        case $command in
 
70
            "Commit:" | "Author:" | "")
 
71
                ;;
 
72
            *) echo "$command $rest"
 
73
                break
 
74
                ;;
 
75
        esac
 
76
    done
 
77
 
 
78
    patch -p1 -d $OUT < patches/"$1" > .patch.output || {
 
79
        echo "-----patch failure output-----"
 
80
        cat .patch.output
 
81
        echo ""
 
82
        die 1 "patches/$1 failed.  Terminating."
 
83
    }
 
84
    [ -e .patch.output ] && rm .patch.output
 
85
    return 0
 
86
}
 
87
 
 
88
function do_script {
 
89
    [ -x "patches/$1" ] ||
 
90
    die 3 "patches/$1 does not exist.  Terminating."
 
91
    echo -ne " + Running: $1\n\t"
 
92
    head -n 2 "patches/$1" | tail -n 1 | sed -e 's,^#[[:space:]]*,,g' ||
 
93
    die $? "Terminating."
 
94
 
 
95
    (( DEBUG )) && 
 
96
        rsync --delete -aprl post/ pre/ > /dev/null
 
97
 
 
98
    patches/$1 $OUT || return 1
 
99
    return 0
 
100
}
 
101
 
 
102
 
 
103
(( !$has_new_qdisc )) && {
 
104
    do_patch qdisc-api.patch ||
 
105
    die $? "Failure creating new qdisc compatibility."
 
106
}
 
107
 
 
108
(( !$has_i_private )) && {
 
109
        do_script i_private.sh ||
 
110
        die $? "Failure creating i_private rename compatibility."
 
111
}
 
112
 
 
113
(( !$has_block_cipher )) && {
 
114
    do_patch block-cipher.patch ||
 
115
    die $? "Failure creating block cipher compatibility."
 
116
}
 
117
 
 
118
(( !$has_debugfs_symlink )) && {
 
119
    do_patch debugfs_create_symlink.patch ||
 
120
    die $? "Failure creating debugfs symlink compatibility."
 
121
}
 
122
 
 
123
(( !$has_ieee80211_ptr )) && {
 
124
    do_patch ieee80211_ptr.patch ||
 
125
    die $? "Failure creating ieee80211_ptr compatibility."
 
126
    do_script ieee80211_ptr.sh ||
 
127
    die $? "Failure creating ieee80211_ptr compatibility."
 
128
}
 
129
 
 
130
(( !$has_delayed_work )) && {
 
131
    do_patch delayed_work.patch &&
 
132
    do_script delayed_work.sh &&
 
133
    (( DEBUG )) && {
 
134
        cp patches/kcompat-delayed_work.h post/net/mac80211/ ||
 
135
        die $? "Failure creating delayed work compatibility."
 
136
    } || {
 
137
        cp patches/kcompat-delayed_work.h $DST/net/mac80211/ ||
 
138
        die $? "Failure creating delayed work compatibility."
 
139
    }
 
140
}
 
141
 
 
142
(( !$has_rtnl_notify )) && {
 
143
    do_patch rtnl_notify.patch ||
 
144
    die $? "Failure creating rtnl_notify compatiblity."
 
145
}
 
146
 
 
147
(( ! $has_class_dev_removed )) && {
 
148
        (( ! $has_ieee80211_ptr )) && {
 
149
            do_patch class_dev_to_dev-wireless-ieee80211_ptr.patch ||
 
150
            die $? "Failure creating class_dev compatiblity."
 
151
        } || {
 
152
            do_patch class_dev_to_dev-wireless.patch ||
 
153
            die $? "Failure creating class_dev compatiblity."
 
154
        }
 
155
}
 
156
 
 
157
(( ! $has_dev_release )) && {
 
158
    do_patch dev_release.patch ||
 
159
    die $? "Failure creating dev_release compatiblity."
 
160
}
 
161
 
 
162
# The nl code isn't in Linus' tree as of commit-id:
 
163
# c1a13ff57ab1ce52a0aae9984594dbfcfbaf68c0
 
164
#
 
165
#(( !$has_new_genlmsg )) && {
 
166
#    do_patch nl80211-remove-kconfig.patch ||
 
167
#    die $? "Failure removing nl80211 from config"
 
168
#}
 
169
 
 
170
# The cfg80211 files aren't in Linus' tree as of commit-id:
 
171
# c1a13ff57ab1ce52a0aae9984594dbfcfbaf68c0
 
172
#
 
173
#(( !$has_device_rename )) && {
 
174
#       (( $has_new_genlmsg )) && {
 
175
#           do_patch nl80211-remove-kconfig.patch ||
 
176
#           die $? "Failure removing nl80211 from config (req. since no device_rename)"
 
177
#       }
 
178
#       do_patch device_rename.patch ||
 
179
#       die $? "Failure removing device_rename usage"
 
180
#}
 
181
 
 
182
(( !$has_net_sch_fifo )) && {
 
183
        do_patch net_sch_fifo.patch ||
 
184
        die $? "Failure adding net_sch_fifo compatibility."
 
185
}
 
186
 
 
187
(( !$has_skb_mac_header )) && {
 
188
    do_patch skb_mac_header.patch
 
189
    (( DEBUG )) && {
 
190
        cp patches/kcompat-skb_mac_header.h post/net/mac80211/ ||
 
191
        die $? "Failure creating delayed work compatibility."
 
192
    } || {
 
193
        cp patches/kcompat-skb_mac_header.h $DST/net/mac80211/ ||
 
194
        die $? "Failure creating delayed work compatibility."
 
195
    }
 
196
}
 
197
 
 
198
(( !$has_ilog2 )) && {
 
199
        do_script ilog2.sh ||
 
200
        die $? "Failure running ilog2 compat script"
 
201
}
 
202
 
 
203
(( !$has_div_round_up )) && {
 
204
        do_patch div_round_up.patch ||
 
205
        die $? "Failure adding DIV_ROUND_UP compat"
 
206
}
 
207
 
 
208
(( !$has_seq_open_const )) && {
 
209
        do_patch seq_open_const.patch ||
 
210
        die $? "Failure adding seq_open() const compat"
 
211
}
 
212
 
 
213
(( !$has_nlmsg_trim )) && {
 
214
        do_patch nlmsg_trim.patch ||
 
215
        die $? "Failure nlmsg_trim removal compat"
 
216
}
 
217
 
 
218
(( !$has_tcf_destroy_chain )) && {
 
219
        do_patch tcf_destroy_chain.patch ||
 
220
        die $? "Failure tcf_destroy_chain compat"
 
221
}
 
222
 
 
223
#(( !$has_new_nla_policy )) && {
 
224
#       do_patch nla_policy.patch ||
 
225
#       die $? "Failure old nla_policy compat"
 
226
#}
 
227
#
 
228
#(( !$has_new_nla_put_flag )) && {
 
229
#       do_patch nla_put_flag.patch ||
 
230
#       die $? "Failure old NLA_PUT_FLAG compat"
 
231
#}
 
232
#
 
233
#(( !$has_new_nlmsg_new )) && {
 
234
#       do_patch nlmsg_new.patch ||
 
235
#       die $? "Failure old nlmsg_new() compat"
 
236
#}
 
237
 
 
238
(( !$has_debugfs_rename )) && {
 
239
        do_patch debugfs_rename.patch ||
 
240
        die $? "Failure debugfs_rename() compat"
 
241
}
 
242
 
 
243
(( DEBUG )) || exit 0
 
244
 
 
245
rsync --delete -avprl post/ $DST > /dev/null && 
 
246
rm -rf pre/ post/