backport firmware support changes from trunk

This commit is contained in:
Steve McIntyre 2011-06-10 16:51:52 +00:00
parent ed53597afe
commit 7d309316f5
5 changed files with 96 additions and 20 deletions

View File

@ -133,8 +133,6 @@ ifneq ($(ARCHES),source)
$(Q)mkdir -p $(TASKDIR) $(Q)mkdir -p $(TASKDIR)
$(Q)echo "- copying task files from 'tasks/$(DI_CODENAME)/'" $(Q)echo "- copying task files from 'tasks/$(DI_CODENAME)/'"
$(Q)cp -r $(BASEDIR)/tasks/$(CODENAME)/* $(TASKDIR) $(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)echo "- task.languages: using 'tasks/$(DI_CODENAME)/$(TASK_LANGLIST)'"
$(Q)cp $(BASEDIR)/tasks/$(DI_CODENAME)/$(TASK_LANGLIST) \ $(Q)cp $(BASEDIR)/tasks/$(DI_CODENAME)/$(TASK_LANGLIST) \
$(TASKDIR)/task.languages $(TASKDIR)/task.languages
@ -143,6 +141,10 @@ ifneq ($(ARCHES),source)
$(BASEDIR)/tools/update_tasks; \ $(BASEDIR)/tools/update_tasks; \
$(BASEDIR)/tools/generate_di_list; \ $(BASEDIR)/tools/generate_di_list; \
$(BASEDIR)/tools/generate_di+k_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 endif
$(BDIR)/DATE: $(BDIR)/DATE:
$(Q)date '+%Y%m%d' > $(BDIR)/DATE $(Q)date '+%Y%m%d' > $(BDIR)/DATE
@ -326,7 +328,7 @@ $(BDIR)/rawlist:
for VARIANT in $(VARIANTS); do \ for VARIANT in $(VARIANTS); do \
VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT"; \ VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT"; \
done; \ done; \
if [ "$(FORCE_FIRMWARE)"x != "0"x ] ; then \ if [ "$(FORCE_FIRMWARE)"x = "1"x ] ; then \
ARCHDEFS="$$ARCHDEFS -DFORCE_FIRMWARE"; \ ARCHDEFS="$$ARCHDEFS -DFORCE_FIRMWARE"; \
fi; \ fi; \
if [ "$(EXCLUDE_486_KERNEL)"x = "1"x ] ; then \ if [ "$(EXCLUDE_486_KERNEL)"x = "1"x ] ; then \

View File

@ -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 gets out of date, look for firmware/microcode files directly in the
Packages file. Check for things installing in /lib/firmware, and add Packages file. Check for things installing in /lib/firmware, and add
those packages. 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 <hertzog@debian.org> Fri, 04 Feb 2011 09:59:21 +0100 -- Raphaël Hertzog <hertzog@debian.org> Fri, 04 Feb 2011 09:59:21 +0100

View File

@ -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

View File

@ -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 ($_ = <PKGLISTING>) {
$count++;
}
if ($count) {
return 1;
} else {
return 0;
}
}
while (defined($_ = <INPKG>)) {
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;

View File

@ -26,7 +26,7 @@ rm -rf $TMPDIR/firmware
mkdir -p $TMPDIR/firmware mkdir -p $TMPDIR/firmware
FILES=`zcat ${MIRROR}/dists/${SUITE}/*/binary-*/Packages.gz | \ 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 for FILE in $FILES; do
# Don't use "grep -q" here, it causes errors from tar # Don't use "grep -q" here, it causes errors from tar