From fbe9a0d38b4b5f50294c57b158ab6d74f362a0e3 Mon Sep 17 00:00:00 2001 From: Jason Self Date: Mon, 4 Feb 2019 18:18:57 -0800 Subject: [PATCH] deblob-2.6.25-libre --- COPYING | 340 +++++++++ deblob-2.6.25 | 604 ++++++++++++++++ deblob-check | 1923 +++++++++++++++++++++++++++++++++++++++++++++++++ deblob-main | 206 ++++++ 4 files changed, 3073 insertions(+) create mode 100644 COPYING create mode 100755 deblob-2.6.25 create mode 100755 deblob-check create mode 100755 deblob-main diff --git a/COPYING b/COPYING new file mode 100644 index 00000000000..623b6258a13 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/deblob-2.6.25 b/deblob-2.6.25 new file mode 100755 index 00000000000..2f3457d5704 --- /dev/null +++ b/deblob-2.6.25 @@ -0,0 +1,604 @@ +#!/bin/sh +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# deblob - remove non-free blobs from the vanilla linux kernel +# +# http://www.blagblagblag.org/pub/BLAG/linux/kernel/v2.6 +# ftp://ftp.blagblagblag.org/pub/BLAG/linux/kernel/v2.6 +# http://www.fsfla.org/svn/fsfla/software/linux-libre +# +# See also: +# http://wiki.debian.org/KernelFirmwareLicensing +# svn://svn.debian.org/kernel/dists/trunk/linux-2.6/debian/patches/debian/dfsg/files-1 +# http://svn.gnewsense.svnhopper.net/gnewsense/builder/trunk/firmware/firmware-removed +# http://svn.gnewsense.svnhopper.net/gnewsense/builder/trunk/gen-kernel +# +# Thanks to Brian Brazil @ gnewsense +# + +# This version, suited for 2.6.25, avoids removing Free Software for +# the sake of removing non-Free Software. Drivers that currently +# require non-Free firmware are retained, but firmware included in +# GPLed sources is replaced with /*(DEBLOBBED)*/ if the deblob-check +# script, that knows how to do this, is present. -lxoliva + +# For each kver release, start extra with an empty string, then count +# from 1 if changes are needed that require rebuilding the tarball. +kver=2.6.25 extra= + +sed -i "s,^EXTRAVERSION.*,EXTRAVERSION = -libre$extra," Makefile + +#################### +# FOOOOO XXXXXX +# drivers/net/tokenring/Kconfig needs as last line: +# endif # TR +# drivers/media/Kconfig needs before endmenu +# endif # DAB + +if [ ! -f `which unifdef` ] ; then echo "requires unifdef" ; exit ; fi + +function clean_file { + #$1 = filename + rm -v $1 +} + +check=`echo $0 | sed 's,/[^/]*$,,'`/deblob-check +function clean_blob { + #$1 = filename + if test -f $check; then + name=$1 + set fnord "$@" -d + shift 2 + $check "$@" $name > $name.deblob + mv $name.deblob $name + else + clean_file $1 + fi +} + +function clean_kconfig { + #$1 = filename $2 = things to remove + sed -i "/^config $2\$/{p;i\ + depends on NONFREE +d;}" $1 +} + +function clean_mk { + #$1 = config $2 = Makefile name + # We don't clean up Makefiles any more --lxoliva + : sed -i "/($1)/d" $2 +} + +function clean_ifdef { + #$1 = filename $2 = macro to -U + unifdef $1 -U$2 > $1.deblob + mv $1.deblob $1 +} + +####################### +# Removed ATM Drivers # +####################### + +# ATM_AMBASSADOR - Madge Ambassador (Collage PCI 155 Server) +clean_blob drivers/atm/atmsar11.data + +# ATM_FORE200E_PCA +# ATM_FORE200E_SBA - SBA-200E +# it appears by placing these files under the GPL this company +# now has to release the source + +# There's no code in this file. --lxoliva +# clean_file drivers/atm/fore200e_firmware_copyright + +# There's only GPLed code in this one. --lxoliva +# clean_file drivers/atm/fore200e_mkfirm.c + +clean_kconfig ./drivers/atm/Kconfig 'ATM_\(FORE\).*' +clean_mk CONFIG_ATM_FORE200E ./drivers/atm/Makefile + +clean_file drivers/atm/pca200e.data +clean_file drivers/atm/pca200e_ecd.data +clean_file drivers/atm/sba200e_ecd.data +clean_kconfig ./drivers/atm/Kconfig 'ATM_AMBASSADOR' +clean_mk CONFIG_ATM_AMBASSADOR ./drivers/atm/Makefile + + +######################## +# Removed char Drivers # +######################## + +# COMPUTONE - Computone IntelliPort Plus serial +clean_blob drivers/char/ip2/fip_firm.h +clean_kconfig ./drivers/char/Kconfig 'COMPUTONE' +clean_mk CONFIG_COMPUTONE ./drivers/char/Makefile + +# DSP56001 Device Driver +clean_blob drivers/char/dsp56k.c +clean_kconfig ./arch/m68k/Kconfig 'ATARI_DSP56K' +clean_mk CONFIG_ATARI_DSP56K ./drivers/char/Makefile + +# drm + +# DRM_MGA - Matrox g200/g400 +clean_blob drivers/char/drm/mga_ucode.h +clean_kconfig ./drivers/char/drm/Kconfig 'DRM_MGA' +clean_mk CONFIG_DRM_MGA ./drivers/char/drm/Makefile + +# DRM_R128 - ATI Rage 128 +clean_blob drivers/char/drm/r128_cce.c +clean_kconfig ./drivers/char/drm/Kconfig 'DRM_R128' +clean_mk CONFIG_DRM_R128 ./drivers/char/drm/Makefile + +# DRM_RADEON - ATI Radeon +clean_blob drivers/char/drm/radeon_cp.c +clean_kconfig ./drivers/char/drm/Kconfig 'DRM_RADEON' +clean_mk CONFIG_DRM_RADEON ./drivers/char/drm/Makefile + + +######################### +# Removed Media Drivers # +######################### + + +# dvb/dvb-usb +clean_blob drivers/media/dvb/dvb-usb/af9005-script.h +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 + +# 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 + +# dvb/ttpci + +# DVB_AV7110 - AV7110 cards +clean_blob drivers/media/dvb/ttpci/av7110_hw.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 + +# 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 + +# dvb/ttusb-budget + +# DVB_TTUSB_BUDGET - Technotrend/Hauppauge Nova-USB devices +clean_blob drivers/media/dvb/ttusb-budget/dvb-ttusb-dspbootcode.h +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 +clean_blob drivers/media/video/cpia2/cpia2patch.h +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' +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 + +# USB_DABUSB - DABUSB driver +clean_blob drivers/media/video/dabfirmware.h +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) +clean_blob drivers/media/video/usbvideo/vicam.c +clean_kconfig ./drivers/media/video/usbvideo/Kconfig 'USB_VICAM' +clean_mk CONFIG_USB_VICAM ./drivers/media/video/usbvideo/Makefile + +# other... + +# disable -- appears to neeed other DVB bits +clean_mk CONFIG_DVB_CORE ./drivers/media/Makefile +clean_mk CONFIG_VIDEOBUF_DVB ./drivers/media/video/Makefile +clean_mk CONFIG_VIDEO_SAA7134 ./drivers/media/video/Makefile +clean_mk CONFIG_VIDEO_CX88 ./drivers/media/video/Makefile +clean_kconfig ./drivers/media/Kconfig 'VIDEOBUF_DVB' + +####################### +# Removed net Drivers # +####################### + + +# ACENIC - Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit +clean_blob drivers/net/acenic_firmware.h +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. +clean_blob drivers/net/starfire_firmware.h +clean_kconfig ./drivers/net/Kconfig 'ADAPTEC_STARFIRE' +clean_mk CONFIG_ADAPTEC_STARFIRE ./drivers/net/Makefile + +# BNX2 - Broadcom NetXtremeII +clean_blob drivers/net/bnx2_fw.h +clean_blob drivers/net/bnx2_fw2.h +clean_kconfig ./drivers/net/Kconfig 'BNX2' +clean_mk CONFIG_BNX2 ./drivers/net/Makefile + +clean_blob drivers/net/bnx2x_init_values.h +clean_kconfig ./drivers/net/Kconfig 'BNX2X' +clean_mk CONFIG_BNX2X ./divers/net/Makefile + +# CASSINI - Sun Cassini +clean_blob drivers/net/cassini.h +clean_kconfig ./drivers/net/Kconfig 'CASSINI' +clean_mk CONFIG_CASSINI ./drivers/net/Makefile + +# E100 - Intel(R) PRO/100+ +clean_blob drivers/net/e100.c +sed -i 's:\(\/\*(DEBLOBBED)\*\/\),:\1:' drivers/net/e100.c +# clean_kconfig ./drivers/net/Kconfig 'E100' +# clean_mk CONFIG_E100 ./drivers/net/Makefile + +# MYRI_SBUS - MyriCOM Gigabit Ethernet +clean_blob drivers/net/myri_code.h +clean_kconfig ./drivers/net/Kconfig 'MYRI_SBUS' +clean_mk CONFIG_MYRI_SBUS ./drivers/net/Makefile + +# TEHUTI - Tehuti Networks 10G Ethernet +clean_blob drivers/net/tehuti_fw.h +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 +--- drivers/net/tg3.c ++++ drivers/net/tg3.c +@@ -5,14 +5,6 @@ + * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com) + * Copyright (C) 2004 Sun Microsystems Inc. + * Copyright (C) 2005-2007 Broadcom Corporation. +- * +- * Firmware is: +- * Derived from proprietary unpublished source code, +- * Copyright (C) 2000-2003 Broadcom Corporation. +- * +- * Permission is hereby granted for the distribution of this firmware +- * data in hexadecimal or equivalent format, provided this copyright +- * notice is accompanying it. + */ + + +EOF +clean_blob drivers/net/tg3.c -s 9 +sed -i 's:\(\/\*(DEBLOBBED)\*\/\),:\1:' drivers/net/tg3.c + +# TYPHOON - 3cr990 series Typhoon +clean_blob drivers/net/typhoon-firmware.h +clean_kconfig ./drivers/net/Kconfig 'TYPHOON' +clean_mk CONFIG_TYPHOON ./drivers/net/Makefile + +# appletalk + +# COPS - COPS LocalTalk PC +# clean_blob drivers/net/appletalk/cops.c +# clean_blob drivers/net/appletalk/cops.h +clean_blob drivers/net/appletalk/cops_ffdrv.h +clean_blob drivers/net/appletalk/cops_ltdrv.h +clean_kconfig ./drivers/net/appletalk/Kconfig 'COPS|COPS_DAYNA|COPS_TANGENT' +clean_mk CONFIG_COPS ./drivers/net/appletalk/Makefile + +# hamradio + +# YAM - YAM driver for AX.25 +clean_blob drivers/net/hamradio/yam1200.h +clean_blob drivers/net/hamradio/yam9600.h +clean_kconfig ./drivers/net/hamradio/Kconfig 'YAM' +clean_mk CONFIG_YAM ./drivers/net/hamradio/Makefile + +# pcmcia + +# PCMCIA_SMC91C92 - SMC 91Cxx PCMCIA +clean_blob drivers/net/pcmcia/ositech.h +clean_kconfig ./drivers/net/pcmcia/Kconfig 'PCMCIA_SMC91C92' +clean_mk CONFIG_PCMCIA_SMC91C92 ./drivers/net/pcmcia/Makefile + + +# tokenring + +# 3C359 - 3Com 3C359 Token Link Velocity XL adapter +# No need to remove these, they don't contain non-Free code. +# clean_blob drivers/net/tokenring/3c359.c +# clean_blob drivers/net/tokenring/3c359.h +# This file is not under the GPL, better remove it all. +clean_file drivers/net/tokenring/3c359_microcode.h +clean_kconfig ./drivers/net/tokenring/Kconfig '3C359' +clean_mk CONFIG_3C359 ./drivers/net/tokenring/Makefile + +# SMCTR - SMC ISA/MCA adapter +# No need to remove these, they don't contain non-Free code. +# clean_blob drivers/net/tokenring/smctr.c +# clean_blob drivers/net/tokenring/smctr.h +# This file is not under the GPL, better remove it all. +clean_file drivers/net/tokenring/smctr_firmware.h +clean_kconfig ./drivers/net/tokenring/Kconfig 'SMCTR' +clean_mk CONFIG_SMCTR ./drivers/net/tokenring/Makefile + +# usb + +# USB_KAWETH - USB KLSI KL5USB101-based ethernet device support +clean_blob drivers/net/usb/kawethfw.h +clean_kconfig ./drivers/net/usb/Kconfig 'USB_KAWETH' +clean_mk CONFIG_USB_KAWETH ./drivers/net/usb/Makefile + + +######################## +# Removed s390 Drivers # +######################## + +# QETH - Gigabit Ethernet device support +clean_blob drivers/s390/net/qeth_mpc.c +clean_kconfig ./drivers/s390/net/Kconfig 'QETH' +clean_mk CONFIG_QETH ./drivers/s390/net/Makefile + +######################## +# Removed SCSI Drivers # +######################## + +# SCSI_QLOGICPTI - PTI Qlogic, ISP Driver +clean_blob drivers/scsi/qlogicpti_asm.c +clean_kconfig ./drivers/scsi/Kconfig 'SCSI_QLOGICPTI' +clean_mk CONFIG_SCSI_QLOGICPTI ./drivers/scsi/Makefile + +# SCSI_ADVANSYS - AdvanSys SCSI +clean_blob drivers/scsi/advansys.c +clean_kconfig ./drivers/scsi/Kconfig 'SCSI_ADVANSYS' +clean_mk CONFIG_SCSI_ADVANSYS ./drivers/scsi/Makefile + +# SCSI_QLOGIC_1280 - Qlogic QLA 1240/1x80/1x160 SCSI +clean_blob drivers/scsi/ql1280_fw.h +clean_blob drivers/scsi/ql1040_fw.h +clean_blob drivers/scsi/ql12160_fw.h +clean_kconfig ./drivers/scsi/Kconfig 'SCSI_QLOGIC_1280' +clean_mk CONFIG_SCSI_QLOGIC_1280 ./drivers/scsi/Makefile + + +####################### +# Removed USB Drivers # +####################### + +# misc + +# USB_EMI26 - EMI 2|6 USB Audio interface +# No need to remove this, it doesn't contain non-Free code. +# clean_blob drivers/usb/misc/emi26.c +# This file is not under the GPL, better remove it all. +clean_file drivers/usb/misc/emi26_fw.h +clean_kconfig ./drivers/usb/misc/Kconfig 'USB_EMI26' +clean_mk CONFIG_USB_EMI26 ./drivers/usb/misc/Makefile + +# USB_EMI62 - EMI 6|2m USB Audio interface +# No need to remove this, it doesn't contain non-Free code. +# clean_blob drivers/usb/misc/emi62.c +# This file are probably not under the GPL, better remove them all. +clean_file drivers/usb/misc/emi62_fw_m.h +clean_file drivers/usb/misc/emi62_fw_s.h +clean_kconfig ./drivers/usb/misc/Kconfig 'USB_EMI62' +clean_mk CONFIG_USB_EMI62 ./drivers/usb/misc/Makefile + +# USB_SISUSBVGA - USB 2.0 SVGA dongle support (Net2280/SiS315) +clean_blob drivers/usb/misc/sisusbvga/sisusb_init.h +clean_kconfig ./drivers/usb/misc/sisusbvga/Kconfig 'USB_SISUSBVGA' +clean_mk CONFIG_USB_SISUSBVGA ./drivers/usb/misc/sisusbvga/Makefile + +# serial + +# USB_SERIAL_KEYSPAN_MPR - USB Keyspan MPR Firmware +clean_file drivers/usb/serial/keyspan_mpr_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_MPR' +# USB_SERIAL_KEYSPAN_USA18X - USB Keyspan USA-18X Firmware +clean_file drivers/usb/serial/keyspan_usa18x_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA18X' +# USB_SERIAL_KEYSPAN_USA19 - USB Keyspan USA-19 Firmware +clean_file drivers/usb/serial/keyspan_usa19_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA19' +# USB_SERIAL_KEYSPAN_USA19QI - USB Keyspan USA-19QI Firmware +clean_file drivers/usb/serial/keyspan_usa19qi_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA19QI' +# USB_SERIAL_KEYSPAN_USA19QW - USB Keyspan USA-19QW Firmware +clean_file drivers/usb/serial/keyspan_usa19qw_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA19QW' +# USB_SERIAL_KEYSPAN_USA19W - USB Keyspan USA-19W Firmware +clean_file drivers/usb/serial/keyspan_usa19w_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA19W' +# USB_SERIAL_KEYSPAN_USA28 - USB Keyspan USA-28 Firmware +clean_file drivers/usb/serial/keyspan_usa28_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA28' +# USB_SERIAL_KEYSPAN_USA28XA - USB Keyspan USA-28XA Firmware +clean_file drivers/usb/serial/keyspan_usa28xa_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA28XA' +# USB_SERIAL_KEYSPAN_USA28XB - USB Keyspan USA-28XB Firmware +clean_file drivers/usb/serial/keyspan_usa28xb_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA28XB' +# USB_SERIAL_KEYSPAN_USA28X - USB Keyspan USA-28X Firmware +clean_file drivers/usb/serial/keyspan_usa28x_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA28X' +# USB_SERIAL_KEYSPAN_USA49W - USB Keyspan USA-49W Firmware +clean_file drivers/usb/serial/keyspan_usa49w_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA49W' +# USB_SERIAL_KEYSPAN_USA49WLC - USB Keyspan USA-49WLC Firmware +clean_file drivers/usb/serial/keyspan_usa49wlc_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_KEYSPAN_USA49WLC' +clean_mk CONFIG_USB_SERIAL_KEYSPAN ./drivers/usb/serial/Makefile + +# USB_SERIAL_EDGEPORT - USB Inside Out Edgeport Serial Driver +clean_file drivers/usb/serial/io_fw_boot.h +clean_file drivers/usb/serial/io_fw_down.h +clean_file drivers/usb/serial/io_fw_down2.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_EDGEPORT' +clean_mk CONFIG_USB_SERIAL_EDGEPORT ./drivers/usb/serial/Makefile + +# USB_SERIAL_EDGEPORT_TI - USB Inside Out Edgeport Serial Driver (TI devices) +clean_file drivers/usb/serial/io_fw_boot2.h +clean_file drivers/usb/serial/io_fw_down3.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_EDGEPORT_TI' +clean_mk CONFIG_USB_SERIAL_EDGEPORT_TI ./drivers/usb/serial/Makefile + +# USB_SERIAL_TI - USB TI 3410/5052 Serial Driver +clean_blob drivers/usb/serial/ti_fw_3410.h +clean_blob drivers/usb/serial/ti_fw_5052.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_TI' +clean_mk CONFIG_USB_SERIAL_TI ./drivers/usb/serial/Makefile + +# USB_SERIAL_WHITEHEAT - USB ConnectTech WhiteHEAT Serial Driver +clean_blob drivers/usb/serial/whiteheat_fw.h +clean_kconfig ./drivers/usb/serial/Kconfig 'USB_SERIAL_WHITEHEAT' +clean_mk CONFIG_USB_SERIAL_WHITEHEAT ./drivers/usb/serial/Makefile + + +######################### +# Removed video Drivers # +######################### + +# FB_ASILIANT - Asiliant (Chips) 69000 display support +clean_blob drivers/video/asiliantfb.c +clean_kconfig ./drivers/video/Kconfig 'FB_ASILIANT' +clean_mk CONFIG_FB_ASILIANT ./drivers/video/Makefile + +# FB_CT65550 - Chips 65550 display support +clean_blob drivers/video/chipsfb.c +clean_kconfig ./drivers/video/Kconfig 'FB_CT65550' +clean_mk CONFIG_FB_CT65550 ./drivers/video/Makefile + + +######################### +# Removed Sound Drivers # +######################### + +# SND_CS46XX - Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x +clean_blob sound/pci/cs46xx/cs46xx_image.h +# Blobs containing comments, not recognized by deblob-check +clean_file sound/pci/cs46xx/imgs/cwc4630.h +clean_file sound/pci/cs46xx/imgs/cwcasync.h +clean_file sound/pci/cs46xx/imgs/cwcdma.h +clean_file sound/pci/cs46xx/imgs/cwcsnoop.h +clean_kconfig ./sound/pci/Kconfig 'SND_CS46XX' +# sed -i '/cs46xx\/ \\/d' ./sound/pci/Makefile + +# SND_KORG1212 - Korg 1212 IO +clean_ifdef sound/pci/korg1212/korg1212.c CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL +clean_blob sound/pci/korg1212/korg1212-firmware.h + +# SND_MAESTRO3 - ESS Allegro/Maestro3 +clean_ifdef sound/pci/maestro3.c CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL + +# SND_YMFPCI - Yamaha YMF724/740/744/754 +clean_blob sound/pci/ymfpci/ymfpci_image.h +clean_ifdef sound/pci/ymfpci/ymfpci_main.c CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL + + +############### +# Not Removed # +############### + +# This is not removed in debian nor gnewsense nor do I think +# it should be removed. It's on debian's list to check out +# I think it points at firmware, but doesn't contain any +# (e.g. if you add the file yss225_registers.bin it will use it) +# clean_blob sound/isa/wavefront/wavefront_fx.c + +# VIDEO_STRADIS - Stradis 4:2:2 MPEG-2 video driver +# This just sets a few values and a bunch of zeros. It doesn't look like +# it was done by anything that would have upstream source code. This should +# probably be kept. It's removed in gnewsense, but not even mentioned +# by debian as potential candidate. It is used by stratis.c +# clean_blob drivers/media/video/cs8420.h + +# gnewsense removes drivers/serial/jsm/jsm_neo.c but vanilla version looks ok + +# Not in kernel 2.6.23 +# drivers/scsi/qla2xxx/ql2100_fw.c +# drivers/scsi/qla2xxx/ql2200_fw.c +# drivers/scsi/qla2xxx/ql2300_fw.c +# drivers/scsi/qla2xxx/ql2322_fw.c +# drivers/scsi/qla2xxx/ql2400_fw.c +# drivers/usb/net/kawethfw.h +# sound/isa/sb/sb16/sb16_csp_codecs.h +# sound/oss/yss225.c +# drivers/scsi/53c7xx_d.h_shipped 53c7xx.scr +# sound/pci/cs46xx/imgs/cwcemb80.h + +# Not in kernel 2.6.24 +# drivers/net/dgrs_firmware.c + +# blobs but free source available (source listed 2nd) +# drivers/char/ser_a2232fw.h ser_a2232fw.ax +# drivers/net/ixp2000/ixp2400_rx.ucode ixp2400_rx.uc +# drivers/net/ixp2000/ixp2400_tx.ucode ixp2400_rx.uc +# drivers/net/wan/wanxlfw.inc_shipped wanxlfw.S +# drivers/net/wireless/atmel.c atmel.c +# drivers/scsi/53c700_d.h_shipped 53c700.scr +# drivers/scsi/aic7xxx/aic79xx_seq.h_shipped aic79xx.seq +# drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped aic7xxx.seq +# drivers/scsi/aic7xxx_old/aic7xxx_seq.c aic7xxx.seq +# drivers/scsi/sym53c8xx_2/sym_fw1.h sym_fw1.h +# drivers/scsi/sym53c8xx_2/sym_fw2.h sym_fw2.h +# drivers/usb/serial/keyspan_pda_fw.h keyspan_pda.S +# drivers/usb/serial/xircom_pgs_fw.h xircom_pgs.S + diff --git a/deblob-check b/deblob-check new file mode 100755 index 00000000000..2c5c94e2bd1 --- /dev/null +++ b/deblob-check @@ -0,0 +1,1923 @@ +#! /bin/sh + +# deblob-check version 2008-03-29 $Rev: 3476 $ +# Inspired in gNewSense's find-firmware script. +# Written by Alexandre Oliva + +# Check http://www.fsfla.org/svn/fsfla/software/linux-libre for newer +# versions. + +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +# usage: deblob-check [-S] [-vv] [-s S] [-lDdBbCcXxPpFftVh?H] \ +# [*.tar* patch-* *.patch] + +# Look for too-long undocumented sequences of numbers (generally blobs +# in disguise) in source files. + +# The order of command line flags is significant. Flags given out of +# the order above won't be handled correctly, sorry. + +# -s --sensitivity: must be followed by a blank and a number. +# Specifies the number of consecutive integral or +# character constants that trigger the blob detector. + +# The default sensitivity is 32 constants. + +# The sensitivity, if present, must be the first option. The action +# selection, if present, must be the first argument, except for the +# sensitivity and verbosity. + +# The default can be overridden with one of: + +# -l --list-blobs: list files that contain sequences that match the +# blob detector test and that are not known to be false +# positives. This is the default option. + +# -d --deblob --mark-blobs: print the processed input, replacing +# sequences that match the blob detector test and that +# are NOT known to be false positives with +# /*(DEBLOBBED)*/. + +# -D --cat: print the processed input, as it would have been fed to +# the blob detector script. Use -S to save the sed +# script used to process it, and search for `sedcat:' in +# comments to locate the relevant adaptation points. + +# -b --print-marked-blobs: like -d, but print only the matching +# sequences. + +# -B --print-blobs: like -b, but do not deblob the sequences. + +# -c --print-marked-blobs-with-context: like -b, but try to maximize +# the context around the blobs. This maximization will +# sometimes disregard known false positives, if they +# happen to be contained within the extended match. +# This is probably an indication that the false positive +# matching rule could be improved. + +# -C --print-blobs-with-context: like -B, but try to maximize the +# context around the blobs. + +# -X --print-all-matches: print all blobs, be they known false +# positives or blobs. + +# -x --list-all-matches: list files that contain sequences that appear +# to be blobs, be they known false positives or not. + +# -p --mark-false-positives: print the processed input, replacing +# sequences that match the blob detector test, but that +# are known to be false positives, with /*(DEBLOBBED)*/. + +# -P --list-false-positives: list files that contain false positives. + +# -f --print-marked-false-positives: like -p, but print only the +# matching sequences. + +# -F --print-false-positives: like -f, but do not deblob the sequences. + +# -t --test: run (very minimal) self-test. + +# -V --version: print a version number + +# -h -? -H --help: print short or long help message + + +# debugging options: + +# -S --save-scripts: save scripts and temporary files. + +# -v --verbose: increase verbosity level, for internal debugging. May +# be given at most twice. + +# The exit status is only significant for the --list options: it will +# be true if nothing was found, and false otherwise. + +: # Mark the end of the help message. + +# TODO: + +# - Improve handling of command-line arguments, so as to not make the +# order relevant. + +# - Add an option for the user to feed their own false positive +# patterns. + +# - Add support to recognize known blobs (or other non-Free +# signatures, really), to speed up the scanning of files containing +# blobs, and to avoid attempts to disguise blobs. + +# - Factor out the code in the various print_* and list_* parts of the +# sed script, at least in the shell sources. Make sure they're all +# included and expanded in a saved --cat script though. + +# - Add support for file name tagging in patterns, such that blobs or +# false positives are recognized only when handling the specific +# filename, be it stand-alone, as part of a patch or a tarball. This +# should help avoid recognition of actual blobs as false positives +# just because there's a symbol with a different name elsewhere. + +# It is convenient that the patterns provided by the user to +# recognize file names can be empty (for backward compatibility), but +# this should ideally be phased out in favor of more precise matches. +# It's important that files can be recognized with leading tarball or +# patch names, that the filename used within the tarball contain +# leading garbage, and even that a partial pathname be recognizable +# (say recognize drivers/net/whatever.c when the input file is named +# ../net/whatever.c). + +# Rather than using regular expressions to recognize multiple files +# it's convenient (but not quite essential) that filename patterns be +# specifiable as regular expressions, rather than simple filenames, +# but there are other ways around this. + +# Maintaining begin/end markers in a stack-like fashion as part of +# the processed stream, and using the names in them as (optional) part +# of the recognition patterns, would enable us to do it. + +# Introducing annotations next to the false positives (and recognized +# blobs) as an early part of the process may speed things up and +# enable fast processing, but how to introduce the annotations quickly +# in the first place? Given patterns such as + +# \(\(file1\)\(.*\)\(pat1\)\|\(file2\)\(.*\)\(pat2\)\|...\) + +# how do we get sed to introduce a marker that contains file2 right +# before or right after pat2, without turning a big efficient regexp +# into a slowish sequence of s/// commands? + +# - Re-check and narrow false-positive patterns to make sure they +# apply only to the relevant content. + +# - Scripting abilities, so as to be able to automate the removal of +# source files or of blobs from source files in a tarball without +# having to extract the entire tarball (as in tar --update/--delete) +# would be nice. Carrying over removed files automatically into +# patches would also be great, and this sort of script would be +# perfect to document what has been done to a tarball plus a set of +# patches. Something like deblob.script: +# +# tarball linux-2.6.24.tar.bz2 +# delete net/wireloss/freedom.c drivers/me/crazy.c +# deblob include/linux/slab-blob-kfree.h +# deconfig drivers/char/drm DRM_IS_BAD +# +# patch patch-2.6.25-rc7.bz2 +# delete arch/power/over/you.c + +# such that the deletes from an earlier file would carry over into the +# subsequent ones, and new tarballs and patch files would be generated +# with the libre- prefix in their basename, and the xdeltas between +# the original files and the modified files would be minimal, and +# redundant with this script and the input script while at that. + +# - Improve documentation of the code. + +# - Write a decent testsuite. + +# - Insert your idea here. :-) + +# Yeah, lots of stuff to do. Want to help? + +# This makes it much faster, and mostly immune to non-ASCII stuff, as +# long as a 8-bit-safe sed is used. Probably a safe assumption these +# days. +case ${LANG+set} in set) LANG=C; export LANG;; esac + +rm="rm -f" +case $1 in +--save-scripts | -S) + shift + rm="echo preserving" + ;; +esac + +# Choose verbosity level for sed script debugging and performance +# analysis. +case $1 in +--verbose | -v) + shift + case $1 in + --verbose | -v) + shift + v="i\\ +: +p; +i\\ +" + ;; + *) + v="P;i\\ +" + ;; + esac + ;; +*) + v="# " + ;; +esac + +sens=31 # 32 - 1 +case $1 in +--sensitivity | -s) + sens=$2; + shift 2 || exit 1 + + if test "$sens" -gt 0 2>/dev/null; then + : + else + echo invalid sensitivity: $sens >&2 + exit 1 + fi + + sens=`expr $sens - 1` + ;; +esac + +test_mode=false + +name=deblob-check + +case $1 in +--version | -V) + sed '/^# '$name' version /,/^# Written by/ { s/^# //; p; }; d' < $0 + exit 0 + ;; + +-\? | -h) + sed -n '/^# usage:/,/# -h/ { /^# -/,/^$/{s/^# \(-.*\):.*/\1/p; d; }; s/^\(# \?\)\?//p; }' < $0 && + echo + echo "run \`$name --help | more' for full usage" + exit 0 + ;; + +--help | -H) + sed -n '/^# '$name' version /,/^[^#]/ s/^\(# \?\)\?//p' < $0 + exit 0 + ;; + +--test | -t) + test_mode=: + ;; + +--mark-false-positives | -p) + shift; + set_sed_cmd () { + set_sedmain "b list_both;" "p;" "b list_matches;" + } + ;; + +--print-marked-false-positives | -f) + shift; + set_sed_cmd () { + set_sedmain "b print_marked_matches;" "" "b print_marked_matches;" + } + ;; + +--print-false-positives | -F) + shift; + set_sed_cmd () { + set_sedmain "b print_matches;" "" "b print_matches;" + } + ;; + +--deblob | --mark-blobs | -d) + shift; + set_sed_cmd () { + set_sedmain "b list_blobs;" "p;" "p;" + } + ;; + +--cat | -D) + shift; + set_sed_cmd () { + set_sedmain \ + "# sedcat: Actual blob detected, but there may be false positives." \ + "# sedcat: No blob whatsoever found." \ + "# sedcat: False positives found." \ + "p; d; # sedcat: Just print stuff, remove this line to run the actual script." + } + ;; + +--print-marked-blobs | -b) + shift; + set_sed_cmd () { + set_sedmain "b print_marked_blobs;" + } + ;; + +--print-blobs | -B) + shift; + set_sed_cmd () { + set_sedmain "b print_blobs;" + } + ;; + +--print-marked-blobs-with-context | -c) + shift; + set_sed_cmd () { + set_sedmain "b print_marked_cblobs;" + } + ;; + +--print-blobs-with-context | -C) + shift; + set_sed_cmd () { + set_sedmain "b print_cblobs;" + } + ;; + +--list-false-positives | -P) + shift; + set_sed_cmd () { + set_sedmain "" "" " +i\\ +$file +q 1;" + } + ;; + +--list-all-matches | -x) + shift; + set_sed_cmd () { + set_sedmain " +i\\ +$file +q 1;" "" " +i\\ +$file +q 1;" + } + ;; + +--print-all-matches | -X) + shift; + set_sed_cmd () { + set_sedmain "b print_both;" "" "b print_matches;" + } + ;; + +*) + case $1 in + -- | -l | --list-blobs) shift;; + esac + case $1 in + -*) + if test ! -f "$1"; then + echo "$name: \`$1' given too late or out of the proper sequence." >&2 + echo "$name: The order of arguments is significant, see the usage." >&2 + exit 1 + fi + ;; + esac + + set_sed_cmd () { + set_sedmain " +i\\ +$file +q 1;" + } + ;; + +esac + +case $1 in +--) shift;; +esac + +if $test_mode; then + pass=: + + # Exercise some nasty inputs to see that we recognize them as blobs + # with full context. + for string in \ + "1,2,3,4" \ + "= { +1, 0x2, 03, L'\x4' +}" \ + "= +{ + '\\x1', '\\002' + , + { + { \"\\x3\", }, + \"\\004\" + }, +};" \ + ".long 1,2 + .long \$3,\$4" \ + "#define X { 1, 2, \\ + 3, 4, /* comment */ \\ + }" \ + "= { +/* + * multi-line + * comment + */ + { + 0x4c00c000, 0x00000000, 0x00060000, 0x00000000, + }, +}" \ + ; do + case `echo "$string" | $0 -s 4 -c` in + "::: - ::: +$string") ;; + *) echo "failed positive test for: +$string" >&2 + pass=false;; + esac + done + + # Make sure we do not recognize these as blobs. + for string in \ + "#define X { 1, 2 } +#define Y { 3, 4 }" \ + " 0x00, 0x00, 0x00 " \ + ; do + case `echo "$string" | $0 -s 4` in + "") ;; + *) echo "failed negative test for: +$string" >&2 + pass=false;; + esac + done + + # How did we do? + if $pass; then + echo success + fi + + $pass + exit +fi + +# Call addx as needed to set up more patterns to be recognized as +# false positives. Takes the input filename in $1. + +set_except () { + # Look for a multi-line definition starting with a line that matches + # $1 (implicitly anchored to the beginning of the line), and ending + # at the first ';'. + initnc () { + addx "$1[^;]*;" + } + + # Look for a multi-line definition starting with a line that matches + # $1 (implicitly anchored to the beginning of the line), and ending + # at the first ';' that's not within comments. + initc () { + addx "$1\\([^;]*\\|$comment\\)*;" + } + + # Accept as a non-blob an expression $1 that would have otherwise + # triggered blob detection. The expression must end in a way that + # would trigger the blob detection machinery. + accept () { + addx "$1" + } + + # Match up to the end a comment started in $1. + ocomment () { + addx "$1\\([^*]\\|[*][*]*[^*/]\\|[*]*[\\n]\\)*[*]*[*][/]" + } + + # Match $1 followed by backslash-terminated lines and a last + # non-backslash-terminated line. + oprepline () { + addx "$1\\([^\\n]*\\\\[\\n]\\)*[^\\n\\\\]*$eol" + } + + case /$1 in + /drivers/net/tg3.c) + # This file contains firmwares that we deblob with high + # sensitivity, so make sure the sequences of numbers that are not + # blobs are not deblobbed. FIXME: we should have patterns to + # recognize the blobs instead. + initnc ' static const u32 test_pat\[4\]\[6\] =' + initnc ' }, mem_tbl_5705\[\] =' + ;; + */*linux*.tar* | */*kernel*.tar* | */*linux-*.*.*/*) + # false alarms, contain source + # drivers/net/wan/wanxlfw.inc_shipped -> wanxlfw.S + accept 'static u8 firmware\[\]={[\n]0x60,\(0x00,\)*0x16,\(0x00,\)*\([\n]\(0x[0-9A-F][0-9A-F],\)*\)*[\n]0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC,\([\n]\(0x[0-9A-F][0-9A-F],\)*\)*0x00[\n]};' + # drivers/usb/serial/xircom_pgs_fw.h -> xircom_pgs.S + initnc 'static const struct ezusb_hex_record xircom_pgs_firmware\[\] =' + # drivers/usb/serial/keyspan_pda_fw_h -> keyspan_pda.S + initnc 'static const struct ezusb_hex_record keyspan_pda_firmware\[\] =' + # arch/m68k/ifpsp060/*.sa -> src/*.s + accept ' \.long 0x60ff0000,0x02360000,0x60ff0000,0x16260000[\n]'"$sepx$blobpat*" + accept ' \.long 0x60ff0000,0x17400000,0x60ff0000,0x15f40000[\n]'"$sepx$blobpat*" + # arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped -> spu_save.c + initnc 'static unsigned int spu_save_code\[\] __attribute__((__aligned__(128))) =' + # arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped -> spu_restore.c + initnc 'static unsigned int spu_restore_code\[\] __attribute__((__aligned__(128))) =' + # drivers/net/ixp2000/ixp2400_tx.ucode -> ixp2400_tx.uc + initnc ' \.initial_reg_values = (struct ixp2000_reg_value \[\]) {' + # drivers/net/ixp2000/ixp2400_rx.ucode -> ixp2400_rx.uc + initnc ' \.initial_reg_values = (struct ixp2000_reg_value \[\]) {' + # crypto/tcrypt.h + initnc '[ ]*\.\(digest\|entries\|input\|key\|output\|plaintext\|result\)[ ]*= {' + + # checked: + + accept ' \$3 = {{pge = {{ste = {\(\([0-9][0-9a-fx{},\n ]*\|\(pge\|ste\) =\|\)[{},\n ]*\)*}'"$eol" + # arch/sparc/lib/divdi3.S + accept '__clz_tab:[\n] \.byte 0\(,[0-5]\)\+'"$sepx$blobpat*" + accept 'PITBL:[\n] \.long 0xC0040000,0xC90FDAA2,'"$blobpat*" + # arch/m68k/mac/mac_penguin.S + accept '\(0x[0F][0F],\)\+\\[\n]\(\(0x[0F][0F],\)\+\\[\n]\)*\(0x[0F][0F],\)\+0x00' + # arch/s390/kernel/head.S + accept '\.lowcase:[\n] \.byte 0x00\(,0x0[1-7]\)\+'"$sepx$blobpat*$eol" + # arch/s390/kernel/bitmap.S + accept '_zb_findmap:[\n] \.byte 0\(,[123],0\)\+,4'"$sepx$blobpat*$eol" + accept '_sb_findmap:[\n] \.byte 8\(,0,[123]\)\+,0'"$sepx$blobpat*$eol" + # arch/powerpc/lib/copyuser_64.S + accept ' \.section __ex_table,"a"'"$sepx$blobpat*" + # arch/powerpc/platforms/iseries/mf.c + accept ' memcpy(src, "\\x01\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00".*PROGxxxx' + # arch/ppc/platforms/ev64260.c + initnc 'static const unsigned int cpu_745x\[2\]\[16\] =' + # arch/alpha/lib/fls.c + initnc 'const unsigned char __flsm1_tab\[256\] =' + # drivers/input/misc/map_to_7segment.h + accept '#define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \\[\n] \(0,\)\+'"$eol" + # sound/oss/ad1848.c + initc ' static int init_values_b\[\] =' + # drivers/input/keyboard/atkbd.c + initnc 'static unsigned char atkbd_set2_keycode\[512\] =' + # drivers/usb/serial/keyspan_pda.S and + # drivers/usb/serial/xircom_pgs.S + accept 'desc_config1:[\n] \.byte 0x09, 0x02'"$sepx$blobpat*" + accept 'string_mfg:[\n]\?\(;\? \.byte[^\n]*[\n]\)\+string_mfg_end:' + accept 'string_product:[\n]\?\(;\? \.byte[^\n]*[\n]\)\+string_product_end:' + # drivers/media/video/pwc/pwc-nala.h + accept ' [/][*] \(SQCIF\|QSIF\|QCIF\|SIF\|CIF\|VGA\) [*][/][\n] {[\n] {'"$blobpat*" + # drivers/video/logo/*.ppm + accept 'P[13]\([\n]#[^\n]*\)*[\n]*\([\n][0-9 ]*\)\+' + # Documentation/specialix.txt + accept 'for i in [ 0-9\\\n]*[\n]do' + # Documentation/cpu-freq/cpufreq-stats.txt + accept ' : 3600000 3400000 3200000 3000000 2800000 ' + # Documentation/scsi/sym53c8xx_2.txt and + # Documentation/scsi/ncr53c8xx_2.txt + accept '00 00[\n]64 01[\n]8e 0b[\n][\n][0-9a-f \n]*fe fe' + accept '0f 00 08 08 64 00 0a 00 - id 0[\n]'"$blobpat*" + accept 'default nvram data:'"$sepx$blobpat*" + # Documentation/video4linux/sn9c102.txt + accept '0x0458 0x7025[\n]'"$blobpat*" + # Documentation/video4linux/et61x251.txt + accept '0x102c 0x6151[\n]'"$blobpat*" + # Documentation/video4linux/zc0301.txt + accept '0x041e 0x4017[\n]'"$blobpat*" + # Documentation/uml/UserModeLinux-HOWTO.txt + accept ' (gdb) x\/100x \$25[\n] 0x507d2434: 0x507d2434 0x00000000 0x08048000 0x080a4f8c'"$sepx$blobpat*" + # Documentation/isdn/README.inc + accept ' 1 0 0 0 0x308'"$sepx$blobpat*" + # Documentation/sched-stats.txt + accept 'domain 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'"$eol" + # net/ipv4/ipvs/ip_vs_sync.c and + # net/sctp/sm_make_chunk.c and + # include/linux/sctp.h + accept '[ * ]*0 1 2 3[\n][ * ]*0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1' + # arch/x86/lguest/boot.c + accept ' \* 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' + # drivers/net/fealnx.c + ocomment ' [/][*] Configure the PCI bus bursts and FIFO thresholds.' + # drivers/hwmon/via686a.c + ocomment '[/][*] the original LUT values from Alex van Kaam ' + # drivers/media/video/saa7114.c + initc 'static const unsigned char init\[\] = {[^;]*MODE=0 ;.*SAA_7114_NTSC_HSYNC_START' + + # in 2.6.23 only + accept " Psize Ipps Tput Rxint Txint Done Ndone[\\n] ---------------------------------------------------------------\\([\\n][ 0-9]\\+\\)\\+$eol" + initnc 'static u_short ataplain_map\[NR_KEYS\] __initdata =' + initnc 'static RegInitializer initData\[\] __initdata =' + initnc ' static const unsigned char invert5\[\] =' + initnc 'static unsigned char alpa2target\[\] =' + initnc 'static unsigned char target2alpa\[\] =' + oprepline '#define INIT_THREAD [{0},]\+[ ]*\\[ ]*[{0},]\+' + initnc 'static uint tas300\(1c\|4\)_\(master\|mixer\|treble\|bass\)_tab\[\]=' + initnc 'static short dmasound_[au]law2dma16\[\] =' + initnc 'static const unsigned short DACVolTable\[101\] =' + + # new in 2.6.25 + accept "%canned_values = ([\\n] \\([0-9]\\+ => \\[[ \\n]\\+\\(\\([0-9]\\+\\|'0x[0-9a-f]\\+'\\),[ \\n]*\\)*\\]\\(, \\|[\\n]\\)\\)*);" + + # from 2.6.25-rc* patches + initnc ' int bcomm_irq\[3\*16\] =' + initnc ' static const int8 countLeadingZerosHigh\[\] =' + initnc 'static struct nic_qp_map nic_qp_mapping_[01]\[\] =' + initnc 'static struct regval ov_initvals\[\] =' + initnc 'static struct regval stk1125_initvals\[\] =' + initnc 'static u8 bnx2x_stats_len_arr\[BNX2X_NUM_STATS\] =' + initnc 'static const struct arb_line read_arb_data\[NUM_RD_Q\]\[MAX_RD_ORD + 1\] =' + initnc 'static const struct arb_line write_arb_data\[NUM_WR_Q\]\[MAX_WR_ORD + 1\] =' + oprepline '#define AR5K_RATES_11A ' + oprepline '#define AR5K_RATES_11B ' + oprepline '#define AR5K_RATES_11G ' + oprepline '#define AR5K_RATES_TURBO ' + oprepline '#define AR5K_RATES_XR ' + initnc ' } blinkrates\[\] =' + initnc 'static const struct ath5k_ini ar5212_ini\[\] =' + initnc 'static const struct ath5k_ini_mode rf5413_ini_mode_end\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5111\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5112\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5112a\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5413\[\] =' + initnc 'const u\(8\|16\|32\) b43_ntab_\(\(adjustpower\|estimatepowerlt\|gainctl\|iqlt\|loftlt\|noisevar1\|tdi[24]0a\)[01]\|channelest\|frame\(lookup\|struct\)\|mcs\|pilot\|tdtrn\|tmap\)\[\] =' + + # quite suspicious + # arch/parisc/kernel/perf_images.h + initc 'static uint32_t onyx_images\[\]\[PCXU_IMAGE_SIZE\/sizeof(uint32_t)\] __read_mostly =' + initc 'static uint32_t cuda_images\[\]\[PCXW_IMAGE_SIZE\/sizeof(uint32_t)\] __read_mostly =' + + # These are regarded as ok + initnc 'static const u8 SN9C102_\(Y\|UV\)_QTABLE[01]\[64\] = {' + initnc ' static const u8 jpeg_header\[589\] = {' + accept '[ ]\{1,2\}err = sn9c102_write_const_regs(cam\(,[ \n]\+{0x[0-9a-fA-F][0-9a-fA-F], 0x[0-9a-fA-F][0-9a-fA-F]}\)*);' + + # too lax? + initnc 'static yyconst flex_int\(16\|32\)_t yy_[^[]*\[[][0-9]*\] =' + initnc 'static const \(yytype_u\?int\(8\|16\)\|unsigned \(short\( int\)\?\|char\)\) yy[^[]*\[\] =' + initnc '\(\| \)static \(const \|\)\(unsigned \(short\|char\)\|struct SiS_[^ ]*\) SiS[^[]*\(\[[] [*0-9]*\]\)\+ *=' + + initnc 'static const a3d_Hrtf_t A3dHrirZeros = {' + initnc 'static const a3d_Hrtf_t A3dHrirImpulse = {' + initnc 'static const a3d_Hrtf_t A3dHrirOnes = {' + initnc 'static const a3d_Hrtf_t A3dHrirSatTest = {' + initnc 'static const a3d_Hrtf_t A3dHrirDImpulse = {' + initnc 'static const a3d_ItdDline_t A3dItdDlineZeros = {' + initnc 'static auxxEqCoeffSet_t asEqCoefsNormal = {' + initnc 'static xtalk_dline_t const alXtalkDlineTest = {' + initnc 'static struct nand_ecclayout rtc_from4_nand_oobinfo = {' + initnc 'static const s16 tempLUT\[\] =' + initnc 'static const u8 viaLUT\[\] =' + initnc 'static struct { int xres, yres, left, right, upper, lower, hslen, vslen, vfreq; } timmings\[\] __initdata = {' + initnc 'static struct platinum_regvals platinum_reg_init_[0-9]* = {' + initnc '} sisfb_ddc[sf]modes\[\] __devinitdata =' + initnc 'static struct dvb_pll_desc [^\n]* = {' + initnc 'static u32 LABELPATCHES\[\] __attribute((unused)) =' + + initnc 'static dbdev_tab_t dbdev_tab\[\] =' + accept '\(EXP\|LOG\|ATAN\)TBL:'"$sepx$blobpat*" + initnc 'static char fm_volume_table\[128\] =' + initnc 'unsigned int snd_gf1_scale_table\[SNDRV_GF1_SCALE_TABLE_SIZE\] =' + # remaining after original deblob_2_6_24, not fully checked + + oprepline '#define OV51[18]_\(Y\|UV\)QUANTABLE {' + initnc ' static unsigned char const data_bit\[64\] =' + initnc ' static const u8 data_sbit\[32\] =' + initnc ' \.RightCoefs =' + initnc ' #define WakeupSeq {' + initnc ' SetRate44100\[\] =' + initnc ' const short period\[32\] =' + initnc ' const static int desc_idx_table\[\] =' + initnc ' int prop_bcomm_irq\[3\*16\] =' + initnc ' static char logSlopeTable\[128\] =' + initnc ' static const int uc_\(dup\|word\)_table\[\]\[2\] =' + initnc ' static const struct mc7_timing_params mc7_timings\[\] =' + initnc ' static const u8 biphase_tbl\[\] =' + initnc ' static const u8 cs170\[7 \* 8\] =' + initnc ' static const u8 cs3[13]a\[8 \* 4\] =' + initnc ' static const u8 dramsr13\[12 \* 5\] =' + initnc ' static const u8 log10\[\] =' + initnc ' static const u8 mpeg_hdr_data\[\] =' + initnc ' static const u8 sdramtype\[13\]\[5\] =' + initnc ' static const u8 t\[\] =' + initnc ' static const unsigned int avg_pkts\[NCCTRL_WIN\] =' + initnc ' static const unsigned short ac97_defaults\[\] =' + initnc ' static int exp_lut\[256\] =' + initnc ' static u16 jpeg_tables\[\]\[70\] =' + initnc ' static u16 tables\[\] =' + initnc ' static u32 logMagTable\[128\] =' + initnc ' static u8 init_bufs\[13\]\[5\] =' + initnc ' static u8 sine \[\] =' + initnc ' static u_short geometry_table\[\]\[[45]\] =' + initnc ' static unsigned char CRCTable1\[\] =' + initnc ' static unsigned char CRCTable2\[\] =' + initnc ' static unsigned char default_colors\[\] =' + initnc ' static unsigned char iso_regs\[8\]\[4\] =' + initnc ' static unsigned char log_scale\[101\] =' + initnc ' static unsigned char msg\[\] =' + initnc ' static unsigned char static_pad\[\] =' + initnc ' static unsigned char table_alaw2ulaw\[\] =' + initnc ' static unsigned char table_ulaw2alaw\[\] =' + initnc ' u32 reg_boundaries\[\] =' + initnc ' u8 b\[\] =' + initnc ' uint8_t tx\[\] =' + initnc ' unsigned char saa7111_regs\[\] =' + initnc ' unsigned char sas_pcd_m_pg\[\] =' + initnc ' } modedb\[5\] =' + initnc ' } reg_tbl\[\] =' + initnc ' } vals\[\] =' + initnc ' } vm_devices\[\] =' + initnc ' static const code distfix\[32\] =' + initnc ' static const code lenfix\[512\] =' + initnc ' int poly\[\]=' + initnc ' static const unsigned char asso_values\[\] =' + initnc ' static unsigned char asso_values\[\] =' + initnc ' } cards_ds\[\] =' + initnc ' static const int8 countLeadingZerosHigh\[\] =' + initnc ' static const unsigned short d\(base\|ext\)\[32\] =' + initnc '#define OV511_QUANTABLESIZE 64' + initnc 'BYTE BtCard::SRAMTable_\(NTSC\|PAL\)\[\] =' + initnc 'BYTE SRAMTable\[\]\[ 60 \] =' + accept 'irq_prio_[hdlc]*:'"$sepx$blobpat*" + initc '__u8 _ascebc\[256\] =' + initc '__u8 _ebc_tolower\[256\] =' + initc '__u8 _ebc_toupper\[256\] =' + initnc 'adapter_tag_info_t aic7[9x]xx_tag_info\[\] =' + initnc 'char dmasound_alaw2dma8\[\] =' + initnc 'char dmasound_ulaw2dma8\[\] =' + initnc 'const struct aper_size_info_16 agp3_generic_sizes\[AGP_GENERIC_SIZES_ENTRIES\] =' + initnc 'const u16 crc_itu_t_table\[256\] =' + initnc 'const u8 byte_rev_table\[256\] =' + initnc 'const u8 crc7_syndrome_table\[256\] =' + initnc 'const unsigned char INIT_2\[127\] =' + initnc 'int snd_sf_vol_table\[128\] =' + initnc 'static u_char irq_to_siubit\[\] =' + initnc 'static u_char irq_to_siureg\[\] =' + initnc 'static Byte_t RData\[RDATASIZE\] =' + initnc 'static __const__ __u16 gx_coeff\[256\] =' + initnc 'static __u8 init7121ntsc\[\] =' + initnc 'static __u8 init7121pal\[\] =' + initnc 'static __u8 mode8420\(pro\|con\)\[\] =' + initnc 'static byte capidtmf_leading_zeroes_table\[0x100\] =' + initnc 'static char channel_map_madi_ss\[HDSPM_MAX_CHANNELS\] =' + initnc 'static char coefficients\[NM_TOTAL_COEFF_COUNT \* 4\] =' + initnc 'static char ecc_syndrome_table\[\] =' + initnc 'static char isdn_audio_alaw_to_ulaw\[\] =' + initnc 'static char isdn_audio_ulaw_to_alaw\[\] =' + initnc 'static char mix_cvt\[101\] =' + initnc 'static char opl3_volume_table\[128\] =' + initnc 'static const RegInitializer initData\[\] __initdata =' + initnc 'static const __u16 crc10_table\[256\] =' + initnc 'static const __u32 crc_c\[256\] =' + initnc 'static const char zr360[56]0_dht\[0x1a4\] =' + initnc 'static const char zr360[56]0_dqt\[0x86\] =' + initnc 'static const fixp_t cos_table\[46\] =' + initnc 'static const int init_seq\[\] =' + initnc 'static const int mobile_vid_table\[32\] =' + initnc 'static const s16 snd_opl4_pitch_map\[0x600\] =' + initnc 'static const s8 \(b43\(\|legacy\)\|bcm43xx\)_tssi2dbm_[bg]_table\[\] =' + initnc 'static const s8 budtab\[256\] =' + initnc 'static const struct aper_size_info_32 u3_sizes\[8\] =' + initnc 'static const struct aper_size_info_8 via_generic_sizes\[9\] =' + initnc 'static const struct color clut_vga16\[16\] =' + initnc 'static const struct gain_entry gain_table\[2\]\[108\] =' + initnc 'static const struct mV_pos __initdata mobilevrm_mV\[32\] =' + initnc 'static const struct mV_pos __initdata vrm85_mV\[32\] =' + initnc 'static const struct menelaus_vtg_value vcore_values\[\] =' + initnc 'static const struct opl4_region regions_[0-9a-frums]*\[\] =' + initnc 'static const struct regval regval_table\[\] =' + initnc 'static const struct rf_channel rf_vals_5222\[\] =' + initnc 'static const struct rf_channel rf_vals_5225_2527\[\] =' + initnc 'static const struct rf_channel rf_vals_5226\[\] =' + initnc 'static const struct rf_channel rf_vals_bg\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2522\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2523\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2524\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2525\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2525e\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2528\[\] =' + initnc 'static const struct rf_channel rf_vals_noseq\[\] =' + initnc 'static const struct rf_channel rf_vals_seq\[\] =' + initnc 'static const u16 Sbox\[256\] =' + initnc 'static const u16 count_lut\[\] =' + # drivers/net/e1000e/phy.c + initnc 'static const u16 e1000_igp_2_cable_length_table\[\] =' + initnc 'static const u16 rtl8225bcd_rxgain\[\] =' + initnc 'static const u16 rtl8225z2_rxgain\[\] =' + initnc 'static const u16 stufftab\[5 \* 256\] =' + initnc 'static const u16 tkip_sbox\[256\] =' + initnc 'static const u16 wm8753_reg\[\] =' + initnc 'static const u32 SS[0-3]\[256\] =' + initnc 'static const u32 S[1-8]\[64\] =' + initnc 'static const u32 T[0-5]\[256\] =' + initnc 'static const u32 Tm\[24\]\[8\] =' + initnc 'static const u32 bass_table\[41\]\[5\] =' + initnc 'static const u32 bf_sbox\[256 \* 4\] =' + initnc 'static const u32 camellia_sp0222\[256\] =' + initnc 'static const u32 camellia_sp1110\[256\] =' + initnc 'static const u32 camellia_sp3033\[256\] =' + initnc 'static const u32 camellia_sp4404\[256\] =' + initnc 'static const u32 crc32c_table\[256\] =' + initnc 'static const u32 db_table\[101\] =' + initnc 'static const u32 m8xx_size_to_gray\[M8XX_SIZES_NO\] =' + initnc 'static const u32 mds\[4\]\[256\] =' + initnc 'static const u32 pc2\[1024\] =' + initnc 'static const u32 s[1-7]\[256\] =' + initnc 'static const u32 sb8\[256\] =' + initnc 'static const u32 tfrc_calc_x_lookup\[TFRC_CALC_X_ARRSIZE\]\[2\] =' + initnc 'static const u32 treble_table\[41\]\[5\] =' + initnc 'static const u64 [CT][0-7]\[256\] =' + initnc 'static const u64 sbox[1-4]\[256\] =' + initnc 'static const u64 sha512_K\[80\] =' + initnc 'static const u8 Tr\[4\]\[8\] =' + initnc 'static const u8 aes_sbox\[256\] =' + initnc 'static const u8 calc_sb_tbl\[512\] =' + initnc 'static const u8 exp_to_poly\[492\] =' + initnc 'static const u8 legal_ansi_char_array\[0x40\] =' + initnc 'static const u8 parity\[\] =' + initnc 'static const u8 pc1\[256\] =' + initnc 'static const u8 poly_to_exp\[255\] =' + initnc 'static const u8 q[01]\[256\] =' + initnc 'static const u8 ratio_lut\[\] =' + initnc 'static const u8 rs\[256\] =' + initnc 'static const u8 rtl8225_agc\[\] =' + initnc 'static const u8 rtl8225_tx_power_cck\[\] =' + initnc 'static const u8 rtl8225_tx_power_cck_ch14\[\] =' + initnc 'static const u8 rtl8225z2_tx_gain_cck_ofdm\[\] =' + initnc 'static const u8 setup\[\] =' + initnc 'static const u8 speedtab \[3\]\[12\] =' + initnc 'static const u_char irq_to_siubit\[\] =' + initnc 'static const u_char irq_to_siureg\[\] =' + initnc 'static const u_char nand_ecc_precalc_table\[\] =' + initnc 'static const uint8_t parity\[256\] =' + initnc 'static const unsigned char \(UV\|Y\)_QUANTABLE\[64\] =' + initnc 'static const unsigned char __initdata mV_mobilevrm\[32\] =' + initnc 'static const unsigned char __initdata mV_vrm85\[32\] =' + initnc 'static const unsigned char barco_p1\[2\]\[9\]\[7\]\[3\] =' + initnc 'static const unsigned char bitcounts\[256\] =' + initnc 'static const unsigned char blue\[256\] =' + initnc 'static const unsigned char chktab[hl]\[256\] =' + initnc 'static const unsigned char comet_miireg2offset\[32\] =' + initnc 'static \(const \)\?unsigned char euc2sjisibm_g3upper_map\[\]\[2\] =' + initnc 'static const unsigned char green\[256\] =' + initnc 'static const unsigned char hash_table_ops\[64\*4\] =' + initnc 'static const unsigned char hid_keyboard\[256\] =' + initnc 'static const unsigned char mts_direction\[256\/8\] =' + initnc 'static const unsigned char red\[256\] =' + initnc 'static \(const \)\?unsigned char sjisibm2euc_map\[\]\[2\] =' + initnc 'static const unsigned char vol_cvt_datt\[128\] =' + initnc 'static const unsigned char wm_vol\[256\] =' + initnc 'static const unsigned int MulIdx\[16\]\[16\] =' + initnc 'static const unsigned int crctab32\[\] =' + initnc 'static const unsigned short crc_flex_table\[\] =' + initnc 'static const unsigned short logtable\[256\] =' + initnc 'static const unsigned short wd7000_iobase\[\] =' + initnc 'static const unsigned short x86_keycodes\[256\] =' + initnc 'static const unsigned table\[\] =' + initnc 'static int MV300_reg_8bit\[256\] =' + initnc 'static int fifo_map\[\]\[MAX_TX_FIFOS\] =' + initnc 'static int initial_lfsr\[\] =' + initnc 'static int log_tbl\[129\] =' + initnc 'static int logitech_expanded_keymap\[LOGITECH_EXPANDED_KEYMAP_SIZE\] =' + initnc 'static int miro_fmtuner\[\] =' + initnc 'static int miro_tunermap\[\] =' + initnc 'static int register_size\[\] =' + initnc 'static int reserve_list\[MAX_RES_ARGS\] =' + initnc 'static int reverse6\[64\] =' + initnc 'static short attack_time_tbl\[128\] =' + initnc 'static short beep_wform\[256\] =' + initnc 'static short decay_time_tbl\[128\] =' + initnc 'static short isdn_audio_[ua]law_to_s16\[\] =' + initnc 'static struct cipher_testvec anubis_cbc_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec anubis_cbc_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec anubis_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec anubis_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec camellia_cbc_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec camellia_cbc_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec camellia_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec camellia_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec cast6_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec cast6_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec serpent_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec serpent_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec tea_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec tea_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec tf_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec tf_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec tnepres_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec xeta_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec xeta_enc_tv_template\[\] =' + initnc 'static struct cipher_testvec xtea_dec_tv_template\[\] =' + initnc 'static struct cipher_testvec xtea_enc_tv_template\[\] =' + initnc 'static struct comp_testvec deflate_decomp_tv_template\[\] =' + initnc 'static struct hash_testvec aes_xcbc128_tv_template\[\] =' + initnc 'static struct hash_testvec crc32c_tv_template\[\] =' + initnc 'static struct hash_testvec hmac_sha256_tv_template\[\] =' + initnc 'static struct hash_testvec sha256_tv_template\[\] =' + initnc 'static struct hash_testvec sha384_tv_template\[\] =' + initnc 'static struct hash_testvec sha512_tv_template\[\] =' + initnc 'static struct hash_testvec wp256_tv_template\[\] =' + initnc 'static struct hash_testvec wp384_tv_template\[\] =' + initnc 'static struct hash_testvec wp512_tv_template\[\] =' + initnc 'static struct iwl\(3945\)\?_tx_power power_gain_table\[2\]\[IWL_MAX_GAIN_ENTRIES\] =' + initnc 'static struct ovcamchip_regvals regvals_init_\(76be\|7[16]20\|7x10\)\[\] =' + initnc 'static struct regval_list ov7670_default_regs\[\] =' + initnc 'static struct s_c2 SetRate48000\[\] =' + initnc 'static struct tea6420_multiplex TEA6420_line\[MXB_AUDIOS+1\]\[2\] =' + initnc 'static struct wm_info i810_wm_16_100\[\] =' + initnc 'static struct wm_info i810_wm_16_133\[\] =' + initnc 'static struct wm_info i810_wm_24_100\[\] =' + initnc 'static struct wm_info i810_wm_24_133\[\] =' + initnc 'static struct wm_info i810_wm_8_100\[\] =' + initnc 'static struct wm_info i810_wm_8_133\[\] =' + initnc 'static struct { struct fb_bitfield red, green, blue, transp; int bits_per_pixel; } colors\[\] =' + initnc 'static u16 asEqCoefsPipes\[64\] =' + initnc 'static u16 asEqCoefsZeros\[50\] =' + initnc 'static u16 asEqOutStateZeros\[48\] =' + initnc 'static u16 default_key_map \[256\] =' + initnc 'static u16 eq_levels\[64\] =' + initnc 'static u32 crc32tab\[\] __attribute__ ((aligned(8))) =' + initnc 'static u32 ac3_frames\[3\]\[32\] =' + initnc 'static u32 adwDecim8\[33\] =' + initnc 'static u32 h_prescale\[64\] =' + initnc 'static u32 v_gain\[64\] =' + initnc 'static u8 cvs_time_value\[\]\[XFER_UDMA_6 - XFER_UDMA_0 + 1\] =' + initnc 'static u8 SRAM_Table\[\]\[60\] =' + initnc 'static u8 act_time_value\[\]\[8\] =' + initnc 'static u8 alps_tdee4_stv0297_inittab\[\] =' + initnc 'static u8 bnx2_5706_stats_len_arr\[BNX2_NUM_STATS\] =' + initnc 'static u8 bnx2_5708_stats_len_arr\[BNX2_NUM_STATS\] =' + initnc 'static u8 flit_desc_map\[\] =' + initnc 'static u8 ini_time_value\[\]\[8\] =' + initnc 'static u8 init_tab \[\] =' + initnc 'static u8 mac_reader\[\] =' + initnc 'static u8 mt2131_config1\[\] =' + initnc 'static u8 mt2266_init2\[\] =' + initnc 'static u8 opera1_inittab\[\] =' + initnc 'static u8 rco_time_value\[\]\[8\] =' + initnc 'static u8 saa7113_init_regs\[\] =' + initnc 'static u8 samsung_tbmu24112_inittab\[\] =' + initnc 'static u8 tas3004_treble_table\[\] =' + initnc 'static u8 w1_crc8_table\[\] =' + initnc 'static u_char const data_sizes_32\[32\] =' + initnc 'static u_long ident_map\[32\] =' + initnc 'static u_short alt_map\[NR_KEYS\] =' + initnc 'static u_short altgr_map\[NR_KEYS\] =' + initnc 'static u_short ctrl_alt_map\[NR_KEYS\] =' + initnc 'static u_short ctrl_map\[NR_KEYS\] *=' + initnc 'static u_short shift_ctrl_map\[NR_KEYS\] =' + initnc 'static u_short shift_map\[NR_KEYS\] *=' + initnc 'static uchar perm1\[56\] =' + initnc 'static uchar perm2\[48\] =' + initnc 'static uchar perm3\[64\] =' + initnc 'static uchar perm4\[48\] =' + initnc 'static uchar perm5\[32\] =' + initnc 'static uchar perm6\[64\] =' + initnc 'static uchar sbox\[8\]\[4\]\[16\] =' + initnc 'static uint16_t crc_table\[256\] =' + initnc 'static uint8_t lpfcAlpaArray\[\] =' + initnc 'static uint8_t seqprog\[\] =' + initnc 'static unsigned char V110_OffMatrix_9600\[\] =' + initnc 'static unsigned char V110_OnMatrix_9600\[\] =' + initnc 'static unsigned char a2232_65EC02code\[\] =' + initnc 'static unsigned char alaw_main\[\] =' + initnc 'static unsigned char atkbd_set3_keycode\[512\] =' + initnc 'static unsigned char atkbd_unxlate_table\[128\] =' + initnc 'static unsigned char banner_table\[\] =' + initnc 'static unsigned char bootlogo_bits\[\] =' + initnc 'static unsigned char bus2core_8260\[\] =' + initnc 'static unsigned char bus2core_8280\[\] =' + initnc 'static unsigned char caseorder\[256\] =' + initnc 'static unsigned char crystal_key\[\] =' + initnc 'static unsigned char dsp_ulaw\[\] =' + initnc 'static unsigned char expressiontab\[128\] =' + initnc 'static unsigned char header2\[\] =' + initnc 'static unsigned char hidp_keycode\[256\] =' + initnc 'static unsigned char ima_adpcm_capture\[\] =' + initnc 'static unsigned char ima_adpcm_init\[\] =' + initnc 'static unsigned char ima_adpcm_playback\[\] =' + initnc 'static unsigned char irq_xlate\[32\] =' + initnc 'static unsigned char mulaw_main\[\] =' + initnc 'static unsigned char nkbd_keycode\[128\] =' + initnc 'static unsigned char pan_volumes\[256\] =' + initnc 'static unsigned char parm_block\[32\] =' + initnc 'static unsigned char raw3270_ebcgraf\[64\] =' + initnc 'static unsigned char rfcomm_crc_table\[256\] =' + initnc 'static unsigned char rwa_unlock\[\] __initdata =' + initnc 'static unsigned char seqprog\[\] =' + initnc 'static unsigned char snd_opl4_volume_table\[128\] =' + initnc 'static unsigned char splash_bits\[\] =' + initnc 'static unsigned char sunkbd_keycode\[128\] =' + initnc 'static unsigned char ufs_fragtable_8fpb\[\] =' + initnc 'static unsigned char ufs_fragtable_other\[\] =' + initnc 'static unsigned char ulaw_dsp\[\] =' + initnc 'static unsigned char usb_kbd_keycode\[256\] =' + initnc 'static unsigned char vga_font\[cmapsz\] \(BTDATA \|\)=' + initnc 'static unsigned char voltab[12]\[128\] =' + initnc 'static unsigned char vpd89_data\[\] =' + initnc 'static unsigned char xtkbd_keycode\[256\] =' + initnc 'static unsigned int ac3_bitrates\[32\] =' + initnc 'static unsigned int bass_volume_table\[\] =' + initnc 'static unsigned int bitrates\[3\]\[16\] =' + initnc 'static unsigned int isa_dma_port\[8\]\[7\] =' + initnc 'static unsigned int master_volume_table\[\] =' + initnc 'static unsigned int mixer_volume_table\[\] =' + initnc 'static unsigned int pan_table\[63\] =' + initnc 'static unsigned int snapper_bass_volume_table\[\] =' + initnc 'static unsigned int snapper_treble_volume_table\[\] =' + initnc 'static unsigned int treble_volume_table\[\] =' + initnc 'static unsigned int valid_mem\[\] =' + initnc 'static unsigned long arthur_to_linux_signals\[32\] =' + initnc 'static unsigned long shmedia_opcode_table\[64\] =' + initnc 'static unsigned nv\([34]\|10\)TableP\(FIFO\|GRAPH\|RAMIN\)\[\]\[2\] =' + initnc 'static unsigned short fcstab\[256\] =' + initnc 'static unsigned short init[1234]\[128\] \/\*__devinitdata\*\/ =' + initnc 'static unsigned short log_table\[LOG_TABLE_SIZE\*2\] =' + initnc 'static unsigned short rc_ioport\[\] =' + initnc 'static unsigned short translations\[\]\[256\] =' + initnc 'static unsigned short treble_parm\[12\]\[9\] =' + initnc 'struct RGBColors TextCLUT\[256\] =' + initnc 'struct VgaRegs GenVgaTextRegs\[NREGS+1\] =' + initnc 'struct battery_thresh spitz_battery_levels_noac\[\] =' + initnc 'struct battery_thresh spitz_battery_levels_acin\[\] =' + initnc 'struct fb_bitfield rgb_bitfields\[\]\[4\] =' + initnc 'struct mode_registers std_modes\[\] =' + initnc 'struct vmode_attr vmode_attrs\[VMODE_MAX\] =' + initnc 'u16 const crc16_table\[256\] =' + initnc 'u16 const crc_ccitt_table\[256\] =' + initnc 'u16 hfsplus_compose_table\[\] =' + initnc 'u16 hfsplus_decompose_table\[\] =' + initnc 'u_char const data_sizes_16\[32\] =' + initnc 'u_short alt_map\[NR_KEYS\] =' + initnc 'u_short altgr_map\[NR_KEYS\] =' + initnc 'u_short ctrl_alt_map\[NR_KEYS\] =' + initnc 'u_short ctrl_map\[NR_KEYS\] *=' + initnc 'u_short plain_map\[NR_KEYS\] *=' + initnc 'u_short shift_ctrl_map\[NR_KEYS\] =' + initnc 'u_short shift_map\[NR_KEYS\] *=' + initnc 'uint patch_2[0f]00\[\] =' + initnc 'uint16_t e1000_igp_cable_length_table\[IGP01E1000_AGC_LENGTH_TABLE_SIZE\] =' + initnc 'uint16_t e1000_igp_2_cable_length_table\[IGP02E1000_AGC_LENGTH_TABLE_SIZE\] =' + initnc '} euc2sjisibm_jisx0212_map\[\] =' + initnc '} freq\[\] =' + initnc '} hps_h_coeff_tab \[\] =' + initnc '} hps_v_coeff_tab \[\] =' + initnc '} init_tab\[\] =' + initnc '} maven_gamma\[\] =' + initnc '} mem_table\[\] =' + initnc '} mxb_saa7740_init\[\] =' + initnc '} pll_table\[\] =' + initnc '} qam256_snr_tab\[\] =' + initnc '} qam64_snr_tab\[\] =' + initnc '} sil_port\[\] =' + initnc '} vsb_snr_tab\[\] =' + initnc '} yss225_registers\[\] __devinitdata =' + ;; + */patch*2.6.25-rc*) + initnc ';[/][*]@@ -[0-9]*,[0-9]* +[0-9]*,[0-9]* @@ static uchar sbox\[8\]\[4\]\[16\] = {[*][/];' + accept ' \$3 = {{pge = {{ste = {\(\([0-9][0-9a-fx{},\n ]*\|\(pge\|ste\) =\|\)[{},\n ]*\)*}'"$eol" + initnc 'static yyconst flex_int\(16\|32\)_t yy_[^[]*\[[0-9]*\] =' + initnc 'static const yytype_u\?int\(8\|16\) yy[^[]*\[\] =' + initnc ' int bcomm_irq\[3\*16\] =' + initnc ' static const int8 countLeadingZerosHigh\[\] =' + initnc 'static unsigned long shmedia_opcode_table\[64\] =' + initnc 'u_char const data_sizes_16\[32\] =' + initnc 'static u_char const data_sizes_32\[32\] =' + initnc ' \.\(digest\|entries\|input\|key\|output\|plaintext\|result\)[ ]*= {' + initnc 'static struct [^\n]*_testvec [^\n]*_tv_template\[\] =' + initnc 'static struct nic_qp_map nic_qp_mapping_[01]\[\] =' + initnc 'static u8 mt2266_init2\[\] =' + initnc 'static struct regval ov_initvals\[\] =' + initnc 'static struct regval stk1125_initvals\[\] =' + initnc 'static u8 bnx2x_stats_len_arr\[BNX2X_NUM_STATS\] =' + initnc 'static const struct arb_line read_arb_data\[NUM_RD_Q\]\[MAX_RD_ORD + 1\] =' + initnc 'static const struct arb_line write_arb_data\[NUM_WR_Q\]\[MAX_WR_ORD + 1\] =' + initnc 'uint16_t e1000_igp_cable_length_table\[IGP01E1000_AGC_LENGTH_TABLE_SIZE\] =' + initnc 'uint16_t e1000_igp_2_cable_length_table\[IGP02E1000_AGC_LENGTH_TABLE_SIZE\] =' + oprepline '#define AR5K_RATES_11A ' + oprepline '#define AR5K_RATES_11B ' + oprepline '#define AR5K_RATES_11G ' + oprepline '#define AR5K_RATES_TURBO ' + oprepline '#define AR5K_RATES_XR ' + initnc ' } blinkrates\[\] =' + initnc 'static const struct ath5k_ini ar5212_ini\[\] =' + initnc 'static const struct ath5k_ini_mode rf5413_ini_mode_end\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5111\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5112\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5112a\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5413\[\] =' + initnc 'static const u16 rtl8225bcd_rxgain\[\] =' + initnc 'static const u8 rtl8225_agc\[\] =' + initnc 'static const u8 rtl8225_tx_power_cck\[\] =' + initnc 'static const u8 rtl8225_tx_power_cck_ch14\[\] =' + initnc 'static const u16 rtl8225z2_rxgain\[\] =' + accept ' \( 49,\)*[\n]\([ 0-9,]*[\n]\)* \( 49,\)*'"$eol" + initnc 'static const unsigned char wm_vol\[256\] =' + accept 'domain 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'"$eol" + # drivers/net/e1000e/phy.c + initnc 'static const u16 e1000_igp_2_cable_length_table\[\] =' + accept ' 24 => \[[\n]\([^\n]*[\n]\)* \]\(, [0-9]\+ => \[\)\?'"$eol" + accept ' '"'"'0x[^\n]*[\n]\([^\n]*[\n]\)* \]\(, [0-9]\+ => \[\)\?'"$eol" + initnc 'const u\(8\|16\|32\) b43_ntab_\(\(adjustpower\|estimatepowerlt\|gainctl\|iqlt\|loftlt\|noisevar1\|tdi[24]0a\)[01]\|channelest\|frame\(lookup\|struct\)\|mcs\|pilot\|tdtrn\|tmap\)\[\] =' + ;; + */nouveau-drm*.patch) + initnc '\(static uint32_t\|}\) nv04_graph_ctx_regs \[\] =' + initnc 'static int nv10_graph_ctx_regs \[\] =' + + # Although the developers of the drivers are not trying to stop + # anyone from modifying it or understanding it, they acknowledge + # these are bits of code, obtained through mmio interactions. + # This means these blobs are not source code, AND original authors + # of the blobs have power to stop others from modifying them. + # Non-Free software, for sure. + + # initnc 'static uint32_t nv\(4[013467ace]\|49_4b\|8[46]\)_ctx_\(voodoo\|prog\)\[\] =' + ;; + */linux-2.6-lirc.patch) + initnc 'const unsigned char map_table\[\] =' + ;; + */linux-2.6-modsign-mpilib.patch) + initnc 'const unsigned char __clz_tab\[\] =' + ;; + */linux-2.6-wireless*.patch) + initnc 'const u\(8\|16\|32\) b43_ntab_\(\(adjustpower\|estimatepowerlt\|gainctl\|iqlt\|loftlt\|noisevar1\|tdi[24]0a\)[01]\|channelest\|frame\(lookup\|struct\)\|mcs\|pilot\|tdtrn\|tmap\)\[\] =' + initnc 'static const s8 \(b43\(legacy\)\?\|bcm43xx\)_tssi2dbm_[bg]_table\[\] =' + initnc 'static struct iwl\(3945\)\?_tx_power power_gain_table\[2\]\[IWL_MAX_GAIN_ENTRIES\] =' + initnc 'static const struct gain_entry gain_table\[2\]\[108\] =' + initnc 'static const struct rf_channel rf_vals_5222\[\] =' + initnc 'static const struct rf_channel rf_vals_5225_2527\[\] =' + initnc 'static const struct rf_channel rf_vals_5226\[\] =' + initnc 'static const struct rf_channel rf_vals_bg\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2522\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2523\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2524\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2525\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2525e\[\] =' + initnc 'static const struct rf_channel rf_vals_bg_2528\[\] =' + initnc 'static const struct rf_channel rf_vals_noseq\[\] =' + initnc 'static const struct rf_channel rf_vals_seq\[\] =' + initnc ' static const u8 t\[\] =' + initnc 'static const u16 rtl8225bcd_rxgain\[\] =' + initnc 'static const u8 rtl8225_agc\[\] =' + initnc 'static const u8 rtl8225_tx_power_cck\[\] =' + initnc 'static const u8 rtl8225_tx_power_cck_ch14\[\] =' + initnc 'static const u16 rtl8225z2_rxgain\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5111\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5112\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5112a\[\] =' + initnc 'static const struct ath5k_ini_rf rfregs_5413\[\] =' + oprepline '#define AR5K_RATES_11A ' + oprepline '#define AR5K_RATES_11B ' + oprepline '#define AR5K_RATES_11G ' + oprepline '#define AR5K_RATES_TURBO ' + oprepline '#define AR5K_RATES_XR ' + initnc 'static const struct ath5k_ini ar5212_ini\[\] =' + initnc 'static const struct ath5k_ini_mode rf\(5413\|24\(13\|25\)\)_ini_mode_end\[\] =' + initnc ' } blinkrates\[\] =' + + # git logs + accept ' sudo modprobe ath5k debug=0x00000400[\n][ ]*[\n]\([ ]*Band[^\n]*[\n]\([ ]*\(\(channels\|rates\):\|[- 0-9a-f]*\|\[\.\.\. etc \]\)[\n]\)\+\)\+ 540 000c 0000 0000' + oprepline ' { 1, MODULATION_XR, 3000, 1, 150, 3 },' + ;; + */linux-2.6-drm-i915-modeset.patch) + initnc 'static const u32 filter_table\[\] =' + ;; + */linux-2.6-netdev-e1000e*.patch) + # drivers/net/e1000e/phy.c + initnc 'static const u16 e1000_igp_2_cable_length_table\[\] =' + ;; + esac +} + +# Regular expression that matches a literal constant. +constx="[0-9][0-9a-fA-FxX]*" +# Regular expression that matches a separator between consecutive +# literal constants. +sepx="\\([,:{} \\nLlUu\"\'\\\\]\\+[xX\$]\\?\\|[ \\n]*[.][a-zA-Z][a-zA-Z0-9]*[ ]\\+[\$]\\?\\)" + +# Regular expression that matches a continuation of a blob, after an +# initial constant. *, \+ and \? can be safely appended to it without +# \(\)s. +blobcont="\\($sepx$constx\\)" + +# Regular expression that matches the initial constant of a blob plus +# its continuation. *, \+ and \? can be safely appended to it without +# \(\)s. +blobpat="$constx$blobcont" + +# Regular expression that matches a blob with the exact number of +# constants specified as sensitivity. +blobseq="$blobpat\\{$sens\\}" + +# Regular expression that matches a blob with the exact specified +# length, or longer. +blobfseq="$blobseq$blobcont*" + +# Regular expression that matches the beginning of the pattern or a +# line break. It must be \(\)ed, such that it can be named in +# replacement patterns without being named. +bol="\\(^\\|[\\n]\\)" + +# Regular expression that matches the end of the pattern or a line +# break. It must be \(\)ed, such that it can be named in replacement +# patterns without being named. +eol="\\([\\n]\\|\$\\)" + +# Regular expression that matches a C-style comment. +comment="\\([/][*]\\([^*]*\\|[*]\\+[^/*]\\)*[*]\\+[/]\\|[/][/][^\\n]*[\\n]\\)" + +# Regular expression that matches comments typically used in assembly. +asmcomment="\\($comment\\|[;#][^\\n]*[\\n]\\)" + +# Regular expression that matches a braced initializer containing at +# least one blob. +initblob="[^\\n]*=\\([ \\n\\\\]*\\|$comment\\)*{\\([^;]*\\|$comment\\)*$blobseq\\([^;]*\\|$comment\\)*}\\?\\([ \\n\\\\]*\\|$comment\\);\\?" + +# Regular expression that matches a C (possibly multi-line) #define +# that contains a blob. +defineblob='[ ]*#[ ]*define[ ]\+\([^\n]*\\[\n]\)*[^\n]*'"$blobseq"'\([^\n]*\\[\n]\)*' + +# Regular expression that matches an assembly label followed by a blob +# without any intervening label. +asmblob="[a-zA-Z_.][^\\n:;#/ ]*[ ]*:\\([^:]*\\|$asmcomment\\)*$blobseq\\([^:]*\\|$asmcomment\\)*" + +# Regular expression that matches one or more blobs without +# intervening line breaks. +sblobctx="\\([^\\n]*$blobfseq\\)\\+" + +# Regular expression that matches the context for a long blob match. +lblobctx="\\($initblob\\|$defineblob\\|$asmblob\\|$sblobctx\\)" + +# Set up the sed script that will go through the (processed) input, +# looking for sequences of blobs and printing whatever was requested. +# It accepts 3 arguments. + +# $1 is the action in case blobs were found in the input. + +# $2 is the action in case no blobs were found, not even false positives. + +# $3 is the action in case false positives were located. + +# $4 is the action for every complete input pattern. + +set_sedmain () { + falsepos=`sed 's,^\\\|,,;s,^,\\\\(,;s,$,\\\\),' < "$falsepos_name"` + + if test -s "$falsepos_name"; then + check_false_positives="$v:???falsepos +/$bol$falsepos/!b blob; +$v:+++falsepos +h; +s/$bol$falsepos/\\1;\/**\/;/g; +# See if, after removing all matches, we end up without any blobs. +$v:???blobseq +/$blobseq/!{ + g; + b falsepos; +} +g; +" + else + falsepos="$^" + check_false_positives= + fi + + sedmain=" +/^;[/][*]\\(end .*\\)\\?[*][/];$/{ + $4; + d; +} +/^;[/][*]begin /!{ + : internal_error + i\\ +Internal error at + p; + q 2; +} +$v:reading file in +h; +n; +: read_more +/^;[/][*]end [^\\n]*[*][/];$/! { + H; + n; + b read_more; +} +H; +g; +$4 +s/^\(;[/][*]begin [^\n]*[\n]\)*//; +s/\\($bol;[/][*]\\(end [^\n]*\\)\\?[*][/];\\)*$//; +$v:???!blobseq +/$blobseq/!b clean; +$check_false_positives +# Fall through. +: blob +$v:blob +$1 +d; +: clean +$2 +d; +: falsepos +$v:falsepos +$3 +d; + +: print_matches +$v:print_matches +/^$falsepos/! { + $v:delete unmatching lines + h; + s/[\\n]$falsepos.*//; + : print_matches_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_matches_nomatch_loop; + } + x; + b print_matches_delete_to_eol; +} +h; +s/^\\($falsepos[^\\n]*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to match +/$blobfseq/ { + i\\ +::: $file ::: + p; +} +g; +s/^\\($falsepos[^\\n]*\\)//; +: print_matches_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_matches; + +: print_marked_matches +$v:print_marked_matches +/^$falsepos/! { + h; + s/[\\n]$falsepos.*//; + : print_marked_matches_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_marked_matches_nomatch_loop; + } + x; + b print_marked_matches_delete_to_eol; +} +h; +s/^\\($falsepos[^\\n]*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to match +/$blobfseq/{ + i\\ +::: $file ::: + s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[ ]*;/{\/*(DEBLOBBED)*\/};/g; + s/$blobfseq/\/*(DEBLOBBED)*\//g; + p; +} +g; +s/^\\($falsepos[^\\n]*\\)//; +: print_marked_matches_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_marked_matches; + +: print_blobs +$v:print_blobs +/^$falsepos/ { + $v:delete false positive + # This is tricky. We don't want to print the false positive. + /^$falsepos[^\\n]*$blobseq/ { + $v:delete false positive immediately followed by blob + h; + s/^\\($falsepos\\)[^\\n]*$blobseq.*/\\1/; + : print_blobs_match_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_blobs_match_loop; + } + G; + b print_blobs_delete_to_eol; + } + s/^$falsepos//; + b print_blobs_delete_to_eol; +} +/^[^\\n]*$blobseq/! { + $v:delete non-blob header + h; + s/[\\n]\\($falsepos\\|[^\\n]*$blobseq\\).*//; + : print_blobs_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_blobs_nomatch_loop; + } + x; + b print_blobs_delete_to_eol; +} +h; +i\\ +::: $file ::: +s/^\\([^\\n]*\\($blobfseq[^\\n]*\\)\\+\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +p; +g; +s/^\\([^\\n]*\\($blobfseq[^\\n]*\\)\\+\\)//; +: print_blobs_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_blobs; + +: print_marked_blobs +$v:print_marked_blobs +/^$falsepos/ { + $v:delete false positive + # This is tricky. We don't want to print the false positive. + /^$falsepos[^\\n]*$blobseq/ { + $v:delete false positive immediately followed by blob + h; + s/^\\($falsepos\\)[^\\n]*$blobseq.*/\\1/; + : print_marked_blobs_match_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_marked_blobs_match_loop; + } + G; + b print_marked_blobs_delete_to_eol; + } + s/^falsepos//; + b print_marked_blobs_delete_to_eol; +} +/^[^\\n]*$blobseq/! { + $v:delete non-blob header + h; + s/[\\n]\\($falsepos\\|[^\\n]*$blobseq\\).*//; + : print_marked_blobs_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_marked_blobs_nomatch_loop; + } + x; + b print_marked_blobs_delete_to_eol; +} +h; +i\\ +::: $file ::: +s/^\\([^\\n]*\\($blobfseq[^\\n]*\\)\\+\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[ ]*;/{\/*(DEBLOBBED)*\/};/g; +s/$blobfseq/\/*(DEBLOBBED)*\//g; +p; +g; +s/^\\([^\\n]*\\($blobfseq[^\\n]*\\)\\+\\)//; +: print_marked_blobs_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_marked_blobs; + +: print_cblobs +$v:print_cblobs +/^$falsepos/ { + $v:delete false positive + # This is tricky. We don't want to print the false positive. + /^$falsepos[^\\n]*$blobseq/ { + $v:delete false positive immediately followed by blob + h; + s/^\\($falsepos\\)[^\\n]*$blobseq.*/\\1/; + : print_cblobs_match_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_cblobs_match_loop; + } + G; + b print_cblobs_delete_to_eol; + } + s/^$falsepos//; + b print_cblobs_delete_to_eol; +} +/^$lblobctx/! { + $v:delete non-blob header + h; + s/[\\n]\\($falsepos\\|$lblobctx\\).*//; + : print_cblobs_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_cblobs_nomatch_loop; + } + x; + b print_cblobs_delete_to_eol; +} +h; +i\\ +::: $file ::: +s/^\\($lblobctx[^\\n]*\\($blobfseq[^\\n]*\\)*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +p; +g; +s/^\\($lblobctx[^\\n]*\\($blobfseq[^\\n]*\\)*\\)//; +: print_cblobs_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_cblobs; + +: print_marked_cblobs +$v:print_marked_cblobs +/^$falsepos/ { + $v:delete false positive + # This is tricky. We don't want to print the false positive. + /^$falsepos[^\\n]*$blobseq/ { + $v:delete false positive immediately followed by blob + h; + s/^\\($falsepos\\)[^\\n]*$blobseq.*/\\1/; + : print_marked_cblobs_match_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_marked_cblobs_match_loop; + } + G; + b print_marked_cblobs_delete_to_eol; + } + s/^$falsepos//; + b print_marked_cblobs_delete_to_eol; +} +/^$lblobctx/! { + $v:delete non-blob header + h; + s/[\\n]\\($falsepos\\|$lblobctx\\).*//; + : print_marked_cblobs_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_marked_cblobs_nomatch_loop; + } + x; + b print_marked_cblobs_delete_to_eol; +} +h; +i\\ +::: $file ::: +s/^\\($lblobctx[^\\n]*\\($blobfseq[^\\n]*\\)*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[ ]*;/{\/*(DEBLOBBED)*\/};/g; +s/$blobfseq/\/*(DEBLOBBED)*\//g; +p; +g; +s/^\\($lblobctx[^\\n]*\\($blobfseq[^\\n]*\\)*\\)//; +: print_marked_cblobs_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_marked_cblobs; + +: print_both +$v:print_both +/^\\($falsepos\\|[^\\n]*$blobseq\\)/! { + $v:delete non-blob header + h; + s/[\\n]\\($falsepos\\|[^\\n]*$blobseq\\).*//; + : print_both_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b print_both_nomatch_loop; + } + x; + b print_both_delete_to_eol; +} +h; +i\\ +::: $file ::: +s/^\\(\\($falsepos[^\\n]*\\|[^\\n]*$blobfseq[^\\n]*\\)\\($blobfseq[^\\n]*\\)*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +p; +g; +s/^\\(\\($falsepos[^\\n]*\\|[^\\n]*$blobfseq[^\\n]*\\)\\($blobfseq[^\\n]*\\)*\\)//; +: print_both_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b print_both; + +: list_matches +$v:list_matches +/^$falsepos/! { + $v:print unmatching lines + h; + s/[\\n]$falsepos.*//; + p; + : list_matches_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b list_matches_nomatch_loop; + } + x; + b list_matches_delete_to_eol; +} +h; +s/^\\($falsepos[^\\n]*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to match +/$blobfseq/{ + s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[ ]*;/{\/*(DEBLOBBED)*\/};/g; + s/$blobfseq/\/*(DEBLOBBED)*\//g; +} +p; +g; +s/^\\($falsepos[^\\n]*\\)//; +: list_matches_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b list_matches; + +: list_blobs +$v:list_blobs +/^$falsepos/ { + $v:print false positive + # This is tricky. We don't want to deblob the false positive. + /^$falsepos[^\\n]*$blobseq/ { + $v:print false positive immediately followed by blob + h; + s/^\\($falsepos\\)[^\\n]*$blobseq.*/\\1/; + : list_blobs_match_loop + /[\\n]/ { + P; + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b list_blobs_match_loop; + } + G; + b list_blobs_delete_to_eol; + } + h; + s/^\\($falsepos[^\\n]*\\)[\\n].*/\\1/; + p; + g; + s/^\\($falsepos[^\\n]*\\)//; + b list_blobs_delete_to_eol; +} +/^[^\\n]*$blobseq/! { + $v:print non-blob header + h; + s/[\\n]\\($falsepos\\|[^\\n]*$blobseq\\).*//; + p; + : list_blobs_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b list_blobs_nomatch_loop; + } + x; + b list_blobs_delete_to_eol; +} +h; +s/^\\([^\\n]*\\($blobfseq[^\\n]*\\)\\+\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[ ]*;/{\/*(DEBLOBBED)*\/};/g; +s/$blobfseq/\/*(DEBLOBBED)*\//g; +p; +g; +s/^\\([^\\n]*\\($blobfseq[^\\n]*\\)\\+\\)//; +: list_blobs_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b list_blobs; + +: list_both +$v:list_both +/^\\($falsepos\\|[^\\n]*$blobseq\\)/! { + $v:print non-blob header + h; + s/[\\n]\\($falsepos\\|[^\\n]*$blobseq\\).*//; + p; + : list_both_nomatch_loop + /[\\n]/ { + s/^[^\\n]*[\\n]//; + x; + s/^[^\\n]*[\\n]//; + x; + b list_both_nomatch_loop; + } + x; + b list_both_delete_to_eol; +} +h; +s/^\\(\\($falsepos[^\\n]*\\|[^\\n]*$blobfseq[^\\n]*\\)\\($blobfseq[^\\n]*\\)*\\)\\([\\n].*\\)\\?$/\\1/; +$v:narrowed to blob +s/{\\($sepx\\)\\?$blobfseq\\($sepx\\)\\?}[ ]*;/{\/*(DEBLOBBED)*\/};/g; +s/$blobfseq/\/*(DEBLOBBED)*\//g; +p; +g; +s/^\\(\\($falsepos[^\\n]*\\|[^\\n]*$blobfseq[^\\n]*\\)\\($blobfseq[^\\n]*\\)*\\)//; +: list_both_delete_to_eol +$v:delete to eol +s/^[^\\n]*//; +/^$/d; +s/^[\\n]//; +b list_both; + +" +} + +# Process an input file named in $1 and run it through the blob +# recognizer. Functions set_except and set_sed_cmd provide additional +# arguments on a per-file and per-action basis. + +check () { + case "$#" in 1) ;; *) echo ICE >&2; exit 1;; esac + + input=$1 + + falsepos_name=`mktemp -t deblob-check-falsepos-XXXXXX` + tempfiles="$falsepos_name" + + # Add $1 to falsepos. Its usage makes it implicitly anchored to + # the beginning of the line. + addx () { + if test -n "$1"; then + echo -n "\\|$1" >> $falsepos_name + fi + } + + set_except "$input" + + set_sed_cmd "$input" + + rm -f "$falsepos_name" + tempfiles= + + # Choose the input source... + case $input in + -) in= ;; + *) in='< "$input"' ;; + esac + + set fnord # shifted out below + + # Decompress as needed... + case $input in + *.bz2) cmd='bunzip2' ;; + *.gz) cmd='gunzip' ;; + *) cmd= ;; + esac + if test -n "$cmd"; then + set "$@" "$cmd" + fi + + # Extract or otherwise munge... + case $input in + *.tar*) + cmd="tar -xf - --to-command='echo \";/*begin \$TAR_FILENAME*/;\"; cat; echo \";/**/;\"; echo \";/*end \$TAR_FILENAME*/;\"'" + ;; + *patch* | *diff*) + sedpatch=' + /^[-]/d; + /^\(@@\|+++\) / { + i\ +;/**/;\ +;/*end patchlet */;\ +;/*begin patchlet */; + s/^/;\/*/; + s/$/*\/;/; + }; + s/^[ +]//;' + cmd='sed "$sedpatch"' + ;; + *) + cmd='cat' + ;; + esac + cmd="{ echo \";/*begin $input*/;\"; $cmd; echo \";/*end $input*/;\"; }" + set "$@" "$cmd" + + case $input in + *.tar*) + cmd="{ cat; cat > /dev/null; }" + set "$@" "$cmd" + ;; + esac + + # Then run through the selected action. + if test "$rm" != "rm -f" || test ! `echo "$sedmain" | wc -c` -lt 1024; then + scriptname=`mktemp -t deblob-check-sedmain-XXXXXX` + tempfiles="$tempfiles $scriptname" + echo "$sedmain" > $scriptname + cmd="sed -n -f \"$scriptname\"" + else + cmd='sed -n "$sedmain"' + fi + set "$@" "$cmd" + + test $# != 1 || set "$@" "cat" + + shift # fnord goes out here + + pipe= + for cmd + do + if test -z "$pipe"; then + pipe="$cmd $in" + else + pipe="$pipe | $cmd" + fi + done + + eval "$pipe" + status=$? + + $rm $tempfiles + tempfiles= + + (exit $status) +} + +# If no input given, use stdin. +case $# in +0) + test -t 0 && echo reading from standard input >&2 + set fnord - + shift + ;; +esac + +# The lines below commented out out #list: can be used to get a list +# of matching inputs. ATM this is useless, so we just use a shell +# boolean. + +#list: n=$# +pass=: + +tempfiles= +trap "status=$?; test -z \"$tempfiles\" || rm -f $tempfiles; (exit $status); exit" 0 1 2 15 + +# Go through each of the input files in the command line. +for file +do + # If we print anything whatsoever (even a blank line) while + # processing it, we've failed. + if check "$file"; then + : + else + pass=false + #list: set fnord "$@" "$file" + #list: shift + fi +done + +#list: shift $n + +#list: exec test $# = 0 +$pass +exit diff --git a/deblob-main b/deblob-main new file mode 100755 index 00000000000..3d8d5f5192b --- /dev/null +++ b/deblob-main @@ -0,0 +1,206 @@ +#! /bin/sh + +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +# deblob.sh - prepare a linux-libre tarball out of a non-libre Linux +# tarball. It expects the Linux release (kver) as the first argument, +# and the libre sub-release (extra) as the second optional argument. + +# linux-$kver.tar.bz2 and deblob-$kver must exist in the current +# directory, and the line that sets kver and extra in deblob-$kver +# must match the command-line arguments. + +# The resulting tarball is put in linux-$kver-libre$extra.tar.bz2, and +# an uncompressed xdelta that produces linux-$kver-libre$extra.tar out +# of linux-$kver.tar is created as linux-$kver-libre$extra.xdelta. +# This xdelta can be distributed to enable third parties to easily +# reconstruct the binary tarball starting out of sources downloaded +# from kernel.org, but without distributing non-Free Software +# yourself, because xdelta (unlike patches) is not reversible: the +# removed bits are not present in it at all. + +# To enable you to check the differences between the tarballs, a patch +# file is generated in linux-$kver-libre$extra.patch. This patch file +# contains the non-Free blobs, even though in reversed form, so its +# distribution is discouraged. + +# At the end, the script attempts to generate a digital signature for +# the newly-created tarball. This is the last thing the script does, +# so interrupting it at that point to skip the signing won't fail to +# do anything else. + +# It is safe to interrupt the script at any other point. When it gets +# a ^C (other than during signing), it starts cleaning up all of its +# temporary and output files. If you insist, it may leave junk +# behind, and then it will refuse to run again before you clean it up +# by hand. It takes extra care to avoid overwriting useful files. + +kver=$1 extra=$2 libre=libre$extra +deblob= dir=`echo $0 | sed 's,/[^/]*$,,'` + +if test ! -f linux-$kver.tar.bz2; then + echo linux-$kver.tar.bz2 does not exist >&2 + exit 1 +fi + +if test -f deblob-$kver; then + deblob=deblob-$kver +elif test -f deblob; then + deblob=deblob +elif test -f $dir/deblob-$kver; then + cp $dir/deblob-$kver deblob + deblob=deblob +else + echo deblob does not exist >&2 + exit 1 +fi + +x1="kver=$kver extra=$extra" +x2=`grep \"^$x1$\" $deblob` +if test "$x1" != "$x2"; then + : +else + echo deblob script does not match command-line arguments >&2 + echo expected: $x1 >&2 + echo found : $x2 >&2 + exit 1 +fi + +if test -f linux-$kver-$libre.tar.bz2; then + echo linux-$kver-$libre.tar.bz2 already exists >&2 + exit 1 +fi + +if test -f linux-$kver.tar; then + echo linux-$kver.tar already exists >&2 + exit 1 +fi + +if test -f linux-$kver-$libre.tar; then + echo linux-$kver-$libre.tar already exists >&2 + exit 1 +fi + +if test -f linux-$kver-$libre.patch; then + echo linux-$kver-$libre.patch already exists >&2 + exit 1 +fi + +if test -f linux-$kver-$libre.xdelta; then + echo linux-$kver-$libre.xdelta already exists >&2 + exit 1 +fi + +if test -d linux-$kver; then + echo linux-$kver already exists >&2 + exit 1 +fi + +if test -d linux-$kver-$libre; then + echo linux-$kver-$libre already exists >&2 + exit 1 +fi + +if test -d orig-linux-$kver; then + echo orig-linux-$kver already exists >&2 + exit 1 +fi + +if test -f $dir/deblob-$kver; then + if cmp $dir/deblob-$kver $deblob; then + : + else + echo $dir/deblob-$kver and $deblob are different >&2 + exit 1 + fi +fi + +if test ! -f deblob-check; then + if test -f $dir/deblob-check; then + cp $dir/deblob-check deblob-check + fi +else + if test -f $dir/deblob-check; then + if cmp $dir/deblob-check deblob-check; then + : + else + echo $dir/deblob-check and deblob-check are different >&2 + exit 1 + fi + fi +fi + +trap "status=$?; echo cleaning up...; rm -rf orig-linux-$kver linux-$kver linux-$kver-$libre linux-$kver.tar linux-$kver-$libre.tar linux-$kver-$libre.tar.bz2 linux-$kver-$libre.patch linux-$kver-$libre.xdelta; (exit $status); exit" 0 1 2 15 + +echo Uncompressing linux-$kver.tar.bz2 into linux-$kver.tar +rm -rf linux-$kver linux-$kver.tar +bunzip2 < linux-$kver.tar.bz2 > linux-$kver.tar + +echo Extracing linux-$kver.tar into linux-$kver +tar -xf linux-$kver.tar +rm -rf linux-$kver-$libre linux-$kver-$libre.tar + +echo Copying linux-$kver to linux-$kver-$libre.tar +cp linux-$kver.tar linux-$kver-$libre.tar +cp -lR linux-$kver/. linux-$kver-$libre + +echo Deblobbing within linux-$kver-$libre +(cd linux-$kver-$libre && /bin/sh ../$deblob) +rm -f linux-$kver-$libre.patch + +echo Generating linux-$kver-$libre.patch +diff -druN linux-$kver linux-$kver-$libre > linux-$kver-$libre.patch + +echo Removing removed or modified files from linux-$kver-$libre.tar +diff -rq linux-$kver linux-$kver-$libre | +sed -n " + s,^Only in \(linux-$kver/.*\): \(.*\),\1/\2,p; + s,^Files \(linux-$kver/.*\) and libre-\1 differ,\1,p; +" | +xargs tar --delete -f linux-$kver-$libre.tar + +echo Adding modified or added files to linux-$kver-$libre.tar +rm -rf orig-linux-$kver +mv linux-$kver orig-linux-$kver +mv linux-$kver-$libre linux-$kver +diff -rq orig-linux-$kver linux-$kver | +sed -n " + s,^Files orig-\(linux-$kver/.*\) and \1 differ,\1,p; + s,^Only in \(linux-$kver/.*\): \(.*\),\1/\2,p; +" | +xargs tar --append -f linux-$kver-$libre.tar + +echo Wiping out extracted trees +rm -rf linux-$kver orig-linux-$kver + +echo Creating xdelta between linux-$kver.tar and linux-$kver-$libre.tar +xdelta delta -0 linux-$kver.tar linux-$kver-$libre.tar linux-$kver-$libre.xdelta + +echo Compressing linux-$kver-$libre.tar +rm -f linux-$kver.tar +bzip2 -9 linux-$kver-$libre.tar + +trap "status=$?; (exit $status); exit" 0 1 2 15 + +echo Done except for signing, feel free to interrupt +gpg -a --detach-sign linux-$kver-$libre.tar.bz2 +mv linux-$kver-$libre.tar.bz2.asc linux-$kver-$libre.tar.bz2.sign + +echo All set, please review linux-$kver-$libre.patch + +exit 0 -- 2.25.1