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