~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/iwlwifi/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
function die() {
 
11
    ret=$1
 
12
    shift
 
13
    echo -e $@ >&2
 
14
    exit $ret
 
15
}
 
16
 
 
17
[ -z "$KSRC" ] && 
 
18
die 1 "KSRC must be defined."
 
19
 
 
20
[ ! -e "${KSRC}/Makefile" ] && 
 
21
die 1 "Kernel Makefile not found at '$KSRC'"
 
22
 
 
23
. scripts/determine_compat 
 
24
determine_compat || 
 
25
die $? "\nCould not provide compatible version. Try 2.6.18 or newer.\n\nTerminating."
 
26
 
 
27
SRC=$1
 
28
DST=compatible
 
29
 
 
30
[ -d "$SRC" ] ||
 
31
die 5 "\n$SRC/ tree does not exist.  Run 'make $SRC' to build the\n$SRC directory."
 
32
 
 
33
SRC=${SRC/%\/}/
 
34
DST=${DST/%\/}/
 
35
 
 
36
[ ! -e $DST ] || {
 
37
    die 1 "$DST already exists.  You must remove it before continuing."
 
38
}
 
39
 
 
40
echo "Building compatibility version in '$DST' directory:"
 
41
 
 
42
mkdir $DST
 
43
echo -n "Copying $DST from $SRC..."
 
44
cp -r ${SRC}* $DST || die $? "Copy failed."
 
45
echo "done"
 
46
 
 
47
(( !$requires_compat )) && exit 0
 
48
 
 
49
function do_patch {
 
50
    [ -e "$2" ] ||
 
51
    die 3 "$2 does not exist.  Terminating."
 
52
    echo -ne " + Applying: $2\n\t"
 
53
    cat "$2" | while read command rest; do
 
54
        case $command in
 
55
            "Commit:" | "Author:" | "")
 
56
                ;;
 
57
            *) echo "$command $rest"
 
58
                break
 
59
                ;;
 
60
        esac
 
61
    done
 
62
 
 
63
    patch -p1 -d $1 < "$2" > .patch.output || {
 
64
        echo "-----patch failure output-----"
 
65
        cat .patch.output
 
66
        echo ""
 
67
        die 1 "$2 failed.  Terminating."
 
68
    } 
 
69
    [ -e .patch.output ] && rm .patch.output
 
70
    return 0
 
71
}
 
72
 
 
73
function do_script {
 
74
    [ -x "$2" ] ||
 
75
    die 3 "$2 does not exist.  Terminating."
 
76
    echo -ne " + Running: $2\n\t"
 
77
    head -n 2 "$2" | tail -n 1 | sed -e 's,^#[[:space:]]*,,g' || 
 
78
    die $? "Terminating."
 
79
    $2 $1 || return 1
 
80
    return 0
 
81
}
 
82
 
 
83
(( !$has_mac80211_v2 )) && {
 
84
        do_patch $DST patches/mac80211-v1.patch || die $? "Failed."
 
85
}
 
86
 
 
87
(( !$has_delayed_work )) && {
 
88
        do_script $DST patches/01-queue_delayed_work.sh &&
 
89
        do_script $DST patches/02-cancel_delayed_work.sh &&
 
90
        do_patch $DST patches/02-kcompat_delayed_work.patch ||
 
91
                die $? "Failed."
 
92
}
 
93
 
 
94
(( !$has_new_request_irq )) && {
 
95
        do_patch $DST patches/03-isr.patch || die $? "Failed."
 
96
}
 
97
 
 
98
(( !$has_rx_flag_radiotap )) && {
 
99
        do_patch $DST patches/04-rx_flag_radiotap.patch || die $? "Failed."
 
100
}
 
101
 
 
102
(( !$has_delayed_work_define )) && {
 
103
        do_patch $DST patches/05-delayed_work_define.patch || die $? "Failed."
 
104
}
 
105
 
 
106
(( !$has_wlan_80211 )) && {
 
107
        do_patch $DST patches/wlan_80211.patch || 
 
108
                die $? "Failed."
 
109
}
 
110
 
 
111
(( !$has_csa_conf )) && {
 
112
        do_patch $DST patches/06-csa.patch ||
 
113
                die $? "Failed."
 
114
}
 
115
 
 
116
(( !$has_hex_dump )) && {
 
117
        do_patch $DST patches/07-hex_dump.patch ||
 
118
                die $? "Failed."
 
119
}
 
120
 
 
121
(( !$has_is_power_of_2 )) && {
 
122
        do_patch $DST patches/08-is_power_of_2.patch ||
 
123
                die $? "Failed."
 
124
}
 
125
 
 
126
(( !$has_cancel_work_sync )) && {
 
127
        do_patch $DST patches/09-cancel_work_sync.patch ||
 
128
                die $? "Failed."
 
129
}
 
130
 
 
131
(( $has_preferred_rate_control )) && {
 
132
        do_patch $DST patches/10-preferred_rate_control.patch ||
 
133
                die $? "Failed."
 
134
}
 
135
 
 
136
(( !$has_i_private )) && {
 
137
        do_script $DST patches/i_private.sh ||
 
138
                die $? "Failure creating i_private rename compatibility."
 
139
}
 
140
 
 
141
makefile_modified=0
 
142
(( !$has_mac80211_ht )) && {
 
143
        grep -q 'export CONFIG_IWL4965_HT ?= y' Makefile
 
144
        if [ $? -eq 0 ]; then
 
145
                sed -i -e \
 
146
                's/export CONFIG_IWL4965_HT[^_].*$/export CONFIG_IWL4965_HT ?= n/' \
 
147
                Makefile
 
148
                makefile_modified=1
 
149
        fi
 
150
}
 
151
 
 
152
(( !$has_mac80211_ht_agg )) && {
 
153
        grep -q 'export CONFIG_IWL4965_HT_AGG ?= y' Makefile
 
154
        if [ $? -eq 0 ]; then
 
155
                sed -i -e \
 
156
                's/export CONFIG_IWL4965_HT_AGG.*$/export CONFIG_IWL4965_HT_AGG ?= n/' \
 
157
                Makefile
 
158
                makefile_modified=1
 
159
        fi
 
160
}
 
161
 
 
162
(( $makefile_modified )) && exit 1
 
163
 
 
164
exit 0