Towards 2.6.30-libre.
[releases.git] / deblob-2.6.25
index 451d53c3d45cfab914523e23cccb3f5fc853db84..90558f49c711a72e4095f3425ba4580c9cd0b340 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
-#
+
 #    Copyright (C) 2008 Jeff Moe
-#    Copyright (C) 2008 Alexandre Oliva <lxoliva@fsfla.org>
+#    Copyright (C) 2008, 2009 Alexandre Oliva <lxoliva@fsfla.org>
 #
 #    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
 #    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
-#
+
+
+# This script, suited for the kernel version named below, in kver,
+# attempts to remove only non-Free Software bits, without removing
+# Free Software that happens to be in the same file.
+
+# 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
+
+
 # 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=3
-
-sed -i "s,^EXTRAVERSION.*,EXTRAVERSION = -libre$extra," Makefile
+kver=2.6.25 extra=4++
 
-####################
-# FOOOOO XXXXXX
-# drivers/net/tokenring/Kconfig needs as last line:
-# endif # TR
-# drivers/media/Kconfig needs before endmenu
-# endif # DAB
+case $1 in
+--force) die () { echo ERROR: "$@": ignored >&2; }; shift;;
+*) die () { echo "$@" >&2; exit 1; };;
+esac
 
-if [ ! -f `which unifdef` ] ; then echo "requires unifdef" ; exit ; fi
+if unifdef -Utest /dev/null; then :; else
+    die unifdef is required
+fi
 
 check=`echo $0 | sed 's,/[^/]*$,,'`/deblob-check
 if [ ! -f $check ] ; then
-  echo "optional deblob-check missing, will remove entire files"
+  echo optional deblob-check missing, will remove entire files >&2
   have_check=false
 else
   have_check=:
 fi
 
-function clean_file {
+clean_file () {
        #$1 = filename
        if test ! -f $1; then
-               echo $1 does not exist, something is wrong >&2
-               exit 1
+               die $1 does not exist, something is wrong
        fi
        rm -v $1
 }
 
-function check_changed {
+check_changed () {
        if test ! -f $1; then
-               echo $1 does not exist, something is wrong >&2
-               exit 1
+               die $1 does not exist, something is wrong
        elif cmp $1.deblob $1 > /dev/null; then
-               echo $1 did not change, something is wrong >&2
-               exit 1
+               die $1 did not change, something is wrong
        fi
        mv $1.deblob $1
 }
 
-function clean_blob {
+clean_blob () {
        #$1 = filename
        if $have_check; then
            if test ! -f $1; then
-               echo $1 does not exist, something is wrong >&2
-               exit 1
+               die $1 does not exist, something is wrong
            fi
            name=$1
            echo Removing blobs from $name
            set fnord "$@" -d
            shift 2
-           $check "$@" $name > $name.deblob
+           $check "$@" -i linux-$kver $name > $name.deblob
            check_changed $name
        else
            clean_file $1
        fi
 }
 
-function clean_kconfig {
+clean_kconfig () {
         #$1 = filename $2 = things to remove
         echo Marking config $2 as depending on NONFREE in $1
        sed "/^config \\($2\\)\$/{p;i\
@@ -108,7 +106,7 @@ d;}" $1 > $1.deblob
        check_changed $1
 }
 
-function clean_mk {
+clean_mk () {
        #$1 = config $2 = Makefile name
        # We don't clean up Makefiles any more --lxoliva
        # sed -i "/\\($1\\)/d" $2
@@ -116,15 +114,14 @@ function clean_mk {
        if sed -n "/\\($1\\)/p" $2 | grep . > /dev/null; then
            :
        else
-           echo $2 does not contain matches for $1
-           exit 1
+           die $2 does not contain matches for $1
        fi
 }
 
-function clean_ifdef {
+clean_ifdef () {
        #$1 = filename $2 = macro to -U
        echo unifdefing $1 with -U$2
-       unifdef $1 -U$2 > $1.deblob
+       unifdef -U$2 $1 > $1.deblob
        check_changed $1
 }
 
@@ -165,11 +162,12 @@ for f in \
     sound/pci/cs46xx/imgs/cwcdma.asp \
 ; do
   if test ! $f; then
-    echo $f is not present, something is amiss >&2
-    exit 1
+    die $f is not present, something is amiss
   fi
 done
 
+# Identify the tarball.
+sed -i "s,^EXTRAVERSION.*,&-libre$extra," Makefile
 
 #######################
 # Removed ATM Drivers #
@@ -180,16 +178,7 @@ 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_kconfig drivers/atm/Kconfig 'ATM_FORE.*'
 clean_mk CONFIG_ATM_FORE200E drivers/atm/Makefile
 
 clean_file drivers/atm/pca200e.data
@@ -213,7 +202,7 @@ clean_blob drivers/char/dsp56k.c
 clean_kconfig arch/m68k/Kconfig 'ATARI_DSP56K'
 clean_mk CONFIG_ATARI_DSP56K drivers/char/Makefile
 
-# drm
+# gpu drm
 
 # DRM_MGA - Matrox g200/g400
 clean_blob drivers/char/drm/mga_ucode.h
@@ -340,8 +329,12 @@ clean_kconfig drivers/net/Kconfig 'ACENIC'
 clean_mk CONFIG_ACENIC drivers/net/Makefile
 
 # ADAPTEC_STARFIRE - Adaptec Starfire/DuraLAN support
-# This adds restrictions on top of GPLv2, but after deblobbing,
-# nothing copyrightable remains.
+
+# This file requires prior acceptance of the GPL before you can even
+# run the code in it.  It's not clear whether this is a further
+# requirement that would make the distribution incompatible with the
+# GPL, but since nothing remains after we remove the blob, it's
+# irrelevant whether the explicit acceptance would be a problem.
 clean_blob drivers/net/starfire_firmware.h
 clean_kconfig drivers/net/Kconfig 'ADAPTEC_STARFIRE'
 clean_mk CONFIG_ADAPTEC_STARFIRE drivers/net/Makefile
@@ -381,7 +374,9 @@ clean_kconfig drivers/net/Kconfig 'TEHUTI'
 clean_mk CONFIG_TEHUTI drivers/net/Makefile
 
 # TIGON3 - Broadcom Tigon3
-patch --no-backup-if-mismatch -p0 <<\EOF # patches/linux-2.6-tg3-clean.patch
+patch --no-backup-if-mismatch --batch -p0 <<\EOF || \
+  die failed to remove license comments from drivers/net/tg3.c \
+  # patches/linux-2.6-tg3-clean.patch
 --- drivers/net/tg3.c
 +++ drivers/net/tg3.c
 @@ -5,14 +5,6 @@
@@ -621,24 +616,27 @@ 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
+clean_ifdef sound/pci/korg1212/korg1212.c CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
+clean_kconfig sound/pci/Kconfig 'SND_KORG1212_FIRMWARE_IN_KERNEL'
 
 # SND_MAESTRO3 - ESS Allegro/Maestro3
 clean_ifdef sound/pci/maestro3.c CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
+clean_kconfig sound/pci/Kconfig '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
+clean_kconfig sound/pci/Kconfig 'SND_YMFPCI_FIRMWARE_IN_KERNEL'
 
 # SND_SB16_CSP_FIRMWARE_IN_KERNEL - SB16 Advanced Signal Processor
 clean_blob sound/isa/sb/sb16_csp_codecs.h
-clean_kconfig sound/isa/Kconfig SND_SB16_CSP_FIRMWARE_IN_KERNEL
+clean_kconfig sound/isa/Kconfig 'SND_SB16_CSP_FIRMWARE_IN_KERNEL'
 
 # SND_WAVEFRONT_FIRMWARE_IN_KERNEL
 # Most of this file is not matched by deblob-check because of WAIT_IDLE.
 # Just remove it.
 clean_file sound/isa/wavefront/yss225.c
-clean_kconfig sound/isa/Kconfig SND_WAVEFRONT_FIRMWARE_IN_KERNEL
+clean_kconfig sound/isa/Kconfig 'SND_WAVEFRONT_FIRMWARE_IN_KERNEL'
 
 exit 0