blob: ad545e8996460ee82c9d85dd8f8e42c99bff736e (
plain)
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
|
# Maintainer: André Silva <emulatorman@lavabit.com>
# Maintainer: Márcio Silva <coadde@lavabit.com>
pkgname=ath9k-htc-firmware
pkgver=$(LC_ALL=C date -u +%Y%m%d)
pkgrel=1
pkgdesc='Free firmware files for the Qualcomm Atheros AR7010 and AR9271 USB 802.11n NICs'
arch=('any')
url=('http://wireless.kernel.org/en/users/Drivers/ath9k_htc')
license=('BSD')
makedepends=('git' 'cmake' 'xtensa-unknown-elf-binutils' 'xtensa-unknown-elf-gcc')
source=("git://github.com/qca/open-ath9k-htc-firmware")
md5sums=('SKIP')
prepare() {
cd $srcdir/open-ath9k-htc-firmware/target_firmware
mkdir -p build/{k2,magpie}
}
build() {
cd $srcdir/open-ath9k-htc-firmware
export CBUILD=$CHOST
export CHOST="xtensa-unknown-elf"
export CTARGET="xtensa-unknown-elf"
export CFLAGS="-mtext-section-literals -O2 -pipe --param=ssp-buffer-size=4"
export CXXFLAGS="${CFLAGS}"
export CC=/usr/bin/xtensa-unknown-elf-gcc
export CPP=/usr/bin/xtensa-unknown-elf-cpp
export AR=/usr/bin/xtensa-unknown-elf-ar
export AS=/usr/bin/xtensa-unknown-elf-as
export LD=/usr/bin/xtensa-unknown-elf-ld
export NM=/usr/bin/xtensa-unknown-elf-nm
export OBJCOPY=/usr/bin/xtensa-unknown-elf-objcopy
export OBJDUMP=/usr/bin/xtensa-unknown-elf-objdump
export RANLIB=/usr/bin/xtensa-unknown-elf-ranlib
export STRIP=/usr/bin/xtensa-unknown-elf-strip
cat > target_firmware/build/toolchain.cmake <<EOF
INCLUDE(CMakeForceCompiler)
SET(CMAKE_CROSSCOMPILING)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR xtensa)
SET(CMAKE_HOST_SYSTEM_PROCESSOR xtensa)
SET(COMPILER_PREFIX "xtensa-unknown-elf")
SET(GNU_HOST "xtensa-unknown-elf")
SET(CMAKE_FIND_ROOT_PATH /usr/xtensa-unknown-elf)
SET(CMAKE_C_COMPILER /usr/bin/xtensa-unknown-elf-gcc)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY FIRST)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE FIRST)
CMAKE_FORCE_C_COMPILER(/usr/bin/xtensa-unknown-elf-gcc GNU)
EOF
cd $srcdir/open-ath9k-htc-firmware/target_firmware/build/k2
cmake -DCMAKE_TOOLCHAIN_FILE=$srcdir/open-ath9k-htc-firmware/target_firmware/build/toolchain.cmake "$@" -DTARGET_K2=ON ../..
cd -
cd $srcdir/open-ath9k-htc-firmware/target_firmware/build/magpie
cmake -DCMAKE_TOOLCHAIN_FILE=$srcdir/open-ath9k-htc-firmware/target_firmware/build/toolchain.cmake "$@" -DTARGET_MAGPIE=ON ../..
cd -
cd $srcdir/open-ath9k-htc-firmware/target_firmware
sed -i 's|/usr/bin/gcc|/usr/bin/xtensa-unknown-elf-gcc|g;
s|/usr/bin/cpp|/usr/bin/xtensa-unknown-elf-cpp|g;
s|/usr/bin/ar|/usr/bin/xtensa-unknown-elf-ar|g;
s|/usr/bin/as|/usr/bin/xtensa-unknown-elf-as|g;
s|/usr/bin/ld|/usr/bin/xtensa-unknown-elf-ld|g;
s|/usr/bin/nm|/usr/bin/xtensa-unknown-elf-nm|g;
s|/usr/bin/objcopy|/usr/bin/xtensa-unknown-elf-objcopy|g;
s|/usr/bin/objdump|/usr/bin/xtensa-unknown-elf-objdump|g;
s|/usr/bin/ranlib|/usr/bin/xtensa-unknown-elf-ranlib|g;
s|/usr/bin/strip|/usr/bin/xtensa-unknown-elf-strip|g;
s|/usr/local|/usr|g;
' $(grep -rlI /usr/bin/gcc) \
$(grep -rlI /usr/bin/cpp) \
$(grep -rlI /usr/bin/ld) \
$(grep -rlI /usr/bin/ar) \
$(grep -rlI /usr/bin/as) \
$(grep -rlI /usr/bin/nm) \
$(grep -rlI /usr/bin/objcopy) \
$(grep -rlI /usr/bin/objdump) \
$(grep -rlI /usr/bin/ranlib) \
$(grep -rlI /usr/bin/strip) \
$(grep -rlI /usr/local)
make \
CC="${CC}" CPP="${CPP}" AR="${AR}" AS="${AS}" LD="${LD}" NM="${NM}" \
OBJCOPY="${OBJCOPY}" OBJDUMP="${OBJDUMP}" RANLIB="${RANLIB}" STRIP="${STRIP}" \
-C build/k2
make \
CC="${CC}" CPP="${CPP}" AR="${AR}" AS="${AS}" LD="${LD}" NM="${NM}" \
OBJCOPY="${OBJCOPY}" OBJDUMP="${OBJDUMP}" RANLIB="${RANLIB}" STRIP="${STRIP}" \
-C build/magpie
}
package() {
# create firmware folder to put the free firmware files there
install -d -m755 $pkgdir/usr/lib/firmware
cd $srcdir/open-ath9k-htc-firmware/target_firmware
# move firmware files to firmware folder
cp build/{k2,magpie}/htc_*.fw $pkgdir/usr/lib/firmware
# create license folder to put the license file there
install -d -m755 $pkgdir/usr/share/licenses/$pkgname
# put LICENSE.TXT from ath9k-htc firmware to license folder
install -m644 $srcdir/open-ath9k-htc-firmware/LICENCE.TXT $pkgdir/usr/share/licenses/$pkgname/LICENCE
}
|