have_check=:
fi
+announce () {
+ echo
+ echo "$@"
+}
+
clean_file () {
#$1 = filename
if test ! -f $1; then
fi
}
+clean_sed () {
+ #$1 = sed-script $2 = file
+ sed -e "$1" "$2" > "$2".deblob
+ check_changed "$2"
+}
+reject_firmware () {
+ #$1 = file
+ clean_sed 's,request\(_ihex\|\)_firmware(,reject_firmware(,' "$1"
+}
# First, check that files that contain firmwares and their
# corresponding sources are present.
done
# Identify the tarball.
-sed -i "s,^EXTRAVERSION.*,&-libre$extra," Makefile
+clean_sed "s,^EXTRAVERSION.*,&-libre$extra," Makefile
+
+# Add reject_firmware and check_reject_firmware
+cat >> include/linux/firwmare.h <<\EOF
+#ifndef _LINUX_LIBRE_FIRMWARE_H
+#define _LINUX_LIBRE_FIRMWARE_H
+
+#define NONFREE_FIRMWARE "/*(DEBLOBBED)*/"
+
+static inline int reject_firmware(const struct firmware **fw,
+ const char *name,
+ struct device *device)
+{
+ struct firmware *xfw = NULL;
+ int retval = request_firmware(&xfw, NONFREE_FIRMWARE, device);
+ if (!retval)
+ release_firmware(xfw);
+ return -EINVAL;
+}
+static inline int maybe_reject_firmware(const struct firmware **fw,
+ const char *name,
+ struct device *device)
+{
+ if (strstr (name, NONFREE_FIRMWARE))
+ return reject_firmware(fw, name, device);
+ else
+ return request_firmware(fw, name, device);
+}
+static inline void discard_rejected_firmware(const struct firmware *fw,
+ void *context)
+{
+ release_firmware(fw);
+}
+static inline int reject_firmware_nowait(
+ struct module *module, int uevent,
+ const char *name, struct device *device, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+ int retval = request_firmware_nowait(module, uevent, NONFREE_FIRMWARE,
+ device, NULL,
+ discard_rejected_firmware);
+ if (retval)
+ return retval;
+ return -EINVAL;
+}
+static inline int maybe_reject_firmware_nowait(
+ struct module *module, int uevent,
+ const char *name, struct device *device, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+ if (strstr (name, NONFREE_FIRMWARE))
+ return reject_firmware_nowait(module, uevent, name,
+ device, context, cont);
+ else
+ return request_firmware_nowait(module, uevent, name,
+ device, context, cont);
+}
+
+#endif /* _LINUX_LIBRE_FIRMWARE_H */
+EOF
#######################
# Removed ATM Drivers #
#######################
-# ATM_AMBASSADOR - Madge Ambassador (Collage PCI 155 Server)
+announce ATM_AMBASSADOR - Madge Ambassador, Collage PCI 155 Server
+reject_firmware drivers/atm/ambassador.c
+clean_blob drivers/atm/ambassador.c
clean_fw firmware/atmsar11.HEX firmware/atmsar11.fw
+$have_check || clean_kconfig drivers/atm/Kconfig 'ATM_AMBASSADOR'
+clean_mk CONFIG_ATM_AMBASSADOR drivers/atm/Makefile
-# ATM_FORE200E_PCA
-# ATM_FORE200E_SBA - SBA-200E
-clean_kconfig drivers/atm/Kconfig 'ATM_FORE.*'
+announce ATM_FORE200E_PCA, ATM_FORE200E_SBA - SBA-200E
+reject_firmware drivers/atm/fore200e.c
+clean_blob drivers/atm/fore200e.c
+clean_blob Documentation/networking/fore200e.txt
+$have_check || clean_kconfig drivers/atm/Kconfig 'ATM_FORE.*'
clean_mk CONFIG_ATM_FORE200E drivers/atm/Makefile
-clean_kconfig drivers/atm/Kconfig 'ATM_AMBASSADOR'
-clean_mk CONFIG_ATM_AMBASSADOR drivers/atm/Makefile
-
########################
# Removed char Drivers #
# wireless
-clean_blob drivers/net/wireless/rtl8187_dev.c
-# clean_kconfig drivers/net/wireless/Kconfig 'RTL8187'
-# clean_mk CONFIG_RTL8187 drivers/net/wireless/Makefile
########################
#! /bin/sh
-# deblob-check version 2009-01-23
+# deblob-check version 2009-01-24
# Inspired in gNewSense's find-firmware script.
# Written by Alexandre Oliva <lxoliva@fsfla.org>
defsnc 'static u8 serit_sp1511lhb_inittab\[\] =' drivers/media/dvb/frontends/si21xx.c
defsnc 'static u8 stv0288_inittab\[\] =' drivers/media/dvb/frontends/stv0288.c
defsnc 'static const struct rf_channel rf_vals_b\[\] =' drivers/net/wireless/rt2x00/rt2400pci.c
+ defsnc 'static const u8 rtl8187b_reg_table\[\]\[3\] =' drivers/net/wireless/rtl8187_dev.c
# request_firmware matches for 2.6.28
accept 'D: Firmware loader (request_firmware)' CREDITS
accept 'EXPORT_SYMBOL(request_firmware\(_nowait\)\?);' drivers/base/firmware_class.c
accept 'int request_firmware\(_nowait\)\?([^;]*);' include/linux/firmware.h
accept 'static inline int request_firmware\(_nowait\)\?([^{]*)[\n]{[\n][\t]return -EINVAL;[\n]}[\n]' include/linux/firmware.h
+ accept 'static inline int \(maybe_\)\?reject_firmware\(_nowait\)\?([^{;]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' include/linux/firmware.h
+
accept 'static inline int request_ihex_firmware\?([^{]*)[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' include/linux/ihex.h
ocomment '[/][*] Optional firmware\([^\n]*[\n] [*]\)*[^\n]* MODULE_FIRMWARE()'
oprepline '#define MODULE_FIRMWARE(_firmware)' include/linux/module.h
accept '[\t]\(retval\|error\) = request_firmware\(_nowait\)\?([^;]*"sample_driver_fw",[^;]*);' samples/firmware_class/firmware_sample_driver.c
ocomment ' [/][*] request_firmware blocks until userspace finished' samples/firmware_class/firmware_sample_driver.c
accept ' [ \t]*" request_firmware_nowait failed' samples/firmware_class/firmware_sample_driver.c
+
+ # Hunting down non-Free firmware-loading code and instructions.
+
+ blob 'atmsar11\.fw' drivers/atm/ambassador.c
+
+ blob ' sprintf([^;]*fore200[^;]*FW_EXT[^;]*);' drivers/atm/fore200e.c
+ blobna '\(pc\|sb\)a200e\(_ecd\)\?\.bin[12]?' drivers/atm/fore200e.c
+ blobna 'The supplied firmware images.*fore.*Rebuild and reinstall[^.]*\.' Documentation/networking/fore200e.txt
+
blobna '\(agere\|prism\)_\(sta\|ap\)_fw\.bin' drivers/net/wireless/orinoco.c
blobna 'symbol_sp24t_\(prim\|sec\)_fw' drivers/net/wireless/orinoco.c
+
# This looks suspicious, but it pretty much just sets stuff to zero.
initnc 'static __u8 mode8420\(pro\|con\)\[\] =' drivers/media/video/cs8420.h