X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=deblob-2.6.28;h=63686440b1aeaf1ecb59fe2aa05060df8c7a1b9c;hb=cbd2ed2b96a8eb5249fe3f0d70d6b989f3df84dd;hp=4c67a1491f3eb68aa3c4a0ec7ca085068f3adc3e;hpb=f175dad390a9eef639a2853029e7e66683299374;p=releases.git diff --git a/deblob-2.6.28 b/deblob-2.6.28 index 4c67a1491f3e..63686440b1ae 100755 --- a/deblob-2.6.28 +++ b/deblob-2.6.28 @@ -1,7 +1,7 @@ #!/bin/sh +# Copyright (C) 2008, 2009 Alexandre Oliva # Copyright (C) 2008 Jeff Moe -# Copyright (C) 2008 Alexandre Oliva # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -59,7 +59,12 @@ else have_check=: fi -function clean_file { +announce () { + echo + echo "$@" +} + +clean_file () { #$1 = filename if test ! -f $1; then die $1 does not exist, something is wrong @@ -67,7 +72,7 @@ function clean_file { rm -v $1 } -function check_changed { +check_changed () { if test ! -f $1; then die $1 does not exist, something is wrong elif cmp $1.deblob $1 > /dev/null; then @@ -76,7 +81,7 @@ function check_changed { mv $1.deblob $1 } -function clean_blob { +clean_blob () { #$1 = filename if $have_check; then if test ! -f $1; then @@ -86,14 +91,14 @@ function clean_blob { echo Removing blobs from $name set fnord "$@" -d shift 2 - $check "$@" $name > $name.deblob + $check "$@" -i linux-$kver $name > $name.deblob check_changed $name else clean_file $1 fi } -function dummy_blob { +dummy_blob () { #$1 = filename if test -f $1; then echo $1 exists, something is wrong >&2 @@ -107,7 +112,7 @@ function dummy_blob { firmware/Makefile } -function clean_fw { +clean_fw () { #$1 = firmware text input, $2 = firmware output if test ! -f $1; then echo $1 does not exist, something is wrong >&2 @@ -120,7 +125,7 @@ function clean_fw { dummy_blob $2 } -function drop_fw_file { +drop_fw_file () { #$1 = firmware text input, $2 = firmware output if test ! -f $1; then echo $1 does not exist, something is wrong >&2 @@ -133,8 +138,18 @@ function drop_fw_file { dummy_blob $2 } -function clean_kconfig { +clean_kconfig () { #$1 = filename $2 = things to remove + case $1 in + -f) + shift + ;; + *) + if $have_check; then + return + fi + ;; + esac echo Marking config $2 as depending on NONFREE in $1 sed "/^config \\($2\\)\$/{p;i\ depends on NONFREE @@ -142,7 +157,7 @@ d;}" $1 > $1.deblob check_changed $1 } -function clean_mk { +clean_mk () { #$1 = config $2 = Makefile name # We don't clean up Makefiles any more --lxoliva # sed -i "/\\($1\\)/d" $2 @@ -150,12 +165,21 @@ function clean_mk { if sed -n "/\\($1\\)/p" $2 | grep . > /dev/null; then : else - echo $2 does not contain matches for $1 - exit 1 + die $2 does not contain matches for $1 fi } +clean_sed () { + #$1 = sed-script $2 = file + echo Cleaning "$2" with sed script "$1" + 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. @@ -200,46 +224,135 @@ 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 maybe_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 +clean_kconfig drivers/atm/Kconfig 'ATM_AMBASSADOR' +clean_mk CONFIG_ATM_AMBASSADOR drivers/atm/Makefile -# ATM_FORE200E_PCA -# ATM_FORE200E_SBA - SBA-200E +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 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 # ######################## -# COMPUTONE - Computone IntelliPort Plus serial +announce COMPUTONE - Computone IntelliPort Plus serial drop_fw_file firmware/intelliport2.bin.ihex firmware/intelliport2.bin +reject_firmware drivers/char/ip2/ip2main.c +clean_blob drivers/char/ip2/ip2main.c clean_kconfig drivers/char/Kconfig 'COMPUTONE' clean_mk CONFIG_COMPUTONE drivers/char/Makefile # gpu drm -# DRM_MGA - Matrox g200/g400 +announce DRM_MGA - Matrox g200/g400 clean_blob drivers/gpu/drm/mga/mga_ucode.h +clean_blob drivers/gpu/drm/mga/mga_warp.c clean_kconfig drivers/gpu/drm/Kconfig 'DRM_MGA' clean_mk CONFIG_DRM_MGA drivers/gpu/drm/Makefile -# DRM_R128 - ATI Rage 128 +announce DRM_R128 - ATI Rage 128 +clean_sed '/^static int r128_do_init_cce(/,/^}$/{ + /^ r128_cce_load_microcode(dev_priv);$/{ + i\ + DRM_ERROR("Missing Free microcode!\\n");\ + dev->dev_private = (void *)dev_priv;\ + r128_do_cleanup_cce(dev);\ + return -EINVAL; + } +}' drivers/gpu/drm/r128/r128_cce.c clean_blob drivers/gpu/drm/r128/r128_cce.c clean_kconfig drivers/gpu/drm/Kconfig 'DRM_R128' clean_mk CONFIG_DRM_R128 drivers/gpu/drm/Makefile -# DRM_RADEON - ATI Radeon +announce DRM_RADEON - ATI Radeon +clean_sed '/^static int radeon_do_init_cce(/,/^}$/{ + /^ radeon_cp_load_microcode(dev_priv);$/{ + i\ + DRM_ERROR("Missing Free microcode!\\n");\ + radeon_do_cleanup_cp(dev);\ + return -EINVAL; + } +} +/^static int radeon_do_resume_cp(/,/^}$/{ + /^ radeon_cp_load_microcode(dev_priv);$/{ + i\ + DRM_ERROR("Missing Free microcode!\\n");\ + return -EINVAL; + } +}' drivers/gpu/drm/radeon/radeon_cp.c clean_blob drivers/gpu/drm/radeon/radeon_microcode.h clean_kconfig drivers/gpu/drm/Kconfig 'DRM_RADEON' clean_mk CONFIG_DRM_RADEON drivers/gpu/drm/Makefile @@ -250,97 +363,89 @@ clean_mk CONFIG_DRM_RADEON drivers/gpu/drm/Makefile ######################### -# dvb/dvb-usb -clean_blob drivers/media/dvb/dvb-usb/af9005-script.h +announce DVB non-Free firmware scripts and documentation +clean_blob Documentation/dvb/get_dvb_firmware +clean_blob Documentation/dvb/avermedia.txt +clean_blob Documentation/dvb/opera-firmware.txt +clean_blob Documentation/dvb/ttusb-dec.txt + +announce DVB_USB_AF9005 - Afatech AF9005 DVB-T USB1.1 +clean_file drivers/media/dvb/dvb-usb/af9005-script.h +clean_sed 's,^ deb_info("load init script\\n");$, {\n err("Missing Free init script\\n");\n return scriptlen = ret = -EINVAL;\n ,' drivers/media/dvb/dvb-usb/af9005-fe.c +clean_blob drivers/media/dvb/dvb-usb/af9005-fe.c clean_kconfig drivers/media/dvb/dvb-usb/Kconfig 'DVB_USB_AF9005' clean_mk CONFIG_DVB_USB_AF9005 drivers/media/dvb/dvb-usb/Makefile # dvb/frontends -# DVB_TDA10021 - Philips TDA10021 based -clean_blob drivers/media/dvb/frontends/tda10021.c -clean_kconfig drivers/media/dvb/frontends/Kconfig 'DVB_TDA10021' -clean_mk CONFIG_DVB_TDA10021 drivers/media/dvb/frontends/Makefile +announce DVB_SP8870 - Spase sp8870 +clean_sed 's,SP8870_DEFAULT_FIRMWARE,NONFREE_FIRMWARE,g' drivers/media/dvb/frontends/sp8870.c +clean_blob drivers/media/dvb/frontends/sp8870.c +clean_kconfig drivers/media/dvb/frontends 'DVB_SP8870' +clean_mk CONFIG_DVB_SP8870 drivers/media/dvb/frontends/Makefile -# DVB_TDA8083 - Philips TDA8083 based -clean_blob drivers/media/dvb/frontends/tda8083.c -clean_kconfig drivers/media/dvb/frontends/Kconfig 'DVB_TDA8083' -clean_mk CONFIG_DVB_TDA8083 drivers/media/dvb/frontends/Makefile - -# DVB_VES1820 - VLSI VES1820 based -clean_blob drivers/media/dvb/frontends/ves1820.c -clean_kconfig drivers/media/dvb/frontends/Kconfig 'DVB_VES1820' -clean_mk CONFIG_DVB_VES1820 drivers/media/dvb/frontends/Makefile - -# DVB_VES1X93 - VLSI VES1893 or VES1993 based -clean_blob drivers/media/dvb/frontends/ves1x93.c -clean_kconfig drivers/media/dvb/frontends/Kconfig 'DVB_VES1X93' -clean_mk CONFIG_DVB_VES1X93 drivers/media/dvb/frontends/Makefile +announce DVB_TDA1004X - Philips TDA10045H/TDA10046H +clean_sed 's,TDA1004[56]_DEFAULT_FIRMWARE,NONFREE_FIRMWARE,g' drivers/media/dvb/frontends/tda1004x.c +clean_blob drivers/media/dvb/frontends/tda1004x.c +clean_kconfig drivers/media/dvb/frontends 'DVB_TDA1004X' +clean_mk CONFIG_DVB_TDA1004X drivers/media/dvb/frontends/Makefile # dvb/ttpci -# DVB_AV7110 - AV7110 cards +announce DVB_AV7110 - AV7110 cards +# The bootcode is actually Free Software under GPLv2, but since it's +# being distributed without source code, we're taking it out for now. +clean_sed 's,^ \/\* boot \*\/$, printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): Missing Free bootcode\\n");\n return -EINVAL;\n\n&,' drivers/media/dvb/ttpci/av7110_hw.c +clean_sed 's,mwdebi(.*bootcode.*$,/* & */,' drivers/media/dvb/ttpci/av7110_hw.c clean_blob drivers/media/dvb/ttpci/av7110_hw.c +clean_sed '/^static int get_firmware(/,/^}$/s, request_firmware(, reject_firmware(,' drivers/media/dvb/ttpci/av7110.c +clean_sed '/^static int alps_tdlb7_request_firmware(/,/^}$/s, request_firmware(, maybe_reject_firmware(,' drivers/media/dvb/ttpci/av7110.c clean_blob drivers/media/dvb/ttpci/av7110.c clean_kconfig drivers/media/dvb/ttpci/Kconfig 'DVB_AV7110' clean_mk CONFIG_DVB_AV7110 drivers/media/dvb/ttpci/Makefile -# DVB_BUDGET_AV - Budget cards with analog video inputs -clean_blob drivers/media/dvb/ttpci/budget-av.c -clean_kconfig drivers/media/dvb/ttpci/Kconfig 'DVB_BUDGET_AV' -clean_kconfig drivers/media/dvb/ttpci/Kconfig 'DVB_BUDGET_PATCH' -clean_kconfig drivers/media/dvb/ttpci/Kconfig 'DVB_BUDGET' -clean_mk CONFIG_DVB_BUDGET_AV drivers/media/dvb/ttpci/Makefile -clean_mk CONFIG_DVB_BUDGET_PATCH drivers/media/dvb/ttpci/Makefile -clean_mk CONFIG_DVB_BUDGET drivers/media/dvb/ttpci/Makefile +announce DVB_BUDGET - Budget cards +clean_sed '/^static int alps_tdhd1_204_request_firmware(/,/^}$/s, request_firmware(, maybe_reject_firmware(,' drivers/media/dvb/ttpci/budget.c + +announce DVB_BUDGET_AV - Budget cards with analog video inputs +clean_sed '/^static int philips_tu1216_request_firmware(/,/^}$/s, request_firmware(, maybe_reject_firmware(,' drivers/media/dvb/ttpci/budget-av.c -# DVB_BUDGET_CI - Budget cards with onboard CI connector -clean_blob drivers/media/dvb/ttpci/budget-ci.c -clean_kconfig drivers/media/dvb/ttpci/Kconfig 'DVB_BUDGET_CI' -clean_mk CONFIG_DVB_BUDGET_CI drivers/media/dvb/ttpci/Makefile +announce DVB_BUDGET_CI - Budget cards with onboard CI connector +clean_sed '/^static int philips_tdm1316l_request_firmware(/,/^}$/s, request_firmware(, maybe_reject_firmware(,' drivers/media/dvb/ttpci/budget-ci.c # dvb/ttusb-budget -# DVB_TTUSB_BUDGET - Technotrend/Hauppauge Nova-USB devices +announce DVB_TTUSB_BUDGET - Technotrend/Hauppauge Nova-USB devices drop_fw_file firmware/ttusb-budget/dspbootcode.bin.ihex firmware/ttusb-budget/dspbootcode.bin +clean_sed '/^static int philips_tdm1316l_request_firmware(/,/^}$/s, request_firmware(, maybe_reject_firmware(,' drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +reject_firmware drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c clean_blob drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c clean_kconfig drivers/media/dvb/ttusb-budget/Kconfig 'DVB_TTUSB_BUDGET' clean_mk CONFIG_DVB_TTUSB_BUDGET drivers/media/dvb/ttusb-budget/Makefile # video -# USB_PWC - USB Philips Cameras -clean_blob drivers/media/video/pwc/pwc-kiara.c -clean_blob drivers/media/video/pwc/pwc-timon.c -clean_kconfig drivers/media/video/pwc/Kconfig 'USB_PWC' -clean_mk CONFIG_USB_PWC drivers/media/video/Makefile - -# VIDEO_CPIA - CPiA Video For Linux +announce VIDEO_CPIA2 - CPiA2 Video For Linux clean_fw firmware/cpia2/stv0672_vp4.bin.ihex firmware/cpia2/stv0672_vp4.bin -clean_kconfig drivers/media/video/Kconfig 'VIDEO_CPIA' -clean_kconfig drivers/media/video/Kconfig 'VIDEO_CPIA_PP' -clean_kconfig drivers/media/video/Kconfig 'VIDEO_CPIA_USB' +reject_firmware drivers/media/video/cpia2/cpia2_core.c +clean_blob drivers/media/video/cpia2/cpia2_core.c clean_kconfig drivers/media/video/cpia2/Kconfig 'VIDEO_CPIA2' -clean_mk CONFIG_VIDEO_CPIA drivers/media/video/Makefile -clean_mk CONFIG_VIDEO_CPIA_PP drivers/media/video/Makefile -clean_mk CONFIG_VIDEO_CPIA_USB drivers/media/video/Makefile -clean_mk CONFIG_VIDEO_CPIA2 drivers/media/video/Makefile +clean_mk CONFIG_VIDEO_CPIA2 drivers/media/video/cpia2/Makefile -# USB_DABUSB - DABUSB driver +announce USB_DABUSB - DABUSB driver clean_fw firmware/dabusb/bitstream.bin.ihex firmware/dabusb/bitstream.bin clean_fw firmware/dabusb/firmware.HEX firmware/dabusb/firmware.fw +reject_firmware drivers/media/video/dabusb.c +clean_blob drivers/media/video/dabusb.c clean_kconfig drivers/media/Kconfig 'USB_DABUSB' clean_mk CONFIG_USB_DABUSB drivers/media/video/Makefile # video/usbvideo -# USB_IBMCAM - USB IBM (Xirlink) C-it Camera support -clean_blob drivers/media/video/usbvideo/ibmcam.c -clean_kconfig drivers/media/video/usbvideo/Kconfig 'USB_IBMCAM' -clean_mk CONFIG_USB_IBMCAM drivers/media/video/usbvideo/Makefile - -# USB_VICAM - USB 3com HomeConnect (aka vicam) +announce USB_VICAM - USB 3com HomeConnect, AKA vicam drop_fw_file firmware/vicam/firmware.H16 firmware/vicam/firmware.fw +reject_firmware drivers/media/video/vicam.c +clean_blob drivers/media/video/vicam.c clean_kconfig drivers/media/video/usbvideo/Kconfig 'USB_VICAM' clean_mk CONFIG_USB_VICAM drivers/media/video/usbvideo/Makefile @@ -355,8 +460,12 @@ clean_kconfig drivers/net/Kconfig 'ACENIC' clean_mk CONFIG_ACENIC drivers/net/Makefile # ADAPTEC_STARFIRE - Adaptec Starfire/DuraLAN support -# This adds restrictions on top of GPLv2, but after deblobbing, -# nothing copyrightable remains. + +# This file requires prior acceptance of the GPL before you can even +# run the code in it. It's not clear whether this is a further +# requirement that would make the distribution incompatible with the +# GPL, but since nothing remains after we remove the blob, it's +# irrelevant whether the explicit acceptance would be a problem. clean_blob drivers/net/starfire_firmware.h clean_kconfig drivers/net/Kconfig 'ADAPTEC_STARFIRE' clean_mk CONFIG_ADAPTEC_STARFIRE drivers/net/Makefile @@ -405,7 +514,9 @@ clean_kconfig drivers/net/Kconfig 'TEHUTI' clean_mk CONFIG_TEHUTI drivers/net/Makefile # TIGON3 - Broadcom Tigon3 -patch --no-backup-if-mismatch -p0 <<\EOF # patches/linux-2.6-tg3-clean.patch +patch --no-backup-if-mismatch --batch -p0 <<\EOF || \ + die failed to remove license comments from drivers/net/tg3.c \ + # patches/linux-2.6-tg3-clean.patch --- drivers/net/tg3.c +++ drivers/net/tg3.c @@ -5,14 +5,6 @@ @@ -495,9 +606,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 ######################## @@ -729,7 +837,7 @@ clean_mk CONFIG_SLICOSS drivers/staging/slicoss/Makefile # SXG - Alacritech SLIC Technology Non-Accelerated 10Gbe cards clean_blob drivers/staging/sxg/saharadbgdownload.h clean_blob drivers/staging/sxg/sxgphycode.h -clean_kconfig driivers/staging/sxg/Kconfig 'SXG' +clean_kconfig drivers/staging/sxg/Kconfig 'SXG' clean_mk CONFIG_SXG drivers/staging/sxg/Makefile exit 0