diff --git a/squeeze/Makefile b/squeeze/Makefile index 6773765b..0d53ff88 100755 --- a/squeeze/Makefile +++ b/squeeze/Makefile @@ -133,8 +133,6 @@ ifneq ($(ARCHES),source) $(Q)mkdir -p $(TASKDIR) $(Q)echo "- copying task files from 'tasks/$(DI_CODENAME)/'" $(Q)cp -r $(BASEDIR)/tasks/$(CODENAME)/* $(TASKDIR) - $(Q)echo "- copying firwmare task file from 'tasks/firmware'" - $(Q)cp -r $(BASEDIR)/tasks/firmware $(TASKDIR) $(Q)echo "- task.languages: using 'tasks/$(DI_CODENAME)/$(TASK_LANGLIST)'" $(Q)cp $(BASEDIR)/tasks/$(DI_CODENAME)/$(TASK_LANGLIST) \ $(TASKDIR)/task.languages @@ -143,6 +141,10 @@ ifneq ($(ARCHES),source) $(BASEDIR)/tools/update_tasks; \ $(BASEDIR)/tools/generate_di_list; \ $(BASEDIR)/tools/generate_di+k_list +ifeq ($(FORCE_FIRMWARE),1) + # Generate firmware task file using the contents of the archive + $(Q)$(BASEDIR)/tools/generate_firmware_task $(ARCHES) $(TASKDIR)/firmware +endif endif $(BDIR)/DATE: $(Q)date '+%Y%m%d' > $(BDIR)/DATE @@ -326,7 +328,7 @@ $(BDIR)/rawlist: for VARIANT in $(VARIANTS); do \ VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT"; \ done; \ - if [ "$(FORCE_FIRMWARE)"x != "0"x ] ; then \ + if [ "$(FORCE_FIRMWARE)"x = "1"x ] ; then \ ARCHDEFS="$$ARCHDEFS -DFORCE_FIRMWARE"; \ fi; \ if [ "$(EXCLUDE_486_KERNEL)"x = "1"x ] ; then \ diff --git a/squeeze/debian/changelog b/squeeze/debian/changelog index ef7fb9a0..50db4561 100644 --- a/squeeze/debian/changelog +++ b/squeeze/debian/changelog @@ -35,6 +35,9 @@ debian-cd (3.1.6) UNRELEASED-backport; urgency=low gets out of date, look for firmware/microcode files directly in the Packages file. Check for things installing in /lib/firmware, and add those packages. + * Remove the checked-in firmware task altogether, as it's not + useful. Generate it when needed using the new script + tools/generate_firmware_task. -- Raphaƫl Hertzog Fri, 04 Feb 2011 09:59:21 +0100 diff --git a/squeeze/tasks/firmware b/squeeze/tasks/firmware deleted file mode 100644 index 311751cf..00000000 --- a/squeeze/tasks/firmware +++ /dev/null @@ -1,16 +0,0 @@ -/* This file lists non-free firmware packages used by d-i (for all arches) */ -ixp4xx-microcode -atmel-firmware -firmware-bnx2 -firmware-bnx2x -firmware-ipw2x00 -firmware-ipw3945 -firmware-iwlwifi -firmware-linux -firmware-linux-nonfree -firmware-qlogic -firmware-ralink -libertas-firmware -zd1211-firmware -/* This firmware is free, but it is convenient to include it here. */ -firmware-linux-free diff --git a/squeeze/tools/generate_firmware_task b/squeeze/tools/generate_firmware_task new file mode 100755 index 00000000..136a5772 --- /dev/null +++ b/squeeze/tools/generate_firmware_task @@ -0,0 +1,87 @@ +#!/usr/bin/perl -w +# +# generate_firmware_task +# +# Work out which firmware packages we need +# Several steps: +# +# 1. Look for packages which contain "firmware" or "microcode" in their package names +# 2. Check each of those packages to see if they contain files in /lib/firmware +# 3. For those that do, output the package name into the firmware task +# +# Copyright Steve McIntyre <93sam@debian.org> 2011 +# +# GPL 2 +# + +use strict; + +my ($mirror, $codename, $archlist, $outfile); +my $date; +my $pkgfiles = ""; +my ($pkg, $filename); +my %seen; + +$codename = $ENV{'CODENAME'}; +$mirror = $ENV{'MIRROR'}; +$archlist = shift; +$outfile = shift; + +if (!defined($codename) || !defined($mirror) || + !defined($archlist) || !defined($outfile)) { + die "Error in arguments\n"; +} + +foreach my $arch (split(' ', $archlist)) { + $pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.gz"; +} + +open (OUT, "> $outfile") or die "Can't open outfile for writing: $!\n"; + +$date = `date -u`; +chomp $date; + +print OUT "/*\n"; +print OUT " * 'firmware' task file; generated automatically by generate_firmware_task\n"; +print OUT " * for \"$archlist\" on $date\n"; +print OUT " * Do not edit - changes will not be preserved\n"; +print OUT " */\n"; + +print "$0: Checking for firmware packages:\n"; + +open (INPKG, "zcat $pkgfiles |") or die "Can't read input package files: $!\n"; +$/ = ''; # Browse by paragraph + +sub contains_firmware($$) { + my $count = 0; + open (PKGLISTING, "dpkg --contents $mirror/$filename | grep ' ./lib/firmware/' |") or + die "Can't check package file $filename: $!\n"; + while ($_ = ) { + $count++; + } + if ($count) { + return 1; + } else { + return 0; + } +} + +while (defined($_ = )) { + m/^Package: (\S+)/m and $pkg = $1; + m/^Filename: (\S+)/m and $filename = $1; + + if (! ($pkg =~ /(microcode|firmware)/)) { + next; + } + + if (!exists $seen{$filename}) { + $seen{$filename} = 1; + if (contains_firmware($mirror, $filename)) { + print " $pkg ($filename)\n"; + print OUT "$pkg\n"; + } + } +} + +close INPKG; +close OUT; diff --git a/squeeze/tools/make-firmware-image b/squeeze/tools/make-firmware-image index 951b06aa..501bec22 100755 --- a/squeeze/tools/make-firmware-image +++ b/squeeze/tools/make-firmware-image @@ -26,7 +26,7 @@ rm -rf $TMPDIR/firmware mkdir -p $TMPDIR/firmware FILES=`zcat ${MIRROR}/dists/${SUITE}/*/binary-*/Packages.gz | \ - grep-dctrl -Pe '.*(firmware|microcode).*' -s Filename | sort -u | awk '{print $2}'` + grep-dctrl -Pe '.*(firmware|microcode).*' -s Filename -n | sort -u` for FILE in $FILES; do # Don't use "grep -q" here, it causes errors from tar