2008-06-23 21:55:36 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-06-10 13:26:30 +00:00
|
|
|
# Work out which firmware files to include in the image
|
|
|
|
# Several steps:
|
|
|
|
#
|
2023-01-26 21:22:40 -01:00
|
|
|
# 1. Look for firmware packages just like a regular debian-cd build with
|
|
|
|
# non-free enabled would do (see NONFREE_COMPONENTS variable for details)
|
|
|
|
# 2. Add them into the firmware temp tree
|
|
|
|
# 3. Make images (tar.gz, zip) of that tree
|
2011-06-10 13:26:30 +00:00
|
|
|
|
2008-06-23 21:55:36 +00:00
|
|
|
set -e
|
|
|
|
|
2023-01-26 21:22:40 -01:00
|
|
|
export MIRROR=$1
|
|
|
|
export CODENAME=$2
|
2008-06-23 21:55:36 +00:00
|
|
|
TMPDIR=$3
|
|
|
|
export LC_ALL=C
|
|
|
|
|
2008-06-25 00:24:09 +00:00
|
|
|
if [ "$MIRROR"x = ""x ] || \
|
2023-01-26 21:22:40 -01:00
|
|
|
[ "$CODENAME"x = ""x ] || \
|
2011-06-10 13:26:30 +00:00
|
|
|
[ "$TMPDIR"x = ""x ] ; then
|
2008-06-23 21:55:36 +00:00
|
|
|
echo "$0: Need parameters"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $TMPDIR/firmware
|
|
|
|
mkdir -p $TMPDIR/firmware
|
|
|
|
|
2023-01-26 21:22:40 -01:00
|
|
|
# Debian 12+ official images use main and non-free-firmware, Debian 11
|
|
|
|
# sticks to the three historical components:
|
|
|
|
case $CODENAME in
|
|
|
|
bullseye)
|
|
|
|
export FIRMWARE_COMPONENTS="main contrib non-free"
|
2023-01-26 21:22:40 -01:00
|
|
|
GENERATE_DEP11=0
|
2023-01-26 21:22:40 -01:00
|
|
|
;;
|
|
|
|
*)
|
2023-01-30 00:07:11 -01:00
|
|
|
export FIRMWARE_COMPONENTS="main non-free-firmware"
|
2023-01-26 21:22:40 -01:00
|
|
|
GENERATE_DEP11=1
|
2023-01-26 21:22:40 -01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2023-01-26 21:22:40 -01:00
|
|
|
# Initialize metadata directory:
|
|
|
|
if [ $GENERATE_DEP11 = 1 ]; then
|
|
|
|
FW_DEP11_DIR=$TMPDIR/firmware/dep11
|
|
|
|
mkdir $FW_DEP11_DIR
|
|
|
|
echo "These files help Debian Installer detect helpful firmware packages (via hw-detect)." > $FW_DEP11_DIR/README.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
# This tool requires environment variables (exported earlier) and two parameters; the second one has
|
|
|
|
# a special value for us to use. Deduplication should happen there, but uniquify to make sure:
|
|
|
|
$BASEDIR/tools/generate_firmware_task '*' --list-filenames-and-indices | sort -u | while read FILE INDICES; do
|
|
|
|
cp ${MIRROR}/$FILE $TMPDIR/firmware
|
|
|
|
|
|
|
|
# Adding metadata for bullseye might be helpful but disruptive, be careful:
|
|
|
|
[ $GENERATE_DEP11 = 0 ] && continue
|
|
|
|
|
|
|
|
# Beware of variable interpolation when using the INDICES variable, it
|
|
|
|
# contains 'binary-*'!
|
|
|
|
COMPONENT=$(echo "$INDICES"|sed 's,/binary-.*,,'|xargs basename)
|
|
|
|
DEP11_DIR=$(echo "$INDICES"|sed 's,/binary-.*,,')/dep11
|
|
|
|
PACKAGE=$(dpkg -f $MIRROR/$FILE Package)
|
|
|
|
|
|
|
|
# Mimic make_disc_trees.pl, except it only passes a single Components-<arch>.yml.gz while
|
|
|
|
# we pass all of them. Differences are unlikely though, as interesting firmware packages
|
|
|
|
# are "Architecture: all".
|
|
|
|
$BASEDIR/tools/generate_firmware_patterns --output-dir $FW_DEP11_DIR --package $PACKAGE $DEP11_DIR/Components-*.yml.gz
|
|
|
|
[ -f $FW_DEP11_DIR/$PACKAGE.patterns ] && printf $COMPONENT > $FW_DEP11_DIR/$PACKAGE.component
|
2011-06-10 13:26:30 +00:00
|
|
|
done
|
2008-06-23 21:55:36 +00:00
|
|
|
|
|
|
|
cd $TMPDIR/firmware
|
|
|
|
tar czf ../firmware.tar.gz .
|
2008-06-23 21:57:37 +00:00
|
|
|
zip -9rq ../firmware.zip .
|
|
|
|
cd ..
|
2023-01-23 17:30:35 -01:00
|
|
|
find firmware | cpio --quiet -o -H newc | pigz -9nm > firmware.cpio.gz
|
2015-08-21 09:53:44 +00:00
|
|
|
ls -l $PWD/firmware.cpio.gz $PWD/firmware.tar.gz $PWD/firmware.zip
|
2015-10-07 14:36:22 +00:00
|
|
|
|
2015-10-07 15:28:19 +00:00
|
|
|
sha256sum firmware.* > SHA256SUMS
|
|
|
|
sha512sum firmware.* > SHA512SUMS
|