Import Upstream version 1.117kylin7

This commit is contained in:
luoyaoming 2022-08-22 15:24:21 +08:00
commit f72e19e4f3
23 changed files with 2258 additions and 0 deletions

113
Makefile Normal file
View File

@ -0,0 +1,113 @@
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
# Take account of old dpkg-architecture output.
ifeq ($(DEB_HOST_ARCH_OS),)
DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM))
ifeq ($(DEB_HOST_ARCH_OS),gnu)
DEB_HOST_ARCH_OS := hurd
endif
endif
CC = gcc
ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
export CC=$(DEB_HOST_GNU_TYPE)-gcc
endif
CPPFLAGS =
CFLAGS = -W -Wall -Os -g
CFLAGS_ARCH = -DCPU_TEXT='"$(DEB_HOST_ARCH)"'
# Use hardening flags too
CFLAGS += `dpkg-buildflags --get CFLAGS`
CPPFLAGS += `dpkg-buildflags --get CPPFLAGS`
bindir=$(DESTDIR)/bin/
hpdir=$(DESTDIR)/etc/hotplug.d
netdir=$(DESTDIR)/etc/network
udevdir=$(DESTDIR)/etc/udev/rules.d
didir=$(DESTDIR)/lib/debian-installer.d
fidir=$(DESTDIR)/usr/lib/finish-install.d
sharedir=$(DESTDIR)/usr/share/hw-detect/
postbaseinstallerdir=$(DESTDIR)/usr/lib/post-base-installer.d/
prepkgseldir=$(DESTDIR)/usr/lib/pre-pkgsel.d/
man1dir=$(DESTDIR)/usr/share/man/man1
INSTALL=install
INSTALL_DATA = ${INSTALL} -m 644
all: archdetect devnames-static.gz
test:
set -e; for sh in *.sh; do sh -n $$sh; done
clean:
rm -f *~
rm -f *.o
rm -f archdetect
rm -f devnames-static.gz
install: install-hw-detect install-ethdetect install-disk-detect install-driver-injection-disk-detect install-archdetect install-archdetect-deb
install-hw-detect: hw-detect.sh
$(INSTALL) -d $(bindir)
ifeq ($(DEB_HOST_ARCH_OS),linux)
$(INSTALL) hw-detect.sh $(bindir)/hw-detect
$(INSTALL) hotplug-pcmcia.sh $(bindir)/hotplug-pcmcia
$(INSTALL) sysfs-update-devnames.sh $(bindir)/sysfs-update-devnames
$(INSTALL) -d $(udevdir)
$(INSTALL_DATA) net-hotplug.rules $(udevdir)/010_net-hotplug.rules
$(INSTALL) check-missing-firmware.sh $(bindir)/check-missing-firmware
$(INSTALL) -d $(postbaseinstallerdir)
$(INSTALL) hw-detect.post-base-installer.d/* $(postbaseinstallerdir)
$(INSTALL) -d $(prepkgseldir)
$(INSTALL) hw-detect.pre-pkgsel.d/* $(prepkgseldir)
$(INSTALL) -d $(hpdir)/net
$(INSTALL) net-hotplug.sh $(hpdir)/net/hw-detect.hotplug
$(INSTALL) -d $(fidir)
$(INSTALL) hw-detect.finish-install.d/* $(fidir)
ifeq ($(DEB_HOST_ARCH),powerpc)
$(INSTALL) discover-mac-io.sh $(bindir)/discover-mac-io
$(INSTALL) discover-ibm.sh $(bindir)/discover-ibm
endif
ifeq ($(DEB_HOST_ARCH),sparc)
$(INSTALL) discover-sbus.sh $(bindir)/discover-sbus
$(INSTALL) -d $(sharedir)
$(INSTALL_DATA) sbus.list $(sharedir)/sbus.list
endif
else
$(INSTALL) detect-stub.sh $(bindir)/hw-detect
endif
install-ethdetect: ethdetect.sh
$(INSTALL) -d $(bindir) $(netdir)
$(INSTALL) ethdetect.sh $(bindir)/ethdetect
$(INSTALL) -m644 devnames-static.gz $(netdir)/
install-disk-detect: disk-detect.sh
$(INSTALL) -d $(bindir)
$(INSTALL) disk-detect.sh $(bindir)/disk-detect
install-driver-injection-disk-detect: driver-injection-disk.sh
$(INSTALL) -d $(bindir)
$(INSTALL) driver-injection-disk.sh $(bindir)/driver-injection-disk
install-archdetect: archdetect
$(INSTALL) -d $(bindir)
$(INSTALL) archdetect $(bindir)
install-archdetect-deb: archdetect
$(INSTALL) -d $(bindir)
$(INSTALL) archdetect $(bindir)
$(INSTALL) -d $(man1dir)
$(INSTALL) archdetect.1 $(man1dir)
archdetect: archdetect.o
${CC} ${LDFLAGS} -o $@ $^ -ldebian-installer
archdetect.o: %.o:%.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_ARCH) -c $<
devnames-static.gz: devnames-static.txt
grep -v '^#' $< | gzip -9cn > $@

16
TODO Normal file
View File

@ -0,0 +1,16 @@
* autodetection of ide devices would be nice, rather than always loading
the ide modules
* clean up the return values, decide what is really a failure, and how to
handle it
* should we try to detect ISA devices?
* Unify the coreof the load_module function in hw-detect with the module_probe
functions used by disk-detect and ethdetect. They diverged but do the same
thing.
* extend devnames to also include disk devices, so that disk-detect
can include nice descriptions of disk devices. Note that discover's
descriptions of modules are an alternate source of info, which uses
different names too. This could stand to be unified.

35
archdetect.1 Normal file
View File

@ -0,0 +1,35 @@
.Dd January 10, 2011
.Os Debian
.ds volume-operating-system Debian
.Dt ARCHDETECT 1
.Sh NAME
.Nm archdetect
.Nd detect hardware architecture
.Sh SYNOPSIS
.Nm
.Op Fl g
.Sh DESCRIPTION
.Nm
displays the current machine architecture and subarchitecture.
The architecture corresponds to that built into
.Ic dpkg ,
and describes the CPU (and possibly kernel) types; the subarchitecture
distinguishes machines with different boot arrangements that require special
handling.
.Pp
The following option is available:
.Bl -tag -width 4n
.It Fl g
When bringing up new subarchitectures,
.Nm
may not yet have been taught about this specific machine.
This option asks that
.Nm
try to guess a generic subarchitecture that may be compatible with this
machine.
This is only necessary on certain architectures, and simply has no effect
elsewhere.
.El
.Sh AUTHORS
.Nm
was written by the Debian Installer team.

48
archdetect.c Normal file
View File

@ -0,0 +1,48 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <debian-installer/system/subarch.h>
static struct option long_options[] =
{
{"guess", 0, 0, 0},
{0, 0, 0, 0}
};
int main(int argc, char *argv[])
{
const char *subarch;
int guess = 0;
while (1)
{
int option_index = 0;
int c;
c = getopt_long (argc, argv, "g", long_options,
&option_index);
if (c == -1) break;
switch (c)
{
case 'g':
guess = 1;
break;
default:
continue;
}
}
if (guess)
subarch = di_system_subarch_analyze_guess();
else
subarch = di_system_subarch_analyze();
if (!subarch)
return EXIT_FAILURE;
printf("%s/%s\n", CPU_TEXT, subarch);
return 0;
}

341
check-missing-firmware.sh Executable file
View File

@ -0,0 +1,341 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
MISSING='/dev/.udev/firmware-missing /run/udev/firmware-missing'
DENIED=/tmp/missing-firmware-denied
if [ "x$1" = "x-n" ]; then
NONINTERACTIVE=1
else
NONINTERACTIVE=""
fi
IFACES="$@"
log () {
logger -t check-missing-firmware "$@"
}
# Not all drivers register themselves if firmware is missing; in that
# case determine the module via the device's modalias.
get_module () {
local devpath=$1
if [ -d $devpath/driver ]; then
# The real path of the destination of the driver/module
# symlink should be something like "/sys/module/e100"
basename $(readlink -f $devpath/driver/module) || true
elif [ -e $devpath/modalias ]; then
modalias="$(cat $devpath/modalias)"
# Take the last module returned by modprobe
modprobe --show-depends "$modalias" 2>/dev/null | \
sed -n -e '$s#^.*/\([^.]*\)\.ko.*$#\1#p'
fi
}
# Some modules only try to load firmware once brought up. So bring up and
# then down any interfaces specified by ethdetect.
upnics() {
for iface in $IFACES; do
log "taking network interface $iface up/down"
ip link set "$iface" up || true
ip link set "$iface" down || true
done
}
# Checks if a given module is a nic module and has an interface that
# is up and has an IP address. Such modules should not be reloaded,
# to avoid taking down the network after it's been configured.
nic_is_configured() {
module="$1"
for iface in $(ip -o link show up | cut -d : -f 2); do
dir="/sys/class/net/$iface/device/driver"
if [ -e "$dir" ] && [ "$(basename "$(readlink "$dir")")" = "$module" ]; then
if ip address show scope global dev "$iface" | grep -q 'scope global'; then
return 0
fi
fi
done
return 1
}
get_fresh_dmesg() {
dmesg_file=/tmp/dmesg.txt
dmesg_ts=/tmp/dmesg-ts.txt
# Get current dmesg:
dmesg > $dmesg_file
# Truncate if needed:
if [ -f $dmesg_ts ]; then
# Transform [foo] into \[foo\] to make it possible to search for
# "^$tspattern" (-F for fixed string doesn't play well with ^ to
# anchor the pattern on the left):
tspattern=$(cat $dmesg_ts | sed 's,\[,\\[,;s,\],\\],')
log "looking at dmesg again, restarting from $tspattern"
# Find the line number for the first match, empty if not found:
ln=$(grep -n "^$tspattern" $dmesg_file |sed 's/:.*//'|head -n 1)
if [ ! -z "$ln" ]; then
log "timestamp found, truncating dmesg accordingly"
sed -i "1,$ln d" $dmesg_file
else
log "timestamp not found, using whole dmesg"
fi
else
log "looking at dmesg for the first time"
fi
# Save the last timestamp:
grep -o '^\[ *[0-9.]\+\]' $dmesg_file | tail -n 1 > $dmesg_ts
log "saving timestamp for a later use: $(cat $dmesg_ts)"
# Write and clean-up:
cat $dmesg_file
rm $dmesg_file
}
check_missing () {
upnics
# Give modules some time to request firmware.
sleep 1
modules=""
files=""
# The linux kernel and udev no longer let us know via
# /dev/.udev/firmware-missing and /run/udev/firmware-missing
# which firmware files the kernel drivers look for. Check
# dmesg instead. See also bug #725714.
fwlist=/tmp/check-missing-firmware-dmesg.list
get_fresh_dmesg | sed -rn 's/^(\[[^]]*\] )?([^ ]+) [^ ]+: firmware: failed to load ([^ ]+) .*/\2 \3/p' > $fwlist
while read module fwfile ; do
log "looking for firmware file $fwfile requested by $module"
if [ ! -e /lib/firmware/$fwfile ] ; then
if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
log "listed in $DENIED"
continue
fi
files="${files:+$files }$fwfile"
modules="$module${modules:+ $modules}"
fi
done < $fwlist
# This block looking in $MISSING should be removed when
# hw-detect no longer should support installing using older
# udev and kernel versions.
for missing_dir in $MISSING
do
if [ ! -d "$missing_dir" ]; then
log "$missing_dir does not exist, skipping"
continue
fi
for file in $(find $missing_dir -type l); do
# decode firmware filename as encoded by
# udev firmware.agent
fwfile="$(basename $file | sed -e 's#\\x2f#/#g')"
# strip probably nonexistant firmware subdirectory
devpath="$(readlink $file | sed 's/\/firmware\/.*//')"
# the symlink is supposed to point to the device in /sys
if ! echo "$devpath" | grep -q '^/sys/'; then
devpath="/sys$devpath"
fi
module=$(get_module "$devpath")
if [ -z "$module" ]; then
log "failed to determine module from $devpath"
continue
fi
rm -f "$file"
if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
continue
fi
files="$fwfile${files:+ $files}"
if [ "$module" = usbcore ]; then
# Special case for USB bus, which puts the
# real module information in a subdir of
# the devpath.
for dir in $(find "$devpath" -maxdepth 1 -mindepth 1 -type d); do
module=$(get_module "$dir")
if [ -n "$module" ]; then
modules="$module${modules:+ $modules}"
fi
done
else
modules="$module${modules:+ $modules}"
fi
done
done
if [ -n "$modules" ]; then
log "missing firmware files ($files) for $modules"
return 0
else
log "no missing firmware in loaded kernel modules"
return 1
fi
}
# If found, copy firmware file; preserve subdirs.
try_copy () {
local fwfile=$1
local sdir file f target
sdir=$(dirname $fwfile | sed "s/^\.$//")
file=$(basename $fwfile)
for f in "/media/$fwfile" "/media/firmware/$fwfile" \
${sdir:+"/media/$file" "/media/firmware/$file"}; do
if [ -e "$f" ]; then
target="/lib/firmware${sdir:+/$sdir}"
log "copying loose file $file from '$(dirname $f)' to '$target'"
mkdir -p "$target"
rm -f "$target/$file"
cp -aL "$f" "$target" || true
break
fi
done
}
first_try=1
first_ask=1
ask_load_firmware () {
if [ "$first_try" ]; then
first_try=""
return 0
fi
if [ "$NONINTERACTIVE" ]; then
if [ ! "$first_ask" ]; then
return 1
else
first_ask=""
return 0
fi
fi
db_subst hw-detect/load_firmware FILES "$files"
if ! db_input high hw-detect/load_firmware; then
if [ ! "$first_ask" ]; then
exit 1;
else
first_ask=""
fi
fi
if ! db_go; then
exit 10 # back up
fi
db_get hw-detect/load_firmware
if [ "$RET" = true ]; then
return 0
else
echo "$files" | tr ' ' '\n' >> $DENIED
return 1
fi
}
list_deb_firmware () {
udpkg -c "$1" \
| grep '^\./lib/firmware/' \
| sed -e 's!^\./lib/firmware/!!' \
| grep -v '^$'
}
check_deb_arch () {
arch=$(udpkg -f "$1" | grep '^Architecture:' | sed -e 's/Architecture: *//')
[ "$arch" = all ] || [ "$arch" = "$(udpkg --print-architecture)" ]
}
# Remove non-accepted firmware package
remove_pkg() {
pkgname="$1"
# Remove all files listed in /var/lib/dpkg/info/$pkgname.md5sum
for file in $(cut -d" " -f 2- /var/lib/dpkg/info/$pkgname.md5sum) ; do
rm /$file
done
}
install_firmware_pkg () {
if echo "$1" | grep -q '\.deb$'; then
# cache deb for installation into /target later
mkdir -p /var/cache/firmware/
cp -aL "$1" /var/cache/firmware/ || true
filename="$(basename "$1")"
pkgname="$(echo $filename |cut -d_ -f1)"
udpkg --unpack "/var/cache/firmware/$filename"
if [ -f /var/lib/dpkg/info/$pkgname.preinst ] ; then
# Run preinst script to see if the firmware
# license is accepted Exit code of preinst
# decide if the package should be installed or
# not.
if /var/lib/dpkg/info/$pkgname.preinst ; then
:
else
remove_pkg "$pkgname"
rm "/var/cache/firmware/$filename"
fi
fi
else
udpkg --unpack "$1"
fi
}
# Try to load udebs (or debs) that contain the missing firmware.
# This does not use anna because debs can have arbitrary
# dependencies, which anna might try to install.
check_for_firmware() {
echo "$files" | sed -e 's/ /\n/g' >/tmp/grepfor
for filename in $@; do
if [ -f "$filename" ]; then
if check_deb_arch "$filename" && list_deb_firmware "$filename" | grep -qf /tmp/grepfor; then
log "installing firmware package $filename"
install_firmware_pkg "$filename" || true
fi
fi
done
rm -f /tmp/grepfor
}
while check_missing && ask_load_firmware; do
# first, check if needed firmware (u)debs are available on the
# PXE initrd or the installation CD.
if [ -d /firmware ]; then
check_for_firmware /firmware/*.deb /firmware/*.udeb
fi
if [ -d /cdrom/firmware ]; then
check_for_firmware /cdrom/firmware/*.deb /cdrom/firmware/*.udeb
fi
# second, look for loose firmware files on the media device.
if mountmedia; then
for file in $files; do
try_copy "$file"
done
umount /media || true
fi
# last, look for firmware (u)debs on the media device
if mountmedia driver; then
check_for_firmware /media/*.deb /media/*.udeb /media/*.ude /media/firmware/*.deb /media/firmware/*.udeb /media/firmware/*.ude
umount /media || true
fi
# remove and reload modules so they see the new firmware
# Sort to only reload a given module once if it asks for more
# than one firmware file (example iwlagn)
for module in $(echo $modules | tr " " "\n" | sort -u); do
if ! nic_is_configured $module; then
log "removing and loading kernel module $module"
modprobe -r $module || true
modprobe -b $module || true
fi
done
done

4
detect-stub.sh Executable file
View File

@ -0,0 +1,4 @@
#! /bin/sh
# No-op hardware detection stub, used on architectures where hardware
# detection is unavailable.
exit 0

141
devnames-static.txt Normal file
View File

@ -0,0 +1,141 @@
# Note to editors:
# For new modules, module (without suffix):module information
# The only comments allowed start with a #
# Don't use commas, or hack ethdetect and netcfg support in.
# Try not to make descriptions any wider than 70-75 chars.
# First, we remove the ones we never want to see in an ethdetect menu..
atmel:BLACKLIST
hermes:BLACKLIST
mii:BLACKLIST
orinoco:BLACKLIST
tms380tr:BLACKLIST
wavelan:BLACKLIST
aironet4500_core:BLACKLIST
arcnet:BLACKLIST
com20020:BLACKLIST
usbnet:BLACKLIST
# Here's the meat.
3c501:3Com 3c501 Ethernet
3c503:3Com ISA EtherLink II-II/16
3c505:3Com 3c505 Ethernet
3c507:3Com 3c507 Ethernet
3c509:3Com Etherlink III
3c515:3Com 3c515 "Corkscrew" Ethernet
3c523:3Com 3c523 Ethernet
3c527:3Com 3c527 Ethernet
3c574_cs:3Com 3c574 series PCMCIA Ethernet
3c589_cs:3Com 3c589 series PCMCIA Ethernet
3c59x:3Com 3c59x/3c9xx PCI Ethernet
8139cp:RealTek RTL-8139C+ series 10/100 PCI Ethernet
8139too:RealTek RTL-8139 Fast Ethernet
82596:Generic i82596 Ethernet
8390:National Semiconductor 8390 Ethernet
abyss:Madge Smart 16/4 PCI Mk2 Token Ring
ac3200:Ansel AC3200 EISA Ethernet
airo:Cisco/Aironet ISA/PCI 802.11
airo_cs:Cisco/Aironet PCMCIA 802.11
aironet4500_card:Cisco Aironet 4500 802.11
aironet4500_cs:Cisco Aironet 4500
airport:Apple Airport 802.11
amd8111e:AMD8111 based 10/100 Ethernet
arlan:Aironet Arlan 655
at1700:Allied Telesis 10/100 Ethernet
atmel_pci:Atmel AT76c50x
axnet_cs:Asix AX88190 PCMCIA Ethernet
b44:Broadcom 4400 10/100 PCI Ethernet
catc:USB CATC NetMate Ethernet
com20020_cs:COM20020 chipset ARCnet PCMCIA
cs89x0:Crystal Semiconductor CS8900/8920 Ethernet
de2104x:Intel/Digital 21040/1 PCI Ethernet
de4x5:DIGITAL DC21x4x/DE425-500 DECchip Ethernet
de600:D-Link DE600 pocket adapter (parallel port)
de620:D-Link DE620 pocket adapter (parallel port)
defxx:DIGITAL DEFEA and DEFPA FDDI Adapter
depca:DIGITAL DEPCA & EtherWORKS Ethernet
dl2k:D-Link DL2000-based Gigabit Ethernet Adapter
dmfe:Davicom DM910X Fast Ethernet
e1000:Intel(R) PRO/1000 Gigabit Ethernet
e100:Intel(R) PRO/100 Ethernet
e2100:Cabletron E2100 ISA Ethernet
eepro100:Intel i82557/i82558/i82559 PCI EtherExpressPro
eepro:Intel i82595 ISA EtherExpressPro10/10+
eexpress:Intel EtherExpress 16
epic100:SMC 83c170 EPIC series Ethernet
es3210:Racal-Interlan ES3210 EISA Ethernet
eth16i:ICL EtherTeam 16i/32
ewrk3:DIGITAL EtherWORKS 3 Ethernet
fealnx:Myson MTD-8xx 100/10M Ethernet PCI Adapter
fmvj18x_cs:fmvj18x and compatible PCMCIA Ethernet
forcedeth:nVidia nForce(2) 10/100 Ethernet
hamachi:Packet Engines 'Hamachi' GNIC-II Gigabit Ethernet
hp:HP PC-LAN ISA Ethernet
hp-plus:HP PCLAN/Plus Ethernet
hp100:HP 100VG-AnyLan Network Adapter
ibmtr:IBM Token Ring 16/4
ixgb:Intel(R) PRO/10Gbit Ethernet
ixp400_eth:Intel IXP400 Ethernet
kaweth:KLSI USB Ethernet (many devices)
lance:AMD LANCE/PCnet Ethernet
lanstreamer:IBM LANStreamer Token Ring Adapter
lne390:Mylex LNE390A/B EISA Ethernet
lp486e:Intel Panther onboard i82596
myri_sbus:MyriNET Gigabit Ethernet
natsemi:National Semiconductor DP8381x Series PCI Ethernet
ne2:Generic NE/2 Ethernet
ne2k-pci:PCI NE2000 Ethernet
ne3210:Novell NE3210 EISA Network Adapter
ne:NE1000/NE2000 ISA/PnP Ethernet
netwave_cs:Xircom Netwave AirSurfer 802.11
ni5010:MiCom-Interlan NI5010 Ethernet
ni52:NI5210 (i82586) Ethernet
ni65:AM7990 "Lance" Ethernet
nmclan_cs:New Media PCMCIA Ethernet
ns83820:National Semiconductor DP83820 10/100/1000
olympic:Olympic PCI/Cardbus Chipset Driver
orinoco_cs:Lucent ORiNOCO/Prism2 (PCMCIA)
orinoco_pci:Lucent ORiNOCO Wireless (PCI)
orinoco_plx:Lucent ORiNOCO Wireless (PCMCIA in PLX)
orinoco_tmd:Lucent/Agere ORiNOCO Wireless (TMD7160 PCI)
pcnet32:AMD PCnet32/PCnetPCI based Ethernet
pcnet_cs:NE2000 compatible PCMCIA Ethernet
pegasus:USB Pegasus/Pegasus-II Ethernet
plip:Parallel Line Interface Protocol
prism54:Prism GT/Duette/Indigo
r8169:RealTek RTL-8169 Gigabit Ethernet
ray_cs:Raylink/WebGear Wireless LAN
rrunner:Essential RoadRunner HIPPI
rtl8150:USB RTL8150 Ethernet
s2io:S2IO Technologies XFrame 10MBit Ethernet
sis190:SiS 190 PCI Gigabit Ethernet
sis900:SiS 900 PCI Fast Ethernet
sk98lin:SysKonnect SK-NET Gigabit Ethernet SK-98xx
skfp:SysKonnect 5xxx / Compaq Netelligent Token Ring
smc9194:SMC 9000 Series Ethernet
smc91c92_cs:SMC 91c92 series PCMCIA Ethernet
smc-ultra32:SMC Ultra32 EISA Ethernet
smc-ultra:SMC Ultra/EtherEZ ISA/PnP Ethernet
starfire:Adaptec Starfire Ethernet
sunbmac:Sun "Big Mac" 10/100 Ethernet
sundance:Sundance Alta Ethernet
sungem:Sun "GEM" 10/100/1000 Ethernet
sunlance:Sun "Lance" 10Mbit Ethernet
sunhme:Sun "Happy Meal" 10/100 Ethernet
sunqe:SunQuad SBus Ethernet
tg3:Broadcom Tigon3 Gigabit Ethernet
tlan:TI ThunderLAN Ethernet PCI Adapter
tmspci:SysKonnect 4/16 / 3Com 3c339 / Compaq 4/16 Token Ring
tulip:Digital 21x4x Tulip Ethernet
typhoon:3Com Typhoon Family (3C990/3CR990/variants)
via-rhine:VIA Rhine PCI Fast Ethernet
via-velocity:VIA Velocity PCI Ethernet
wavelan_cs:Lucent WaveLAN/IEEE + compatibles 802.11
wd:ISA WD 8003/8013 or SMC Elite/16 Ethernet
winbond-840:Winbond W89c840 Ethernet
xen-netfront:Xen Virtual Ethernet
xirc2ps_cs:Xircom PCMCIA Ethernet
xircom_cb:Xircom Cardbus Ethernet
xircom_tulip_cb:Xircom CBE-100 Ethernet
yellowfin:Packet Engines Yellowfin G-NIC Gigabit Ethernet
znet:Zenith Z-Note Ethernet

25
discover-ibm.sh Executable file
View File

@ -0,0 +1,25 @@
#! /bin/sh
set -e
# Detect hardware from Open Firmware's exported device tree that are
# related to IBM pseries/js20 blades/rs6k machines.
#
# If the hardware is of use within d-i, then echo it and register-module it;
# otherwise, just use register-module.
for dir in $(find "/proc/device-tree/" -type d); do
name="$(cat "$dir/name" 2>/dev/null || true)"
device_type="$(cat "$dir/device_type" 2>/dev/null || true)"
compatible="$(cat "$dir/compatible" 2>/dev/null || true)"
# drivers/pseries
if [ "$name" = l-lan ]; then
echo "ibmveth:IBM Virtual Ethernet"
register-module ibmveth
fi
# drivers/scsi
if [ "$name" = v-scsi ]; then
echo "ibmvscsic:IBM Virtual SCSI"
register-module ibmvscsic
fi
done

88
discover-mac-io.sh Executable file
View File

@ -0,0 +1,88 @@
#! /bin/sh
set -e
# Detect hardware from Open Firmware's exported device tree, including
# things on the mac-io bus. This is a grab-bag of stuff at the moment; it
# should really move into discover or be hotpluggable.
#
# If the hardware is of use within d-i, then echo it and register-module it;
# otherwise, just use register-module.
for dir in $(find "/proc/device-tree/" -type d); do
name="$(cat "$dir/name" 2>/dev/null || true)"
device_type="$(cat "$dir/device_type" 2>/dev/null || true)"
compatible="$(cat "$dir/compatible" 2>/dev/null || true)"
# drivers/macintosh
if [ "$name" = fan ]; then
case $compatible in
adt7460|adt7467)
# not in d-i yet
# echo "therm_adt746x:iBook/AlBook G4 ADT746x thermostat"
register-module therm_adt746x
;;
adm1030)
# not in d-i yet
# echo "therm_windtunnel:G4 Windtunnel thermostat"
register-module therm_windtunnel
;;
esac
# drivers/net
elif [ "$name" = radio ]; then
echo "airport:Airport wireless"
register-module airport
elif [ "$name" = bmac ] || ([ "$device_type" = network ] && [ "$compatible" = bmac+ ]); then
echo "bmac:PowerMac BMAC Ethernet"
register-module bmac
elif [ "$name" = mace ]; then
echo "mace:PowerMac MACE Ethernet"
register-module mace
# drivers/scsi
elif [ "$name" = 53c94 ]; then
echo "mac53c94:PowerMac 53c94 SCSI bus adaptor"
register-module mac53c94
elif [ "$name" = mesh ] || ([ "$device_type" = scsi ] && [ "$compatible" = chrp,mesh0 ]); then
echo "mesh:Macintosh Enhanced SCSI Hardware"
register-module mesh
# drivers/ata
elif [ "$device_type" = ata ] ; then
case "$compatible" in
keylargo-ata)
echo "pata_macio:KeyLargo ATA"
register-module -i pata_macio
;;
heathrow-ata)
echo "pata_macio:Heathrow/Paddington ATA"
register-module -i pata_macio
;;
ohare-ata)
echo "pata_macio:OHare ATA"
register-module -i pata_macio
;;
esac
# sound/ppc, sound/oss/dmasound
elif [ "$name" = awacs ]; then
# probably best to go for ALSA
register-module snd-powermac
elif [ "$name" = davbus ] || [ "$name" = i2s-a ]; then
for child in "$dir"/*; do
if [ -f "$child/name" ]; then
childname="$(cat "$child/name" 2>/dev/null || true)"
if [ "$childname" = sound ] && \
[ ! -f "$child/layout-id" ]; then
# blacklist snd-aoa modules so snd-powermac is loaded
register-module -b snd-aoa-codec-tas
register-module -b snd-aoa-fabric-layout
register-module -b snd-aoa-i2sbus
register-module -b snd-aoa-soundbus
register-module -b snd-aoa
register-module snd-powermac
fi
fi
done
elif [ "$name" = via-pmu ]; then
# APM emulation is useful for some applications, such as the
# GNOME battery applet.
register-module apm_emu
fi
done

38
discover-sbus.sh Executable file
View File

@ -0,0 +1,38 @@
#! /bin/sh
set -e
# Detect hardware from output of prtconf utility to support devices on a Sparc
# sbus. Should be removed once the kernel has sysfs support for these devices.
#
# If the hardware is of use within d-i, then echo it.
# We should probably also call register-module or schedule drivers for addition
# in initramfs initrd generators, but that will be taken care of later.
# If discover is present, then prefer discover for sbus hardware detection.
if type discover >/dev/null 2>&1 ; then
exit 0
fi
if ! type prtconf >/dev/null 2>&1 ; then
exit 0
fi
SBUSLIST=/usr/share/hw-detect/sbus.list
PRTCONF=$(prtconf)
grep "^[^#].*:.*:.*" $SBUSLIST | while read DEVLINE; do
DEVID=$(echo $DEVLINE | cut -d: -f1)
DEVDESCR=$(echo $DEVLINE | cut -d: -f2)
DEVMOD=$(echo $DEVLINE | cut -d: -f3)
TARGET=$(echo $DEVLINE | cut -d: -f4)
if echo "$PRTCONF" | grep -q "^ *$DEVID "; then
echo "$DEVMOD:$DEVDESCR"
if [ "$TARGET" = initrd ]; then
register-module -i $DEVMOD
else
register-module $DEVMOD
fi
fi
done

380
disk-detect.sh Executable file
View File

@ -0,0 +1,380 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
if [ -e /lib/partman/lib/iscsi-base.sh ]; then
. /lib/partman/lib/iscsi-base.sh
fi
#set -x
if [ "$(uname)" != Linux ]; then
exit 0
fi
# Install mmc modules if no other disks are found
# (ex: embedded device with µSD storage)
# TODO: more checks?
if [ -z "$(list-devices disk)" ]; then
anna-install mmc-modules || true
fi
log () {
logger -t disk-detect "$@"
}
is_not_loaded() {
! ((cut -d" " -f1 /proc/modules | grep -q "^$1\$") || \
(cut -d" " -f1 /proc/modules | sed -e 's/_/-/g' | grep -q "^$1\$"))
}
list_modules_dir() {
if [ -d "$1" ]; then
find $1 -type f | sed 's/\.ko$//; s/.*\///'
fi
}
list_disk_modules() {
# FIXME: not all of this stuff is disk driver modules, find a way
# to separate out only the disk stuff.
list_modules_dir /lib/modules/*/kernel/drivers/ide
list_modules_dir /lib/modules/*/kernel/drivers/scsi
list_modules_dir /lib/modules/*/kernel/drivers/block
list_modules_dir /lib/modules/*/kernel/drivers/message/fusion
list_modules_dir /lib/modules/*/kernel/drivers/message/i2o
}
disk_found() {
for try in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
if search-path parted_devices; then
# Use partman's parted_devices if available.
if [ -n "$(parted_devices)" ]; then
return 0
fi
else
# Essentially the same approach used by partitioner and
# autopartkit to find their disks.
if [ -n "$(list-devices disk)" ]; then
return 0
fi
fi
# Wait for disk to be activated.
if [ "$try" != 15 ]; then
sleep 2
fi
done
return 1
}
module_probe() {
local module="$1"
local priority="$2"
local modinfo=""
local devs=""
local olddevs=""
local newdev=""
if ! log-output -t disk-detect modprobe -v -b "$module"; then
# Prompt the user for parameters for the module.
local template="hw-detect/retry_params"
local question="$template/$module"
db_unregister "$question"
db_register "$template" "$question"
db_subst "$question" MODULE "$module"
db_input critical "$question" || [ $? -eq 30 ]
db_go
db_get "$question"
local params="$RET"
if [ -n "$params" ]; then
if ! log-output -t disk-detect modprobe -v -b "$module" $params; then
db_unregister "$question"
db_subst hw-detect/modprobe_error CMD_LINE_PARAM "modprobe -v -b $module $params"
db_input critical hw-detect/modprobe_error || [ $? -eq 30 ]
db_go
false
else
# Module loaded successfully
if [ "$params" != "" ]; then
register-module "$module" "$params"
fi
fi
fi
fi
}
multipath_probe() {
MP_VERBOSE=2
# Look for multipaths...
if [ ! -f /etc/multipath.conf ]; then
cat <<EOF >/etc/multipath.conf
defaults {
user_friendly_names yes
}
EOF
fi
log-output -t disk-detect /sbin/multipath -v$MP_VERBOSE
if multipath -l 2>/dev/null | grep -q '^mpath[a-z]\+ '; then
return 0
else
return 1
fi
}
iscsi_ibft_probe() {
if is_not_loaded iscsi_ibft; then
depmod -a >/dev/null 2>&1 || true
module_probe iscsi_ibft || true
fi
if ! log-output -t disk-detect iscsistart -f; then
logger -t disk-detect "Error: iBFT information not found"
return 1
fi
if ! log-output -t disk-detect iscsistart -N; then
logger -t disk-detect "Error: iBFT network configuration failed"
return 1
fi
if ! log-output -t disk-detect iscsistart -b; then
logger -t disk-detect "Error: iBFT login failed"
return 1
fi
# Done
update-dev --settle
logger -t disk-detect "iBFT disk detection finished."
return 0
}
# Load SCSI device handlers before SCSI low-level device drivers.
# (attached on SCSI scan; handle some I/O errors more gracefully)
depmod -a >/dev/null 2>&1
for mod in $(list_modules_dir /lib/modules/$(uname -r)/kernel/drivers/scsi/device_handler); do
module_probe "$mod"
done
if ! hw-detect disk-detect/detect_progress_title; then
log "hw-detect exited nonzero"
fi
# Compatibility with old iSCSI preseeding
db_get open-iscsi/targets || RET=
if [ "$RET" ]; then
if ! pidof iscsid >/dev/null; then
iscsi_start
fi
for portal in $RET; do
iscsi_discovery "$portal" -l
done
fi
# New-style preseeding
if db_fget partman-iscsi/login/address seen && [ "$RET" = true ] && \
db_get partman-iscsi/login/address && [ "$RET" ]; then
if ! pidof iscsid >/dev/null; then
iscsi_start
fi
db_capb backup
iscsi_login
db_capb
fi
# Activate support for iSCSI iBFT
db_get disk-detect/ibft/enable
if [ "$RET" = true ]; then
iscsi_ibft_probe || true
fi
while ! disk_found; do
CHOICES_C=""
CHOICES=""
if type iscsi_login >/dev/null 2>&1; then
CHOICES_C="${CHOICES_C:+$CHOICES_C, }iscsi"
db_metaget disk-detect/iscsi_choice description
CHOICES="${CHOICES:+$CHOICES, }$RET"
fi
for mod in $(list_disk_modules | grep -v iscsi | sort); do
CHOICES_C="${CHOICES_C:+$CHOICES_C, }$mod"
CHOICES="${CHOICES:+$CHOICES, }$mod"
done
if [ -n "$CHOICES" ]; then
db_capb backup
db_subst disk-detect/module_select CHOICES-C "$CHOICES_C"
db_subst disk-detect/module_select CHOICES "$CHOICES"
db_input high disk-detect/module_select || [ $? -eq 30 ]
if ! db_go; then
exit 10
fi
db_capb
db_get disk-detect/module_select
if [ "$RET" = continue ]; then
exit 0
elif [ "$RET" = iscsi ]; then
if ! pidof iscsid >/dev/null; then
iscsi_start
fi
db_capb backup
iscsi_login
db_capb
continue
elif [ "$RET" != none ]; then
module="$RET"
if [ -n "$module" ] && is_not_loaded "$module" ; then
register-module "$module"
module_probe "$module"
fi
continue
fi
fi
if [ -e /usr/lib/debian-installer/retriever/media-retriever ]; then
db_capb backup
db_input critical hw-detect/load_media
if ! db_go; then
exit 10
fi
db_capb
db_get hw-detect/load_media
if [ "$RET" = true ] && \
anna media-retriever && \
hw-detect disk-detect/detect_progress_title; then
continue
fi
fi
db_capb backup
db_input high disk-detect/cannot_find
if ! db_go; then
exit 10
fi
db_capb
done
# Activate MDADM container(s)
if anna-install mdadm-udeb; then
mkdir -p /dev/md
depmod -a >/dev/null 2>&1
for mod in dm-mod md-mod linear multipath raid0 raid1 raid456 raid5 raid6 raid10; do
modprobe -b $mod >/dev/null 2>&1 || true
done
if mdadm --examine --scan | grep -q container ; then
logger -t disk-detect "MDADM container(s) detected. (Intel/DDF RAID)"
# Ask the user whether they want to activate dmraid devices.
db_input high disk-detect/activate_mdadm || true
db_go
db_get disk-detect/activate_mdadm
activate_mdadm=$RET
if [ "$activate_mdadm" = true ]; then
mkdir -p /var/lib/disk-detect
touch /var/lib/disk-detect/activate_mdadm
logger -t disk-detect "Enabling mdmon support."
# TODO I wish below could be limited to containers...
log-output -t disk-detect mdadm --assemble --no-degraded --scan || true
fi
else
logger -t disk-detect "No Intel/DDF RAID disks detected."
fi
fi
# Activate support for Serial ATA RAID (dmraid)
if anna-install dmraid-udeb; then
# Device mapper support is required to run dmraid
if ! dmsetup version >/dev/null 2>&1; then
module_probe dm-mod || true
fi
if dmraid -c -s >/dev/null 2>&1; then
logger -t disk-detect "Serial ATA RAID disk(s) detected."
# Ask the user whether they want to activate dmraid devices.
db_input high disk-detect/activate_dmraid || true
db_go
db_get disk-detect/activate_dmraid
activate_dmraid=$RET
if [ "$activate_dmraid" = true ]; then
mkdir -p /var/lib/disk-detect
touch /var/lib/disk-detect/activate_dmraid
logger -t disk-detect "Enabling dmraid support."
# Activate only those arrays which have all disks
# present.
for dev in $(dmraid -r -c); do
[ -e "$dev" ] || continue
log-output -t disk-detect dmraid-activate "$(basename "$dev")"
done
fi
else
logger -t disk-detect "No Serial ATA RAID disks detected"
fi
fi
# Activate support for DM Multipath
db_get disk-detect/multipath/enable
if [ "$RET" = true ]; then
if anna-install multipath-udeb; then
# We need some dm modules...
depmod -a >/dev/null 2>&1 || true
if ! dmsetup version >/dev/null 2>&1; then
module_probe dm-mod || true
fi
if ! dmsetup targets | cut -d' ' -f1 | grep -q '^multipath$'; then
module_probe dm-multipath || true
fi
log-output -t disk-detect modprobe -v -b dm-round-robin || true
log-output -t disk-detect modprobe -v -b dm-service-time || true
log-output -t disk-detect modprobe -v -b dm-queue-length || true
# ensure multipath and sg3 udev rules are run before we probe.
if [ -x /bin/udevadm ]; then
/bin/udevadm control --reload >/dev/null 2>&1
fi
update-dev >/dev/null
# LVM: deactivate volumes possibly on individual paths
# (reactivated later in udev rules and partman/init.d)
if [ -x /sbin/lvm ]; then
/sbin/lvm vgchange -an >/dev/null 2>&1
fi
# mdadm: stop arrays possibly on individual paths
# (reactivated later in udev rules and partman/init.d)
if [ -x /sbin/mdadm ]; then
/sbin/mdadm --stop --scan >/dev/null 2>&1
fi
update-dev --settle >/dev/null 2>&1
# mdadm: some sysfs entries outlive 'mdadm --stop' and
# 'udevadm settle' for a little while without any udev
# information, and it breaks multipath discovery; e.g.,
# '/sys/devices/virtual/block/md0: no udev information';
# Wait for them to go away.
retries=10
while [ "$retries" -gt 0 ] \
&& ls -1d /sys/devices/virtual/block/md[0-9]* >/dev/null 2>&1; do
: $((retries--))
sleep 0.5
done
# Look for multipaths...
if multipath_probe; then
logger -t disk-detect "Multipath devices found; enabling multipath support"
if ! anna-install partman-multipath; then
/sbin/multipath -F
logger -t disk-detect "Error loading partman-multipath; multipath devices deactivated"
fi
else
logger -t disk-detect "No multipath devices detected"
fi
fi
fi
check-missing-firmware

53
driver-injection-disk.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
log () {
logger -t driver-injection-disk "$@"
}
check_deb_arch () {
arch=$(ar p "$1" control.tar.gz | tar zxO ./control | grep '^Architecture:' | sed -e 's/Architecture: *//')
[ "$arch" = all ] || [ "$arch" = "$(udpkg --print-architecture)" ]
}
lsb_info() {
[ -f /etc/lsb-release ] || return 0
grep "^$1=" /etc/lsb-release |\
sed -e 's/\(.*\)/\1/;s/^[^=]*=//; s/^"//; s/"$//' | tr 'A-Z' 'a-z' || true
}
install_driver_pkg () {
if echo "$1" | grep -q '\.deb$'; then
# cache deb for installation into /target later
mkdir -p /var/cache/firmware/
cp -a "$1" /var/cache/firmware/ || true
udpkg --unpack "/var/cache/firmware/$(basename "$1")"
else
udpkg --unpack "$1"
fi
}
#try to mount possible driver disk
for device in $(list-devices disk; list-devices usb-partition); do
label=$(block-attr --label $device 2>/dev/null || true)
if [ "$label" = "OEMDRV" ]; then
db_input high driver-injection-disk/load || true
if ! db_go; then
exit 10 # back up
fi
db_get driver-injection-disk/load
if [ "$RET" = true ]; then
if mountmedia driver-injection-disk; then
dir=/media/$(lsb_info DISTRIB_ID)-drivers/$(lsb_info DISTRIB_CODENAME)
for filename in $dir/*.deb $dir/*.udeb $dir/*.ude; do
if [ -f "$filename" ] && check_deb_arch "$filename"; then
log "installing driver package $filename"
install_driver_pkg "$filename" || true
fi
done
fi
umount /media || true
fi
fi
done

252
ethdetect.sh Executable file
View File

@ -0,0 +1,252 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
#set -x
if [ "$(uname)" != Linux ]; then
exit 0
fi
# This is a hack, but we don't have a better idea right now.
# See Debian bug #136743
if [ -x /sbin/depmod ]; then
depmod -a > /dev/null 2>&1 || true
fi
log () {
logger -t ethdetect "$@"
}
is_not_loaded() {
! ((cut -d" " -f1 /proc/modules | grep -q "^$1\$") || \
(cut -d" " -f1 /proc/modules | sed -e 's/_/-/g' | grep -q "^$1\$"))
}
load_module() {
local module="$1"
local priority=low
case "$module" in
"plip")
module_probe parport_pc medium
priority=medium
;;
esac
module_probe "$module" "$priority"
}
list_nic_modules() {
find /lib/modules/*/kernel/drivers/net -name phy -prune -o -type f -print | sed 's/\.ko$//; s/.*\///'
}
snapshot_devs() {
echo -n `grep : /proc/net/dev | cut -d':' -f1`
}
compare_devs() {
local olddevs="$1"
local devs="$2"
local dev newdevs
newdevs=
for dev in $devs; do
if ! echo " $olddevs " | grep -q " $dev "; then
newdevs="${newdevs:+$newdevs }$dev"
fi
done
echo "$newdevs"
}
DEVNAMES_STATIC=/etc/network/devnames-static.gz
TEMP_EXTRACT=/tmp/devnames-static.txt
get_static_modinfo() {
local module="$(echo $1 | sed 's/\.ko//')"
local modinfo=""
if [ ! -f "$TEMP_EXTRACT" ]; then
zcat $DEVNAMES_STATIC > $TEMP_EXTRACT
fi
if grep -q "^${module}:" $TEMP_EXTRACT; then
modinfo=$(zcat $DEVNAMES_STATIC | grep "^${module}:" | head -n 1 | cut -d':' -f2-)
else
modinfo="$(modinfo 2>/dev/null -F description "$module")"
fi
echo "$modinfo"
}
cleanup () {
rm -f $TEMP_EXTRACT
}
lsifaces () {
sed -e "s/lo://" < /proc/net/dev | grep "[a-z0-9]*:[ ]*[0-9]*" | sed "s/:.*//; s/^ *//"
}
ethernet_found() {
local ifaces=0
local firewire=0
for iface in $(lsifaces); do
ifaces=$(expr $ifaces + 1)
if [ -f /etc/network/devnames ]; then
if grep "^$iface:" /etc/network/devnames | \
grep -q -i firewire; then
firewire=$(expr $firewire + 1)
fi
fi
done
if [ "$ifaces" = 0 ]; then
return 1
elif [ "$ifaces" = "$firewire" ]; then
db_input high ethdetect/use_firewire_ethernet || true
db_go || true
db_get ethdetect/use_firewire_ethernet
if [ "$RET" = true ]; then
return 0
else
return 1
fi
else
# At least one regular ethernet interface
return 0
fi
}
module_probe() {
local module="$1"
local priority="$2"
local modinfo=""
local devs=""
local olddevs=""
local newdev=""
devs="$(snapshot_devs)"
if ! log-output -t ethdetect modprobe -v -b "$module"; then
# Prompt the user for parameters for the module.
local template="hw-detect/retry_params"
local question="$template/$module"
db_unregister "$question"
db_register "$template" "$question"
db_subst "$question" MODULE "$module"
db_input critical "$question" || [ $? -eq 30 ]
db_go
db_get "$question"
local params="$RET"
if [ -n "$params" ]; then
if ! log-output -t ethdetect modprobe -v -b "$module" $params; then
db_unregister "$question"
db_subst hw-detect/modprobe_error CMD_LINE_PARAM "modprobe -v -b $module $params"
db_input critical hw-detect/modprobe_error || [ $? -eq 30 ]
db_go
false
else
# Module loaded successfully
if [ "$params" != "" ]; then
register-module "$module" "$params"
fi
fi
fi
fi
olddevs="$devs"
devs="$(snapshot_devs)"
newdevs="$(compare_devs "$olddevs" "$devs")"
# Pick up multiple cards that were loaded by a single module
# hence they'll have same description
modinfo=$(get_static_modinfo $module)
if [ -n "$newdevs" -a -n "$modinfo" ]; then
for ndev in $newdevs; do
echo "${ndev}:${modinfo}" >> /etc/network/devnames
done
fi
}
if ! hw-detect ethdetect/detect_progress_title; then
log "hw-detect exited nonzero"
fi
while ! ethernet_found; do
CHOICES=""
for mod in $(list_nic_modules | sort); do
modinfo=$(get_static_modinfo $mod)
if [ -n "$modinfo" ]; then
if [ "$modinfo" = BLACKLIST ]; then
continue
fi
mod="$mod: $modinfo"
fi
CHOICES="${CHOICES:+$CHOICES, }$mod"
done
if [ -n "$CHOICES" ]; then
db_capb backup
db_subst ethdetect/module_select CHOICES "$CHOICES"
db_input medium ethdetect/module_select || [ $? -eq 30 ]
if ! db_go; then
cleanup
exit 10
fi
db_capb
db_get ethdetect/module_select
if [ "$RET" = "no ethernet card" ]; then
break
elif [ "$RET" != "none of the above" ]; then
module="$(echo $RET | cut -d: -f1)"
if [ -n "$module" ] && is_not_loaded "$module" ; then
register-module "$module"
load_module "$module"
fi
continue
fi
fi
if [ -e /usr/lib/debian-installer/retriever/media-retriever ]; then
db_capb backup
db_input critical hw-detect/load_media
if ! db_go; then
cleanup
exit 10
fi
db_capb
db_get hw-detect/load_media
if [ "$RET" = true ] && \
anna media-retriever && \
hw-detect ethdetect/detect_progress_title; then
continue
fi
fi
db_capb backup
db_input high ethdetect/cannot_find
if ! db_go; then
cleanup
exit 10
fi
db_capb
if [ -z "$CHOICES" ]; then
sysfs-update-devnames || true
cleanup
exit 0
fi
done
db_get ethdetect/prompt_missing_firmware
if [ "$RET" = true ]; then
check-missing-firmware $(lsifaces)
else
check-missing-firmware -n $(lsifaces)
fi
sysfs-update-devnames || true
cleanup

37
hotplug-pcmcia.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
#
# hotplug-pcmcia.sh - Handle hotplug events for PCMCIA devices during detection
#
log () {
logger -t hotplug-pcmcia "$@"
}
TYPE="$1"
case $TYPE in
net)
if [ "$INTERFACE" = "" ]; then
log "Got net event without interface"
exit 1
fi
log "Detected PCMCIA network interface $INTERFACE"
echo $INTERFACE >>/etc/network/devhotplug
;;
# PCI hotplugging is deprecated (2.4 kernels only)
pci)
log "PCI event is deprecated."
exit 1
;;
pcmcia_socket)
log "Got pcmcia_socket event"
;;
*)
log "Got unsupported event type \"$TYPE\""
exit 1
;;
esac

View File

@ -0,0 +1,3 @@
#!/bin/sh
set -e

View File

@ -0,0 +1,27 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
# copy any loose firmware files to /target (incl. subdirs)
if [ -d /lib/firmware ]; then
for f in /lib/firmware/*; do
if [ -e "$f" ]; then
mkdir -p /target/lib/firmware/
cp -a "$f" /target/lib/firmware/
fi
done
fi
# enable non-free repository if any firmware / injected drivers are
# detected.
if [ -d /var/cache/firmware ]; then
for deb in /var/cache/firmware/*.deb; do
if [ -f "$deb" ]; then
need_nonfree=1
fi
done
fi
if [ "$need_nonfree" ]; then
db_set apt-setup/non-free true
fi

View File

@ -0,0 +1,26 @@
#! /bin/sh
set -e
# We need to do this after the base system has been installed so that
# laptop-detect is available.
SUBARCH="$(archdetect)"
# Install mouseemu on systems likely to have single-button mice
case $SUBARCH in
i386/mac|amd64/mac)
if apt-install laptop-detect && \
chroot /target laptop-detect >/dev/null 2>&1; then
apt-install mouseemu || true
fi
;;
powerpc/powermac_*)
# mouseemu causes an oops somewhere in the input layer on
# powerpc64 at the moment, so don't install it.
if [ ! -d /proc/ppc64 ]; then
apt-install mouseemu || true
fi
;;
esac
exit 0

View File

@ -0,0 +1,21 @@
#!/bin/sh
set -e
deb_package () {
ar p "$1" control.tar.gz | tar zxO ./control | grep 'Package:' | sed -e 's/Package: *//'
}
# install cached firmware debs
if [ -d /var/cache/firmware ]; then
for deb in /var/cache/firmware/*.deb; do
if [ -f "$deb" ]; then
cp -a "$deb" /target/tmp
# TODO debconf passthrough
if ! in-target dpkg -i "/tmp/$(basename "$deb")"; then
# dpkg failed, force removal of package
in-target dpkg --force-depends --remove "$(deb_package "$deb")" || true
fi
rm -f "/target/tmp/$deb"
fi
done
fi

533
hw-detect.sh Executable file
View File

@ -0,0 +1,533 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
#set -x
if [ -z "$1" ]; then
PROGRESSBAR=hw-detect/detect_progress_step
else
PROGRESSBAR=$1
fi
NEWLINE="
"
MISSING_MODULES_LIST=""
SUBARCH="$(archdetect)"
finish_install=/usr/lib/finish-install.d/30hw-detect
LOAD_IDE=""
if db_get hw-detect/load-ide && [ "$RET" = true ]; then
LOAD_IDE=1
fi
# Check for virtio devices
if [ -d /sys/bus/pci/devices ] && \
grep -q 0x1af4 /sys/bus/pci/devices/*/vendor 2>/dev/null && \
! grep -q ^virtio_ /proc/modules; then
anna-install virtio-modules || true
fi
if [ -x /sbin/depmod ]; then
depmod -a > /dev/null 2>&1 || true
fi
log () {
logger -t hw-detect "$@"
}
is_not_loaded() {
! ((cut -d" " -f1 /proc/modules | grep -q "^$1\$") || \
(cut -d" " -f1 /proc/modules | sed -e 's/_/-/g' | grep -q "^$1\$"))
}
is_available () {
[ "$(modprobe -l $1)" ] || return 1
}
# Module as first parameter, description of device the second.
missing_module () {
if ! in_list "$1" "$MISSING_MODULES_LIST"; then
if [ -n "$MISSING_MODULES_LIST" ]; then
MISSING_MODULES_LIST="$MISSING_MODULES_LIST, "
fi
MISSING_MODULES_LIST="$MISSING_MODULES_LIST$1 ($2)"
fi
}
# The list can be delimited with spaces or spaces and commas.
in_list() {
echo "$2" | grep -q "\(^\| \)$1\(,\| \|$\)"
}
snapshot_devs() {
echo -n `grep : /proc/net/dev | cut -d':' -f1`
}
compare_devs() {
local olddevs="$1"
local devs="$2"
local dev newdevs
newdevs=
for dev in $devs; do
if ! echo " $olddevs " | grep -q " $dev "; then
newdevs="${newdevs:+$newdevs }$dev"
fi
done
echo "$newdevs"
}
load_module() {
local module="$1"
local cardname="$2"
local devs=""
local olddevs=""
local newdev=""
old=`cat /proc/sys/kernel/printk`
echo 0 > /proc/sys/kernel/printk
devs="$(snapshot_devs)"
if log-output -t hw-detect modprobe -v -b "$module"; then
olddevs="$devs"
devs="$(snapshot_devs)"
newdevs="$(compare_devs "$olddevs" "$devs")"
# Make sure space is used as a delimiter.
IFS_SAVE="$IFS"
IFS=" "
if [ -n "$newdevs" -a -n "$cardname" ]; then
mkdir -p /etc/network
for dev in $newdevs; do
echo "${dev}:${cardname}" >> /etc/network/devnames
done
fi
IFS="$IFS_SAVE"
else
log "Error loading '$module'"
if [ "$module" != floppy ] && [ "$module" != ide-floppy ] && \
[ "$module" != ide-cd ] && [ "$module" != ide-generic ]; then
db_subst hw-detect/modprobe_error CMD_LINE_PARAM "modprobe -v -b $module"
db_input medium hw-detect/modprobe_error || [ $? -eq 30 ]
db_go
fi
fi
echo $old > /proc/sys/kernel/printk
}
# Some pci chipsets are needed or there can be DMA or other problems.
get_ide_chipset_info() {
for ide_module in $(find /lib/modules/*/kernel/drivers/ide/pci/ -type f 2>/dev/null); do
if [ -e $ide_module ]; then
baseidemod=$(echo $ide_module | sed 's/\.ko$//; s/.*\///')
echo "$baseidemod:IDE chipset support"
fi
done
}
# Return list of lines formatted "module:Description"
get_detected_hw_info() {
if [ "${SUBARCH%%/*}" = powerpc ]; then
discover-mac-io
if [ "$SUBARCH" = powerpc/chrp_rs6k ] || \
[ "$SUBARCH" = powerpc/chrp_ibm ]; then
discover-ibm
fi
fi
if [ "${SUBARCH%%/*}" = sparc ]; then
discover-sbus
fi
if [ -d /sys/bus/usb ]; then
echo "usb-storage:USB storage"
fi
}
# NewWorld PowerMacs don't want floppy or ide-floppy, and on some models
# (e.g. G5s) the kernel hangs when loading the module.
get_floppy_info() {
case $SUBARCH in
powerpc/powermac_newworld) ;;
*) echo "floppy:Linux Floppy" ;;
esac
}
get_ide_floppy_info() {
case $SUBARCH in
powerpc/powermac_newworld) ;;
*) echo "ide-floppy:Linux IDE floppy" ;;
esac
}
# Manually load modules to enable things we can't detect.
# XXX: This isn't the best way to do this; we should autodetect.
# The order of these modules are important.
get_manual_hw_info() {
if [ "$LOAD_IDE" ]; then
get_floppy_info
get_ide_chipset_info
echo "ide-generic:Linux IDE support"
get_ide_floppy_info
echo "ide-disk:Linux ATA DISK"
echo "ide-cd:Linux ATAPI CD-ROM"
fi
}
# Should be greater than the number of kernel modules we can reasonably
# expect it will ever need to load.
MAX_STEPS=1000
OTHER_STEPS=4
# Use 1/10th of the progress bar for the non-module-load steps.
OTHER_STEPSIZE=$(expr $MAX_STEPS / 10 / $OTHER_STEPS)
db_progress START 0 $MAX_STEPS $PROGRESSBAR
db_progress INFO hw-detect/detect_progress_step
# TODO: Can possibly be removed if udev will load yenta_socket automatically
# Load yenta_socket, if hardware is available, for Cardbus cards.
if [ -d /sys/bus/pci/devices ] && \
grep -q 0x060700 /sys/bus/pci/devices/*/class 2>/dev/null && \
! grep -q ^yenta_socket /proc/modules; then
db_subst hw-detect/load_progress_step CARDNAME "Cardbus bridge"
db_subst hw-detect/load_progress_step MODULE "yenta_socket"
db_progress INFO hw-detect/load_progress_step
log "Detected Cardbus bridge, loading yenta_socket"
load_module yenta_socket
# Ugly hack, but what's the alternative?
sleep 3 || true
fi
# Load the ethernet gadget network driver (g_ether) on S3C2410/S3C2440 (Openmoko GTA01/02)
if [ -d /sys/bus/platform/devices/s3c2440-usbgadget -o \
-d /sys/bus/platform/devices/s3c2410-usbgadget ] ; then
db_subst hw-detect/load_progress_step CARDNAME "S3C2410/S3C2440 SoC"
db_subst hw-detect/load_progress_step MODULE "g_ether"
db_progress INFO hw-detect/load_progress_step
log "Detected S3C2410/S3C2440 SoC, loading g_ether"
load_module g_ether
register-module g_ether
fi
# Load xenbus_probe_frontend if we're running under the Xen hypervisor, so
# that it can deal with autoloading such things as xen-blkfront and
# xen-netfront.
if [ "$(cat /sys/hypervisor/type 2>/dev/null || true)" = xen ] && \
[ ! -d /sys/bus/xen ]; then
db_subst hw-detect/load_progress_step CARDNAME "Xen frontend"
db_subst hw-detect/load_progress_step MODULE "xenbus_probe_frontend"
db_progress INFO hw-detect/load_progress_step
log "Detected Xen hypervisor, loading xenbus_probe_frontend"
load_module xenbus_probe_frontend
register-module -i xenbus_probe_frontend
fi
# If using real hotplug, re-run the rc scripts to pick up new modules.
# TODO: this just loads modules itself, rather than handing back a list
# Since we've just run depmod, new modules might be available, so we
# must trigger as well as settle.
update-dev >/dev/null
ALL_HW_INFO=$(get_detected_hw_info; get_manual_hw_info)
db_progress STEP $OTHER_STEPSIZE
# Remove modules that are already loaded or not available, and construct
# the list for the question.
LIST=""
PROCESSED=""
AVAIL_MODULES="$(find /lib/modules/$(uname -r)/ | sed 's!.*/!!' | cut -d . -f 1)"
LOADED_MODULES="$(cut -d " " -f 1 /proc/modules) $(cut -d " " -f 1 /proc/modules | sed -e 's/_/-/g')"
IFS_SAVE="$IFS"
IFS="$NEWLINE"
for device in $ALL_HW_INFO; do
module="${device%%:*}"
cardname="${device##*:}"
if [ "$module" != "ignore" -a "$module" != "" ] &&
! in_list "$module" "$LOADED_MODULES" &&
! in_list "$module" "$PROCESSED"
then
if [ -z "$cardname" ]; then
cardname="[Unknown]"
fi
if in_list "$module" "$AVAIL_MODULES"; then
LIST="${LIST:+$LIST, }$module ($(echo "$cardname" | sed 's/,/ /g'))"
PROCESSED="$PROCESSED $module"
else
missing_module "$module" "$cardname"
fi
fi
done
IFS="$IFS_SAVE"
db_progress STEP $OTHER_STEPSIZE
if [ "$LIST" ]; then
# Ask which modules to install.
db_subst hw-detect/select_modules list "$LIST"
db_set hw-detect/select_modules "$LIST"
db_input medium hw-detect/select_modules || true
db_go || exit 10 # back up
db_get hw-detect/select_modules
LIST="$RET"
fi
list_to_lines() {
echo "$LIST" | sed 's/, /\n/g'
}
# Work out amount to step per module load. expr rounds down, so
# it may not get quite to 100%, but will at least never exceed it.
MODULE_STEPS=$(expr \( $MAX_STEPS - \( $OTHER_STEPS \* $OTHER_STEPSIZE \) \))
if [ "$LIST" ]; then
MODULE_STEPSIZE=$(expr $MODULE_STEPS / $(list_to_lines | wc -l))
fi
IFS="$NEWLINE"
for device in $(list_to_lines); do
module="${device%% *}"
cardname="`echo $device | cut -d'(' -f2 | sed 's/)$//'`"
# Restore IFS after extracting the fields.
IFS="$IFS_SAVE"
if [ -z "$module" ] ; then module="[Unknown]" ; fi
if [ -z "$cardname" ] ; then cardname="[Unknown]" ; fi
log "Detected module '$module' for '$cardname'"
if is_not_loaded "$module"; then
db_subst hw-detect/load_progress_step CARDNAME "$cardname"
db_subst hw-detect/load_progress_step MODULE "$module"
db_progress INFO hw-detect/load_progress_step
if [ "$cardname" = "[Unknown]" ]; then
load_module "$module"
else
load_module "$module" "$cardname"
fi
fi
db_progress STEP $MODULE_STEPSIZE
IFS="$NEWLINE"
done
IFS="$IFS_SAVE"
if [ -z "$LIST" ]; then
db_progress STEP $MODULE_STEPS
fi
# Load ide-generic and check if that results in new block devices.
# If so, make sure it is added to the initrd for the installed system.
# Note: this may need to be done for more systems than just systems
# that have an ISA bus, but that seems like a good start; it could also
# be done unconditionally.
if [ -z "$LOAD_IDE" ] && is_not_loaded ide-generic && \
[ -e /sys/bus/isa ] && is_available ide-generic; then
update-dev --settle >/dev/null
blockdev_count=$(ls /sys/block | wc -w)
log "ISA bus detected; loading module 'ide-generic'"
load_module ide-generic
update-dev --settle >/dev/null
if [ $(ls /sys/block | wc -w) -gt $blockdev_count ]; then
log "New devices detected after loading ide-generic"
# This will tell initramfs-tools to load ide-generic
kopts=
if db_get debian-installer/add-kernel-opts && [ "$RET" ]; then
kopts="$RET"
fi
if ! echo "$kopt" | grep -Eq "(^| )all_generic_ide(=1|)( |$)"; then
db_set debian-installer/add-kernel-opts \
"${kopts:+$kopts }all_generic_ide=1"
fi
fi
fi
if ! is_not_loaded ohci1394 || ! is_not_loaded firewire-ohci; then
# if firewire was found, try to enable firewire cd support
if is_not_loaded sbp2 && is_not_loaded firewire-sbp2 && \
is_available scsi_mod; then
sbp2module=
if is_available firewire-sbp2; then
sbp2module=firewire-sbp2
elif is_available sbp2; then
sbp2module=sbp2
fi
if [ -n "$sbp2module" ]; then
db_subst hw-detect/load_progress_step CARDNAME "FireWire CDROM support"
db_subst hw-detect/load_progress_step MODULE "$sbp2module"
db_progress INFO hw-detect/load_progress_step
load_module "$sbp2module"
register-module "$sbp2module"
else
missing_module firewire-sbp2 "FireWire CDROM"
fi
fi
db_progress STEP $OTHER_STEPSIZE
fi
apply_pcmcia_resource_opts() {
local config_opts=/etc/pcmcia/config.opts
# Idempotency
if ! [ -f ${config_opts}.orig ]; then
cp $config_opts ${config_opts}.orig
fi
cp ${config_opts}.orig $config_opts
local mode=""
local rmode=""
local type=""
local value=""
while [ -n "$1" ] && [ -n "$2" ] && [ -n "$3" ]; do
if [ "$1" = exclude ]; then
mode=exclude
rmode=include
shift
elif [ "$1" = include ]; then
mode=include
rmode=exclude
shift
fi
type="$1"
shift
value="$1"
shift
if grep -q "^$rmode $type $value\$" $config_opts; then
sed "s/^$rmode $type $value\$/$mode $type $value/" \
$config_opts >${config_opts}.new
mv ${config_opts}.new $config_opts
else
echo "$mode $type $value" >>$config_opts
fi
done
}
# get pcmcia running if possible
PCMCIA_INIT=/etc/init.d/pcmciautils
if [ -x "$PCMCIA_INIT" ]; then
if is_not_loaded pcmcia_core; then
db_input low hw-detect/pcmcia_resources || true
db_go || true
if db_get hw-detect/pcmcia_resources && [ "$RET" ]; then
apply_pcmcia_resource_opts $RET
fi
# cdebconf doesn't set seen flags, so this would normally be
# asked again on subsequent hw-detect runs, which is
# annoying.
db_fset hw-detect/pcmcia_resources seen true || true
db_progress INFO hw-detect/pcmcia_step
$PCMCIA_INIT start 2>&1 | log
db_progress STEP $OTHER_STEPSIZE
fi
fi
have_pcmcia=0
if ls /sys/class/pcmcia_socket/* >/dev/null 2>&1; then
if db_get hw-detect/start_pcmcia && [ "$RET" = false ]; then
have_pcmcia=0
else
have_pcmcia=1
fi
fi
# find Cardbus network cards
cardbus_check_netdev()
{
local socket="$1"
local netdev="$2"
if [ -L "$netdev/device" ] && \
[ -d "$socket/device/$(basename "$(readlink "$netdev/device")")" ]; then
echo "$(basename "$netdev")" >> /etc/network/devhotplug
fi
}
# Try to do this only once..
if [ "$have_pcmcia" -eq 1 ] && \
! grep -q pcmciautils /var/lib/apt-install/queue 2>/dev/null; then
log "Detected PCMCIA, installing pcmciautils."
apt-install pcmciautils || true
for socket in /sys/class/pcmcia_socket/*; do
for netdev in /sys/class/net/*; do
cardbus_check_netdev "$socket" "$netdev"
done
done
if db_get hw-detect/pcmcia_resources && [ -n "$RET" ]; then
echo "mkdir /target/etc/pcmcia 2>/dev/null || true" \
>>$finish_install
echo "cp /etc/pcmcia/config.opts /target/etc/pcmcia/config.opts" \
>>$finish_install
fi
fi
# Install udev into target
apt-install udev || true
# Install pciutils/usbutils
if [ -d /sys/bus/pci ]; then
apt-install pciutils || true
fi
if [ -d /sys/bus/usb ]; then
apt-install usbutils || true
fi
# If hardware has support for pmu, install pbbuttonsd
if [ -d /sys/class/misc/pmu/ ]; then
apt-install pbbuttonsd || true
fi
# Install eject?
if [ -n "$(list-devices cd; list-devices maybe-usb-floppy)" ]; then
apt-install eject || true
fi
# Install opeal-prd for OpenPOWER machines LP: #1555904
if [ -d /sys/firmware/devicetree/base/ibm,opal/diagnostics ]; then
apt-install opal-prd || true
fi
# Install optimised libc based on CPU type
case "$(udpkg --print-architecture)" in
i386)
case "$(grep '^cpu family' /proc/cpuinfo | head -n1 | cut -d: -f2)" in
" 6"|" 15")
# intel 686 or Amd k6.
apt-install libc6-i686 || true
;;
esac
;;
sparc)
if grep -q '^type.*: sun4u' /proc/cpuinfo ; then
# sparc v9 or v9b
if grep -q '^cpu.*: .*UltraSparc III' /proc/cpuinfo; then
apt-install libc6-sparcv9b || true
fi
fi
;;
esac
db_progress SET $MAX_STEPS
db_progress STOP
if [ -n "$MISSING_MODULES_LIST" ]; then
log "Missing modules '$MISSING_MODULES_LIST"
fi
check-missing-firmware
sysfs-update-devnames
# Let userspace /dev tools rescan the devices
update-dev --settle >/dev/null
exit 0

1
net-hotplug.rules Normal file
View File

@ -0,0 +1 @@
SUBSYSTEM=="net", RUN+="/etc/hotplug.d/net/hw-detect.hotplug"

23
net-hotplug.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# Hook into net events so that we can record hotpluggable interfaces for
# netcfg.
log () {
logger -t net/hw-detect.hotplug "$@"
}
if [ -z "$INTERFACE" ]; then
log "Got net event without interface"
exit 1
fi
case $ACTION in
add|register)
log "Detected hotpluggable network interface $INTERFACE"
mkdir -p /etc/network
echo "$INTERFACE" >>/etc/network/devhotplug
;;
esac
exit 0

25
sbus.list Normal file
View File

@ -0,0 +1,25 @@
# Format is: 'id-in-prtconf:description:driver:target'
# <target> can either be "initrd" or "load" (adds module in /etc/modules)
# Sun Microsystems
SUNW,hme:"HAPPY MEAL" 10/100 Ethernet:sunhme:load
le:"LANCE" 10Mbit Ethernet:sunlance:load
ledma:"LANCE" 10Mbit Ethernet:sunlance:load
lebuffer:"LANCE" 10Mbit Ethernet:sunlance:load
qfe:"Quattro HME" Ethernet:sunhme:load
SUNW,qfe:"Quattro HME" Ethernet:sunhme:load
esp:ESP SCSI:sun_esp:initrd
SUNW,esp:ESP SCSI:sun_esp:initrd
SUNW,fas:FAS-336 ESP SCSI:sun_esp:initrd
qec:QuadEthernet 10baseT Ethernet:sunqe:load
be:BigMAC 10/100baseT Ethernet:sunbmac:load
# QLogic Corp.
ptisp:PTI Qlogic ISP SCSI:qlogicpti:initrd
PTI,ptisp:PTI Qlogic ISP SCSI:qlogicpti:initrd
QLGC,isp:Qlogic ISP SCSI:qlogicpti:initrd
SUNW,isp:Qlogic ISP SCSI:qlogicpti:initrd
# MyriCOM, Inc.
MYRICOM,mlanai:MyriNET Gigabit Ethernet:myri_sbus:load
myri:MyriNET Gigabit Ethernet:myri_sbus:load

28
sysfs-update-devnames.sh Executable file
View File

@ -0,0 +1,28 @@
#! /bin/sh -e
# Make sure that /etc/network/devnames is up to date, using sysfs. In
# hotplug land, we may not get a chance to update it otherwise.
if [ ! -d /sys/class/net ] || ! type lspci >/dev/null 2>&1; then
exit
fi
for dev in $(grep : /proc/net/dev | sort | cut -d: -f1); do
if grep "^$dev:" /etc/network/devnames >/dev/null 2>&1; then
continue
fi
if [ -f "/sys/class/net/$dev/device/vendor" ] && \
[ -f "/sys/class/net/$dev/device/device" ]; then
vendor="$(sed 's/^0x//' "/sys/class/net/$dev/device/vendor")"
device="$(sed 's/^0x//' "/sys/class/net/$dev/device/device")"
# 'tail -n 1' because for some reason lspci outputs two
# Device: lines.
vendorname="$(lspci -d "$vendor:$device" -m -v | grep ^Vendor: | tail -n 1 | sed 's/^Vendor:[[:space:]]*//; s/,/\\,/g')"
devicename="$(lspci -d "$vendor:$device" -m -v | grep ^Device: | tail -n 1 | sed 's/^Device:[[:space:]]*//; s/,/\\,/g')"
if [ "$vendorname" ] || [ "$devicename" ]; then
echo "$dev:$vendorname $devicename" >> /etc/network/devnames
fi
elif [ "$(readlink -f /sys/class/net/$dev/device/bus)" = /sys/bus/ieee1394 ] || \
[ "$(readlink -f /sys/class/net/$dev/device/bus)" = /sys/bus/firewire ]; then
echo "$dev:FireWire (IEEE 1394) Ethernet device" >> /etc/network/devnames
fi
done