Don't deblob rtl8187_dev.c any more. Reorder ATM deblobbing tasks. Add announce...
authorlxoliva <lxoliva@559672b5-ba27-0410-b829-e8f1faed8b1b>
Sun, 25 Jan 2009 16:15:07 +0000 (16:15 +0000)
committerlxoliva <lxoliva@559672b5-ba27-0410-b829-e8f1faed8b1b>
Sun, 25 Jan 2009 16:15:07 +0000 (16:15 +0000)
git-svn-id: http://www.fsfla.org/svn/fsfla/software/linux-libre/scripts@4705 559672b5-ba27-0410-b829-e8f1faed8b1b

deblob-2.6.27
deblob-2.6.28
deblob-2.6.28-todo
deblob-check

index 4772c9dc22ce2a2aa745e2c08078198220d8be4f..67e5a1b1e5d2b672a329353324a48f4ca0c4f5ab 100755 (executable)
@@ -194,15 +194,14 @@ sed -i "s,^EXTRAVERSION.*,&-libre$extra," Makefile
 
 # ATM_AMBASSADOR -  Madge Ambassador (Collage PCI 155 Server)
 clean_fw firmware/atmsar11.HEX firmware/atmsar11.fw
+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.*'
 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 #
@@ -486,10 +485,6 @@ clean_mk CONFIG_USB_KAWETH drivers/net/usb/Makefile
 
 # wireless
 
-clean_blob drivers/net/wireless/rtl8187_dev.c
-# clean_kconfig drivers/net/wireless/Kconfig 'RTL8187'
-# clean_mk CONFIG_RTL8187 drivers/net/wireless/Makefile
-
 
 ########################
 # Removed s390 Drivers #
index 127885e917e0e40ea969c053d2c910eb32e34820..a2044ce1e3ef64a900a624c44080a57de3e8204e 100755 (executable)
@@ -59,6 +59,11 @@ else
   have_check=:
 fi
 
+announce () {
+       echo
+       echo "$@"
+}
+
 clean_file () {
        #$1 = filename
        if test ! -f $1; then
@@ -154,7 +159,16 @@ clean_mk () {
        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.
@@ -199,23 +213,85 @@ for f in \
 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 #
@@ -500,9 +576,6 @@ clean_mk CONFIG_USB_KAWETH drivers/net/usb/Makefile
 
 # wireless
 
-clean_blob drivers/net/wireless/rtl8187_dev.c
-# clean_kconfig drivers/net/wireless/Kconfig 'RTL8187'
-# clean_mk CONFIG_RTL8187 drivers/net/wireless/Makefile
 
 
 ########################
index 6bfaaff4529112b172936aa4db83ba85844c1ca6..85b235873555083623e73927ffe1bd6e7b627bd5 100644 (file)
@@ -14,8 +14,6 @@ arch/cris/arch-v32/drivers/iop_fw_load.c
 arch/x86/kernel/microcode_amd.c
 arch/x86/kernel/microcode_core.c
 arch/x86/kernel/microcode_intel.c
-drivers/atm/ambassador.c
-drivers/atm/fore200e.c
 drivers/bluetooth/bcm203x.c
 drivers/bluetooth/bfusb.c
 drivers/bluetooth/bt3c_cs.c
index f6b5c21dc91d52d4d897ce198100b491e3ebc883..0a5ce08279e3a7f2469fedf9ce934aa6fb5142a9 100755 (executable)
@@ -1,6 +1,6 @@
 #! /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>
 
@@ -819,6 +819,7 @@ set_except () {
     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
@@ -838,6 +839,8 @@ set_except () {
     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
@@ -845,9 +848,19 @@ set_except () {
     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