From b9c25ca20456750a8ed74674b1ebff23e8bb319d Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Thu, 27 May 2010 00:52:25 +0000 Subject: [PATCH] * Add support for forcing firmware packages onto CD#1: + Add "FORCE_FIRMWARE=1" to CONF.sh to turn this on + Will pick up on packages in the "firmware" task and install them + Will also add sym-links to them in CD1/firmware so that new d-i code can find them easily. + Will add a short sentence into README.html/README.txt * Add top-level control of which checksums are desired for output images see the CHECKSUMS setting in CONF.sh * Fix some bashisms in tools/apt-selection. --- CONF.sh | 11 ++++++++++- Makefile | 5 +++++ data/squeeze/README.html.in | 7 +++++++ debian/CONF.sh | 11 ++++++++++- debian/changelog | 9 +++++++++ tools/add-bin-doc | 2 ++ tools/apt-selection | 10 +++++----- tools/generate_di+k_list | 5 +++++ tools/imagesums | 4 +++- tools/make_disc_trees.pl | 19 +++++++++++++++++++ tools/sort_deps | 18 ++++++++++++++++-- 11 files changed, 91 insertions(+), 10 deletions(-) diff --git a/CONF.sh b/CONF.sh index c0990487..118e82ad 100644 --- a/CONF.sh +++ b/CONF.sh @@ -128,6 +128,11 @@ export CONTRIB=1 # WARNING: Don't use NONFREE and EXTRANONFREE at the same time ! # export EXTRANONFREE=1 +# Do I want to force (potentially non-free) firmware packages to be +# placed on disc 1? Will make installation much easier if systems +# contain hardware that depends on this firmware +export FORCE_FIRMWARE=1 + # If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with # local packages that you want to put on the CD set then # uncomment the following line @@ -218,9 +223,13 @@ export NORECOMMENDS=1 # package on the CD. The default is 'true'. #export NOSUGGESTS=1 -# Set to 1 to generate MD5 and SHA1 sums for generated images +# Set to 1 to generate MD5/SHA1/SHA256/SHA512 sums for generated images export IMAGESUMS=1 +# And define the set of checksum algorithms you want here. Default is +# all of: md5 sha1 sha512 sha256 +# export CHECKSUMS="md5 sha1 sha512 sha256" + # We may have to extract files from packages to put them onto the CD # (e.g. bootloader files). If you make those packages (and their # sources) available somewhere, list it here so that README.source diff --git a/Makefile b/Makefile index 5aae2046..8aae7725 100755 --- a/Makefile +++ b/Makefile @@ -123,6 +123,8 @@ 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 @@ -314,6 +316,9 @@ $(BDIR)/rawlist: for VARIANT in $(VARIANTS); do \ VARIANTDEFS="$$VARIANTDEFS -D VARIANT_$$VARIANT"; \ done; \ + if [ "$(FORCE_FIRMWARE)"x != "0"x ] ; then \ + ARCHDEFS="$$ARCHDEFS -DFORCE_FIRMWARE"; \ + fi; \ if [ "$(SOURCEONLY)"x != "yes"x ] ; then \ cat $(TASKDIR)/$(TASK) | \ cpp -nostdinc -nostdinc++ -P -undef $$ARCHDEFS $$VARIANTDEFS\ diff --git a/data/squeeze/README.html.in b/data/squeeze/README.html.in index 147a5052..4a6ffd8a 100644 --- a/data/squeeze/README.html.in +++ b/data/squeeze/README.html.in @@ -208,6 +208,13 @@ # if TYPEsource This set includes the source code of programs in the Debian OS.

# endif +# if FORCE_FIRMWARE == 1 +# if DISKNUM == 1 +

This disc includes non-free firmware files to make installation easier on some + systems. See http://wiki.debian.org/Firmware + for more details.

+# endif +# endif #else

# include diff --git a/debian/CONF.sh b/debian/CONF.sh index c0990487..118e82ad 100644 --- a/debian/CONF.sh +++ b/debian/CONF.sh @@ -128,6 +128,11 @@ export CONTRIB=1 # WARNING: Don't use NONFREE and EXTRANONFREE at the same time ! # export EXTRANONFREE=1 +# Do I want to force (potentially non-free) firmware packages to be +# placed on disc 1? Will make installation much easier if systems +# contain hardware that depends on this firmware +export FORCE_FIRMWARE=1 + # If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with # local packages that you want to put on the CD set then # uncomment the following line @@ -218,9 +223,13 @@ export NORECOMMENDS=1 # package on the CD. The default is 'true'. #export NOSUGGESTS=1 -# Set to 1 to generate MD5 and SHA1 sums for generated images +# Set to 1 to generate MD5/SHA1/SHA256/SHA512 sums for generated images export IMAGESUMS=1 +# And define the set of checksum algorithms you want here. Default is +# all of: md5 sha1 sha512 sha256 +# export CHECKSUMS="md5 sha1 sha512 sha256" + # We may have to extract files from packages to put them onto the CD # (e.g. bootloader files). If you make those packages (and their # sources) available somewhere, list it here so that README.source diff --git a/debian/changelog b/debian/changelog index f543dace..13dbc17a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,15 @@ debian-cd (3.1.4) UNRELEASED; urgency=low [ Steve McIntyre ] * Rename log.add_packages to add_packages.log * Add dependency on dpkg-dev for dpkg-architecture. Closes: #574879 + * Add support for forcing firmware packages onto CD#1: + + Add "FORCE_FIRMWARE=1" to CONF.sh to turn this on + + Will pick up on packages in the "firmware" task and install them + + Will also add sym-links to them in CD1/firmware so that new d-i code + can find them easily. + + Will add a short sentence into README.html/README.txt + * Add top-level control of which checksums are desired for output images + see the CHECKSUMS setting in CONF.sh + * Fix some bashisms in tools/apt-selection. -- Steve McIntyre <93sam@debian.org> Tue, 27 Feb 2010 12:24:29 +0100 diff --git a/tools/add-bin-doc b/tools/add-bin-doc index d43d93f3..4fd5c4fb 100755 --- a/tools/add-bin-doc +++ b/tools/add-bin-doc @@ -46,6 +46,7 @@ rm -f $dir/README $dir/README.1ST \ rm -f $dir/README.html cpp -traditional -undef -P -C -Wall -nostdinc -I$dir \ -D DISKTYPE$DISKTYPE \ + -D FORCE_FIRMWARE="$FORCE_FIRMWARE" \ -D COMPLETE="$COMPLETE" \ -D OMIT_MANUAL="$OMIT_MANUAL" \ -D OFFICIAL_VAL=$OFFICIAL_VAL \ @@ -59,6 +60,7 @@ lynx -dump -force_html $dir/README.html | todos \ cpp -traditional -undef -P -C -Wall -nostdinc -I $dir/ \ -D DISKTYPE$DISKTYPE \ + -D FORCE_FIRMWARE="$FORCE_FIRMWARE" \ -D OMIT_MANUAL="$OMIT_MANUAL" \ -D OFFICIAL_VAL=$OFFICIAL_VAL \ -D OMIT_RELEASE_NOTES="$OMIT_RELEASE_NOTES" \ diff --git a/tools/apt-selection b/tools/apt-selection index 9a4b47e1..ecf07a7d 100755 --- a/tools/apt-selection +++ b/tools/apt-selection @@ -8,11 +8,11 @@ # set -e # Get the configuration information if necessary -if [ -z "$CODENAME" -o -z "$ARCH" -o -z "$APTTMP" ]; then +if [ -z "$CODENAME" ] || [ -z "$ARCH" ] || [ -z "$APTTMP" ]; then if [ -e CONF.sh ]; then . CONF.sh else - echo "Please set the good environment variables before " + echo "Please set up environment variables before " echo "launching this program ..." echo "Current values are :" echo "CODENAME=$CODENAME" @@ -35,7 +35,7 @@ options=" -q -o Dir::State::status=$APTTMP/$CODENAME-$ARCH/status \ -o APT::Architecture=$ARCH " sections=main -if [ "${NONFREE:-0}" != "0" -o "${EXTRANONFREE:-0}" != "0" ]; then +if [ "${NONFREE:-0}" != "0" ] || [ "${EXTRANONFREE:-0}" != "0" ] || [ "${FORCE_FIRMWARE:-0}" != "0" ]; then sections="$sections non-free" fi if [ "${CONTRIB:-0}" != "0" ]; then @@ -84,7 +84,7 @@ if [ ! -e "$APTTMP/$CODENAME-$ARCH/apt/sources.list" ]; then echo "$ADEB file:$MIRROR $DI_CODENAME main/debian-installer" \ >> $APTTMP/$CODENAME-$ARCH/apt/sources.list fi - if [ -n "$LOCAL" -a -e "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer" ]; then + if [ -n "$LOCAL" ] && [ -e "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer" ]; then echo "$ADEB file:${LOCALDEBS:-$MIRROR} $DI_CODENAME local/debian-installer" \ >> $APTTMP/$CODENAME-$ARCH/apt/sources.list fi @@ -94,7 +94,7 @@ fi temp=$APTTMP/$CODENAME-$ARCH/temp.apt-selection # Launch the command -if [ "$1" = "update" -o "$1" = "check" ]; then +if [ "$1" = "update" ] || [ "$1" = "check" ]; then apt-get $options $@ exit $? elif [ "$1" = "cache" ]; then diff --git a/tools/generate_di+k_list b/tools/generate_di+k_list index 310ad405..f085beae 100755 --- a/tools/generate_di+k_list +++ b/tools/generate_di+k_list @@ -91,6 +91,11 @@ bpalogin */ multipath-tools-boot +/* add the list of firmware packages here too if required */ +#ifdef FORCE_FIRMWARE +# include +#endif + #ifdef ARCH_i386 initramfs-tools busybox diff --git a/tools/imagesums b/tools/imagesums index 8f4e28ca..e5882a3e 100755 --- a/tools/imagesums +++ b/tools/imagesums @@ -6,7 +6,9 @@ if [ "$2"x != ""x ] ; then EXT="$2" fi -CHECKSUMS="sha1 md5 sha512 sha256" +if [ "$CHECKSUMS"x = ""x ] ; then + CHECKSUMS="sha1 md5 sha512 sha256" +fi for SUM in $CHECKSUMS; do UPSUM=`echo $SUM | tr 'a-z' 'A-Z'` diff --git a/tools/make_disc_trees.pl b/tools/make_disc_trees.pl index 293a24ff..817806c4 100755 --- a/tools/make_disc_trees.pl +++ b/tools/make_disc_trees.pl @@ -8,6 +8,7 @@ use strict; use Digest::MD5; use File::stat; use File::Find; +use File::Basename; use Compress::Zlib; my %pkginfo; @@ -17,6 +18,7 @@ my $mkisofs_opts = ""; my $mkisofs_dirs = ""; my (@arches, @arches_nosrc, @overflowlist, @pkgs_added); my (@exclude_packages, @unexclude_packages, @excluded_package_list); +my %firmware_package; undef @pkgs_added; undef @exclude_packages; @@ -163,6 +165,15 @@ if ($archlist =~ /m68k/ || $archlist =~ /powerpc/) { print "Starting to lay out packages into $disktype ($diskdesc) images: $maxdiskblocks 2K-blocks maximum per image\n"; +if (-e "$bdir/firmware-packages") { + open(FWLIST, "$bdir/firmware-packages") or die "Unable to read firmware-packages file!\n"; + while (defined (my $pkg = )) { + chomp $pkg; + $firmware_package{$pkg} = 1; + } + close(FWLIST); +} + open(INLIST, "$bdir/packages") or die "No packages file!\n"; while (defined (my $pkg = )) { chomp $pkg; @@ -1075,6 +1086,14 @@ sub add_packages { $total_blocks += get_file_blocks($realfile); $total_blocks += good_link ($realfile, "$dir/$file"); msg_ap(0, " Linked $dir/$file\n"); + if ($firmware_package{$pkgname}) { + msg_ap(0, "Symlink fw package $pkgname into /firmware\n"); + if (! -d "$dir/firmware") { + mkdir "$dir/firmware" or die "symlink failed $!\n"; + } + symlink("../$file", "$dir/firmware/" . basename($file)); + msg_ap(0, "Symlink ../$file $dir/firmware/.\n"); + } } else { msg_ap(0, " $dir/$file already linked in\n"); } diff --git a/tools/sort_deps b/tools/sort_deps index b2fd076d..aaa1e75f 100755 --- a/tools/sort_deps +++ b/tools/sort_deps @@ -18,6 +18,7 @@ my $list = shift; my $nonfree = $ENV{'NONFREE'} || 0; my $extranonfree = $ENV{'EXTRANONFREE'} || 0; +my $force_firmware = $ENV{'FORCE_FIRMWARE'} || 0; my $local = $ENV{'LOCAL'} || 0; my $complete = $ENV{'COMPLETE'} || 0; my $norecommends = $ENV{'NORECOMMENDS'} || 0; @@ -60,6 +61,8 @@ msg(1, "Complete selected packages with all the rest: "); msg(1, yesno($complete)."\n"); msg(1, "Include non-free packages: "); msg(1, yesno($nonfree)."\n"); +msg(1, "Force inclusion of firmware packages: "); +msg(1, yesno($force_firmware)."\n"); msg(1, "====================================================================== "); @@ -81,6 +84,7 @@ while (defined($_=)) { $packages{$p}{"Suggests"} = []; $packages{$p}{"Recommends"} = []; $packages{$p}{"IsUdeb"} = ($packages{$p}{"Filename"} =~ /.udeb$/) ? 1 : 0; + $packages{$p}{"IsFirmware"} = ($packages{$p}{"Filename"} =~ /(firmware|microcode)/) ? 1 : 0; if ($packages{$p}{"Section"} =~ /contrib\//) { $packages{$p}{"Component"} = "contrib"; } elsif ($packages{$p}{"Section"} =~ /non-free\//) { @@ -103,8 +107,12 @@ my $count_excl = 0; if (not $nonfree) { foreach (grep { $packages{$_}{"Section"} =~ /non-free/ } (keys %packages)) { - $excluded{$_} = 'nonfree'; - $count_excl++; + if ($force_firmware and $packages{$_}{"IsFirmware"}) { + msg(1, "force_firmware: keeping non-free package $_\n"); + } else { + $excluded{$_} = 'nonfree'; + $count_excl++; + } } } @@ -292,13 +300,19 @@ foreach (glob("$dir/*.packages*")) { my $count = 0; open(CDLIST, "> $dir/packages.$arch") || die "Can't write in $dir/$_.packages.$arch: $!\n"; +open(FWLIST, ">> $dir/firmware-packages") + || die "Can't write in $dir/firmware-packages: $!\n"; foreach (@output) { my $component = $packages{$_}{"Component"}; my $size = $packages{$_}{"Size"}; print CDLIST "$arch:$component:$_:$size\n"; + if ($packages{$_}{"IsFirmware"}) { + print FWLIST "$_\n"; + } $count++; } close CDLIST; +close FWLIST; msg(0, "Done: processed/sorted $count packages, total size $output_size bytes.\n"); close LOG;