wok-next view firmware/receipt @ rev 19879

qemacs: does not need gcc3
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Oct 04 18:36:44 2017 +0200 (2017-10-04)
parents 0e8dadf052b9
children 250165915708
line source
1 # SliTaz package receipt v2.
3 PACKAGE="firmware"
4 VERSION="20170906"
5 COMMIT="a61ac5cf8374edbfe692d12f805a1b194f7fead2"
6 CATEGORY="meta"
7 SHORT_DESC="Linux firmware"
8 MAINTAINER="devel@slitaz.org"
9 LICENSE="other"
10 WEB_SITE="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
12 TARBALL="linux-firmware-$COMMIT.tar.gz"
13 WGET_URL="$WEB_SITE/snapshot/$TARBALL"
15 #BUILD_DEPENDS="b43-fwcutter"
17 # Package name matched to kernel module.
18 # For example, firmware-b43 contains firmware for b43 kernel module.
19 f='firmware'
20 SPLIT="$f-acenic $f-af9013 $f-aic94xx $f-amdgpu $f-ar5523 $f-at76c50x-usb \
21 $f-ath10k_pci $f-ath3k $f-ath6kl_sdio $f-ath6kl_usb $f-ath9k_htc $f-atmel \
22 $f-b43 $f-b43legacy $f-bcm203x $f-bfusb $f-bna $f-bnx2 $f-bnx2x $f-brcmfmac \
23 $f-brcmsmac $f-bt3c_cs $f-btintel $f-btmrvl_sdio $f-carl9170 $f-cassini \
24 $f-cpia2 $f-cx18 $f-cx231xx $f-cx23885 $f-cx24117 $f-cx25840 $f-cxgb3 $f-cxgb4 \
25 $f-daqboard2000 $f-drx39xyj $f-ds3000 $f-dvb-ttpci $f-dvb-ttusb-budget \
26 $f-dvb-usb-af9015 $f-dvb-usb-af9035 $f-dvb-usb-az6007 $f-dvb-usb-dib0700 \
27 $f-dvb-usb-dw2102 $f-dvb-usb-ec168 $f-dvb-usb-lmedm04 $f-e100 $f-emi26 \
28 $f-emi62 $f-go7007 $f-go7007-loader $f-gspca_vicam $f-i1480-dfu-usb \
29 $f-i2400m-usb $f-i915 $f-io_edgeport $f-io_ti $f-ipw2100 $f-ipw2200 $f-isci \
30 $f-isight_$f $f-ivtv $f-iwl3945 $f-iwl4965 $f-iwlwifi $f-jr3_pci $f-kaweth \
31 $f-keyspan $f-keyspan_pda $f-lgs8gxx $f-libertas_cs $f-libertas_sdio \
32 $f-libertas_tf_usb $f-m88ds3103 $f-me4000 $f-me_daq $f-mga $f-mn88472 \
33 $f-mn88473 $f-mt7601u $f-mwifiex_sdio $f-mwifiex_usb $f-mwl8k $f-myri10ge \
34 $f-netxen_nic $f-ni_pcidio $f-nouveau $f-orinoco $f-orinoco_usb $f-p54pci \
35 $f-p54usb $f-pcnet_cs $f-prism2_usb $f-pvrusb2 $f-qat_dh895xcc $f-qed \
36 $f-qlcnic $f-r128 $f-r8169 $f-r8192e_pci $f-r8192u_usb $f-r8712u $f-radeon \
37 $f-rsi_sdio $f-rsi_usb $f-rt2800pci $f-rt2800usb $f-rt61pci $f-rt73usb \
38 $f-rtl8188ee $f-rtl8192ce $f-rtl8192cu $f-rtl8192de $f-rtl8192ee $f-rtl8192se \
39 $f-rtl8723ae $f-rtl8723be $f-rtl8821ae $f-rtl8xxxu $f-s2255drv \
40 $f-saa7134-go7007 $f-serial_cs $f-si2157 $f-si2165 $f-si2168 $f-slicoss \
41 $f-smc91c92_cs $f-smsmdtv $f-snd-asihpi $f-snd-cs46xx $f-snd-darla20 \
42 $f-snd-darla24 $f-snd-echo3g $f-snd-emu10k1 $f-snd-gina20 $f-snd-gina24 \
43 $f-snd-hda-codec-ca0132 $f-snd-hdsp $f-snd-indigo $f-snd-indigodj \
44 $f-snd-indigodjx $f-snd-indigoio $f-snd-indigoiox $f-snd-korg1212 \
45 $f-snd-layla20 $f-snd-layla24 $f-snd-maestro3 $f-snd-mia $f-snd-mixart \
46 $f-snd-mona $f-snd-pcxhr $f-snd-riptide $f-snd-usb-6fire $f-snd-vx-lib \
47 $f-snd-ymfpci $f-speedfax $f-starfire $f-tda10071 $f-tehuti $f-tg3 \
48 $f-ti_usb_3410_5052 $f-tuner-xc2028 $f-typhoon $f-ueagle-atm $f-usb8xxx \
49 $f-usbdux $f-usbduxfast $f-usbduxsigma $f-wcn36xx $f-wd719x $f-whiteheat \
50 $f-wil6210 $f-wl1251 $f-wl12xx $f-wl18xx $f-xc4000 $f-xc5000 $f-zd1201 \
51 $f-zd1211rw"
53 # Rules to configure and make the package.
54 compile_rules()
55 {
56 # mainline linux kernel firmware
57 make install
58 mkdir -p $install/usr/share/licenses
59 cp $src/LICENSE.* $src/LICENCE.* $install/usr/share/licenses
60 mv $install/lib/firmware/GPL* $install/usr/share/licenses
61 rm $install/lib/firmware/Makefile
63 # separate firmware from Debian repository
64 while read deb; do
65 pkg="$(basename $deb)"
66 title "Additional firmware from ${pkg%_all.deb}"
67 url="http://ftp.ch.debian.org/debian/pool/$deb"
68 [ -f "$SRC/$pkg" ] || wget -O $SRC/$pkg $url
69 dpkg-deb -X $SRC/$pkg $install | sed 's|^.| |'
70 done <<EOT
71 non-free/a/atmel-firmware/atmel-firmware_1.3-4_all.deb
72 non-free/b/bluez-firmware/bluez-firmware_1.2-3_all.deb
73 non-free/z/zd1211-firmware/firmware-zd1211_1.5-4_all.deb
74 main/h/hdmi2usb-fx2-firmware/hdmi2usb-fx2-firmware_0.0.0~git20151225-1_all.deb
75 EOT
77 # random firmware
78 while read dir url; do
79 [ -z "$dir" -o "$dir" == '#' ] && continue
80 title "Additional firmware from $dir"
81 tarball=$dir-$(basename $url)
82 [ -f $SRC/$tarball ] || wget -O $SRC/$tarball $url
83 mkdir -p $src/$dir
84 case $tarball in
85 *.tar.*) tar -C $src/$dir -xf $SRC/$tarball;;
86 *) cp $SRC/$tarball $src/$dir;;
87 esac
88 cd $src/$dir
89 [ $(ls . | wc -l) -eq 1 -a -d ./$(ls .) ] && cd ./$(ls .)
91 fdir="$install/lib/firmware"
92 case $dir in
93 dvb-firmware)
94 ./install;;
95 adaptec-firmware)
96 rpm2cpio *.rpm | cpio -idm; cp -r lib/ $install;;
97 ath10k-firmware)
98 cp -r ath10k $fdir;;
99 # broadcom-firmware)
100 # b43-fwcutter -w $fdir linux/wl_apsta.o
101 # cp linux/wl_apsta.o $fdir
102 # ;;
103 # broadcom-legacy-firmware)
104 # b43-fwcutter -w $fdir wl_apsta-3.130.20.0.o
105 # cp *.o $fdir/wl_apsta-3.130.20.0.o
106 # ;;
107 bfusb)
108 cp *.frm $fdir;;
109 alsa-firmware)
110 ./configure $CONFIGURE_ARGS && make && make install;;
111 esac
113 done <<EOT
114 # https://github.com/OpenELEC/dvb-firmware
115 dvb-firmware https://github.com/OpenELEC/dvb-firmware/archive/3fef04a.tar.gz
117 # https://adaptec.com/en-us/speed/scsi/linux/aic94xx-seq-30-1_tar_gz.php
118 adaptec-firmware http://download.adaptec.com/scsi/linux/aic94xx-seq-30-1.tar.gz
120 # https://wireless.wiki.kernel.org/en/users/Drivers/ath10k/firmware
121 # https://github.com/sumdog/ath10k-firmware
122 # https://github.com/kvalo/ath10k-firmware
123 ath10k-firmware https://github.com/sumdog/ath10k-firmware/archive/5faf5bb.tar.gz
125 # https://wiki.debian.org/bcm43xx
126 # broadcom-firmware http://mirror2.openwrt.org/sources/broadcom-wl-5.100.138.tar.bz2
127 # broadcom-legacy-firmware http://mirror2.openwrt.org/sources/wl_apsta-3.130.20.0.o
129 # https://wiki.ubuntuusers.de/Archiv/Bluetooth/BlueFritz%21/
130 bfusb ftp://ftp.in-berlin.de/pub/capi4linux/firmware/bluefusb/3-18-39/bfubase.frm
132 # http://alsa-project.org/main/index.php/Main_Page
133 # http://git.alsa-project.org/?p=alsa-firmware.git;a=summary
134 alsa-firmware ftp://ftp.alsa-project.org/pub/firmware/alsa-firmware-1.0.29.tar.bz2
135 EOT
137 # fix permissions
138 find $install -type f -exec chmod 644 '{}' \;
139 find $install -type d -exec chmod 755 '{}' \;
140 }
142 # Rules to gen a SliTaz package suitable for Tazpkg.
143 genpkg_rules() {
144 module=${PACKAGE#*-}
145 case $module in
146 firmware)
147 CAT="meta|all firmware"
148 DEPENDS="$SPLIT"
149 ;;
150 misc)
151 copy @std
152 remove_already_packed
153 CAT="kernel|misc firmware"
154 ;;
155 b43|b43legacy)
156 path=$(find $WOK/linux/install -type f -name $module.ko.xz)
157 desc=$(modinfo -Fdescription $path)
158 CAT="kernel|$desc"
159 DEPENDS="b43-fwcutter"
160 COOKOPTS="empty-pkg"
161 ;;
162 *)
163 path=$(find $WOK/linux/install -type f -name $module.ko.xz)
164 fw=$(modinfo -Ffirmware $path | sort -u)
165 copy $fw
166 # check copied files
167 for i in $fw; do
168 if [ ! -f "$fs/lib/firmware/$i" ]; then
169 echo " Error: $i missing!"
170 mkdir -p $fs/lib/firmware/$(dirname $i)
171 touch $fs/lib/firmware/$i.missing
172 chmod 400 $fs/lib/firmware/$i.missing
173 fi
174 done
176 # TODO: copy licenses
177 DEPENDS=" "
179 desc=$(modinfo -Fdescription $path)
180 CAT="kernel|$desc"
182 # copy the whole folder
183 case $module in
184 acenic|amdgpu|b43|b43legacy|bnx2|bnx2x|cxgb3|cxgb4|e100|emi26|\
185 emi62|vicam|i915|kaweth|keyspan|keyspan_pda|mwl8k|qed|r128|\
186 slicoss)
187 copy $module/;;
188 zd1211rw) copy zd1211/;;
189 mga) copy matrox/;;
190 r8169) copy rtl_nic/;;
191 r8192e_pci) copy RTL8192E/;;
192 r8192u_usb) copy RTL8192U/;;
193 esac
195 # follow version (not realized yet)
196 case $module in
197 at76c50x-usb|atmel)
198 VERSION='1.3-4';;
199 bcm203x)
200 VERSION='1.2-3';;
201 zd1211rw)
202 VERSION='1.5-4';;
203 esac
204 ;;
205 esac
206 }
208 post_install_firmware_b43() {
209 drv=$(mktemp -d)
210 [ -n "$quiet" ] || echo -e '\nDownloading firmware (12.9MiB)...'
211 # download
212 wget -P $drv http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
213 # extract tarball
214 tar -C $drv -xf $drv/*.tar.bz2
215 mkdir -p "$1/tmp" "$1/lib/firmware"
216 # copy driver to chroot
217 cp "$drv/broadcom-wl-5.100.138/linux/wl_apsta.o" "$1/tmp"
218 # extract firmware in the chroot
219 chroot "$1/" b43-fwcutter -w '/lib/firmware' '/tmp/wl_apsta.o'
220 # clean
221 rm -rf "$drv" "$1/tmp/wl_apsta.o"
222 # permissions
223 chmod 755 "$1/lib/firmware/b43"
224 find "$1/lib/firmware/b43" -type f -exec chmod 644 '{}' \;
225 }
226 post_remove_firmware_b43() {
227 rm -rf "$1/lib/firmware/b43"
228 }
230 post_install_firmware_b43legacy() {
231 drv=$(mktemp -d)
232 [ -n "$quiet" ] || echo -e '\nDownloading firmware (0.6MiB)...'
233 # download
234 wget -P $drv http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o
235 mkdir -p "$1/tmp" "$1/lib/firmware"
236 # copy driver to chroot
237 cp "$drv/wl_apsta-3.130.20.0.o" "$1/tmp"
238 # extract firmware in the chroot
239 chroot "$1/" b43-fwcutter -w '/lib/firmware' '/tmp/wl_apsta-3.130.20.0.o'
240 # clean
241 rm -rf "$drv" "$1/tmp/wl_apsta-3.130.20.0.o"
242 # permissions
243 chmod 755 "$1/lib/firmware/b43legacy"
244 find "$1/lib/firmware/b43legacy" -type f -exec chmod 644 '{}' \;
245 }
246 post_remove_firmware_b43legacy() {
247 rm -rf "$1/lib/firmware/b43legacy"
248 }