*BANG* *BANG* *BANG* *BANG* *BANG* *BANG* *CLICK* *CLICK* *CLICK*

*BANG* *BANG* *BANG* *BANG* *BANG* *BANG* *CLICK* *CLICK* *CLICK*

Death to the stripped down BOOTMFS kernel for boot floppies and all the
cruft that goes along with it.
This commit is contained in:
John Baldwin 2004-01-26 20:02:01 +00:00
parent c0731f81d3
commit 96300f5dc8
8 changed files with 0 additions and 604 deletions

View File

@ -1,52 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
sed \
-e '/AHC_REG_PRETTY_PRINT/d' \
-e '/AHD_REG_PRETTY_PRINT/d' \
-e '/COMPAT_FREEBSD4/d' \
-e '/DDB/d' \
-e '/DEBUG/d' \
-e '/INVARIANTS/d' \
-e '/INVARIANT_SUPPORT/d' \
-e '/KTRACE/d' \
-e '/NFSSERVER/d' \
-e '/NFS_ROOT/d' \
-e '/PROCFS/d' \
-e '/PSEUDOFS/d' \
-e '/SOFTUPDATES/d' \
-e '/SYSV/d' \
-e '/UFS_DIRHASH/d' \
-e '/WITNESS/d' \
-e '/_KPOSIX_PRIORITY_SCHEDULING/d' \
-e '/ acpi/d' \
-e '/ atapist /d' \
-e '/ faith /d' \
-e '/ gif /d' \
-e '/ lpt /d' \
-e '/ pass /d' \
-e '/ pmtimer$/d' \
-e '/ ppi /d' \
-e '/ ppp /d' \
-e '/ pty /d' \
-e '/ random /d' \
-e '/ ses /d' \
-e '/ splash /d' \
-e '/ ugen /d' \
-e '/ uhid /d' \
-e '/ ulpt /d' \
-e '/ urio /d' \
-e '/ uscanner /d' \
-e 's/ident.*GENERIC/ident BOOTMFS/g'
echo "options MUTEX_NOINLINE"
echo "options NETGRAPH"
echo "options NETGRAPH_ETHER"
echo "options NETGRAPH_PPPOE"
echo "options NETGRAPH_SOCKET"
echo "options SCSI_NO_OP_STRINGS"
echo "options SCSI_NO_SENSE_STRINGS"

View File

@ -1,96 +0,0 @@
# Driver config file for boot floppies
#
# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# drv: driver name in kernel config file
# filename: filename of kernel module (without .ko)
# floppy: 2 (mfsroot.flp), 3 (drivers.flp)
# type: 'options' (for a kernel option) or anything else for a driver
# description: short description of the driver
#
# If you add functionality here, please update drivers.conf(5).
#
#drv filename floppy type description
aue if_aue 2 network "ADMtek USB ethernet adapter"
bge if_bge 2 network "Broadcom BCM570xx Gigabit Ethernet"
bfe if_bfe 2 network "Broadcom BCM440x PCI ethernet card"
cue if_cue 2 network "CATC USB ethernet adapter"
dc if_dc 2 network "DEC/Intel 21143 (and clones) PCI fast ethernet card"
ed if_ed 2 network "NE[12]000, SMC Ultra, 3c503, DS8390 ISA ethernet cards"
fe if_fe 2 network "Fujitsu MB8696x based cards"
fxp if_fxp 2 network "Intel EtherExpress Pro/100B PCI Fast Ethernet card"
kue if_kue 2 network "Kawasaki LSI USB ethernet adapter"
lnc if_lnc 2 network "NE2100, NE32-VL Lance Ethernet cards"
miibus miibus 2 network "MII bus support"
pcn if_pcn 2 network "AMD Am79c79x PCI ethernet card"
re if_re 2 network "RealTek 8139C+/8169/8169S/8110S PCI ethernet card"
rl if_rl 2 network "RealTek 8129/8139 PCI ethernet card"
sf if_sf 2 network "Adaptec AIC-6915 PCI ethernet card"
sis if_sis 2 network "SiS 900/SiS 7016 PCI ethernet card"
ste if_ste 2 network "Sundance ST201 PCI ethernet card"
tun if_tun 2 network "Tunnel software network interface"
txp if_txp 2 network "3COM 3cR990 PCI ethernet card"
vr if_vr 2 network "VIA VT3043/VT86C100A Rhine PCI ethernet card"
wb if_wb 2 network "Winbond W89C840F PCI ethernet card"
xe if_xe 2 network "Xircom pccard ethernet"
xl if_xl 2 network "3COM 3c90x / 3c90xB PCI ethernet card"
SYSVMSG sysvmsg 2 options "SYSV-style message queues"
SYSVSEM sysvsem 2 options "SYSV-style semaphores"
SYSVSHM sysvshm 2 options "SYSV-style shared memory"
firewire firewire 3 bus "FireWire/IEEE-1394 OHCI card"
amr amr 3 disk "AMI MegaRAID"
ips ips 3 disk "IBM ServeRAID"
sbp sbp 3 disk "SBP-2 SCSI over FireWire"
trm trm 3 disk "Tekram DC395X SCSI cards"
twe twe 3 disk "3ware ATA RAID"
an if_an 3 network "Aironet 4500/4800 802.11 PCMCIA/ISA/PCI card"
awi if_awi 3 network "BayStack 660 and others"
axe if_axe 3 network "ASIX AX88172 USB 2.0 Ethernet"
de if_de 3 network "DEC DE435 PCI NIC or other DC21040-AA based card"
ex if_ex 3 network "Intel EtherExpress Pro/10 and Pro/10+"
fwe if_fwe 3 network "Ethernet over FireWire"
ie if_ie 3 network "EtherExpress 8/16, 3C507, StarLAN 10 etc."
sk if_sk 3 network "SysKonnect PCI gigabit ethernet card"
sn if_sn 3 network "SMC's 9000 series of ethernet chips"
ti if_ti 3 network "Alteon Networks PCI gigabit ethernet card"
tl if_tl 3 network "Texas Instruments ThunderLAN PCI ethernet card"
tx if_tx 3 network "SMC 9432TX ethernet card"
wi if_wi 3 network "Lucent WaveLAN/IEEE 802.11 PCMCIA card"
wlan rc4 3 network "802.11 crypto support"
wlan wlan 3 network "802.11 support"
CD9660 cd9660 2 options "ISO 9660 Filesystem"
MSDOSFS msdosfs 3 options "MSDOS filsystem"
NFSCLIENT nfsclient 3 options "Network Filesystem Client"
agp agp 3 video "AGP Host Bridge support"

View File

@ -1,119 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
if [ $# -lt 1 ]; then
FDSIZE=NORMAL
else
FDSIZE=$1
fi
if [ "${FDSIZE}" = "SMALL" ]; then
sed -e 's/ident.*GENERIC/ident BOOTMFS/g' \
-e '/COMPAT_FREEBSD4/d' \
-e '/DDB/d' \
-e '/DEBUG/d' \
-e '/INVARIANTS/d' \
-e '/INVARIANT_SUPPORT/d' \
-e '/KTRACE/d' \
-e '/NFSSERVER/d' \
-e '/NFS_ROOT/d' \
-e '/PROCFS/d' \
-e '/PSEUDOFS/d' \
-e '/SOFTUPDATES/d' \
-e '/SYSV/d' \
-e '/UFS_DIRHASH/d' \
-e '/WITNESS/d' \
-e '/ adv /d' \
-e '/ ahc /d' \
-e '/ amd /d' \
-e '/ an /d' \
-e '/ atapifd /d' \
-e '/ atapist /d' \
-e '/ awi /d' \
-e '/ ch /d' \
-e '/ dc /d' \
-e '/ de /d' \
-e '/ em /d' \
-e '/ faith /d' \
-e '/ fxp /d' \
-e '/ gif /d' \
-e '/ isp /d' \
-e '/ lpt /d' \
-e '/ pass /d' \
-e '/ pci$/d' \
-e '/ pcn /d' \
-e '/ plip /d' \
-e '/ ppbus /d' \
-e '/ ppc$/d' \
-e '/ ppi /d' \
-e '/ ppp /d' \
-e '/ pty /d' \
-e '/ random /d' \
-e '/ rl /d' \
-e '/ sa /d' \
-e '/ ses /d' \
-e '/ sf /d' \
-e '/ sis /d' \
-e '/ sl /d' \
-e '/ splash /d' \
-e '/ ste /d' \
-e '/ sym /d' \
-e '/ tl /d' \
-e '/ tx /d' \
-e '/ txp /d' \
-e '/ vr /d' \
-e '/ vx /d' \
-e '/ wb /d' \
-e '/ wi /d' \
-e '/ xl /d'
echo "options ATA_NOPCI"
else
sed -e 's/ident.*GENERIC/ident BOOTMFS/g' \
-e '/COMPAT_FREEBSD4/d' \
-e '/DDB/d' \
-e '/DEBUG/d' \
-e '/INVARIANTS/d' \
-e '/INVARIANT_SUPPORT/d' \
-e '/KTRACE/d' \
-e '/NFSSERVER/d' \
-e '/NFS_ROOT/d' \
-e '/PROCFS/d' \
-e '/PSEUDOFS/d' \
-e '/SOFTUPDATES/d' \
-e '/SYSV/d' \
-e '/UFS_DIRHASH/d' \
-e '/WITNESS/d' \
-e '/ atapifd /d' \
-e '/ atapist /d' \
-e '/ ch /d' \
-e '/ faith /d' \
-e '/ gif /d' \
-e '/ lpt /d' \
-e '/ pass /d' \
-e '/ plip /d' \
-e '/ ppbus /d' \
-e '/ ppc$/d' \
-e '/ ppi /d' \
-e '/ ppp /d' \
-e '/ pty /d' \
-e '/ random /d' \
-e '/ sa /d' \
-e '/ ses /d' \
-e '/ sl /d' \
-e '/ splash /d'
fi
echo "options NETGRAPH"
echo "options NETGRAPH_ETHER"
echo "options NETGRAPH_PPPOE"
echo "options NETGRAPH_SOCKET"
echo "options SCSI_NO_OP_STRINGS"
echo "options SCSI_NO_SENSE_STRINGS"

View File

@ -1,40 +0,0 @@
# Driver config file for boot floppies
#
# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# drv: driver name in kernel config file
# filename: filename of kernel module (without .ko)
# floppy: 2 (mfsroot.flp), 3 (drivers.flp - not implemented yet)
# type: 'options' (for a kernel option) or anything else for a driver
# description: short description of the driver
#
#drv filename floppy type description
NFSCLIENT nfsclient 2 options "Network Filesystem Client"
MSDOSFS msdosfs 2 options "MSDOS filsystem"
CD9660 cd9660 2 options "ISO 9660 Filesystem"

View File

@ -1,63 +0,0 @@
# Driver config file for boot floppies
#
# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# drv: driver name in kernel config file
# filename: filename of kernel module (without .ko)
# floppy: 2 (mfsroot.flp), 3 (drivers.flp)
# type: 'options' (for a kernel option) or anything else for a driver
# description: short description of the driver
#
# If you add functionality here, please update drivers.conf(5).
#
#drv filename floppy type description
an if_an 2 network "Aironet 4500/4800 802.11 PCMCIA/ISA/PCI card"
awi if_awi 2 network "BayStack 660 and others"
dc if_dc 2 network "DEC/Intel 21143 (and clones) PCI fast ethernet card"
ed if_ed 2 network "NE[12]000, SMC Ultra, 3c503, DS8390 cards"
fe if_fe 2 network "Fujitsu MB8696x based cards"
fxp if_fxp 2 network "Intel EtherExpress Pro/100B PCI Fast Ethernet card"
pcn if_pcn 2 network "AMD Am79c79x PCI ethernet card"
rl if_rl 2 network "RealTek 8129/8139 PCI ethernet card"
sf if_sf 2 network "Adaptec AIC-6915 PCI ethernet card"
sis if_sis 2 network "SiS 900/SiS 7016 PCI ethernet card"
ste if_ste 2 network "Sundance ST201 PCI ethernet card"
tl if_tl 2 network "Texas Instruments ThunderLAN PCI ethernet card"
tx if_tx 2 network "SMC 9432TX ethernet card"
vr if_vr 2 network "VIA VT3043/VT86C100A Rhine PCI ethernet card"
wb if_wb 2 network "Winbond W89C840F PCI ethernet card"
wi if_wi 2 network "Lucent WaveLAN/IEEE 802.11 PCMCIA card"
wlan rc4 2 network "802.11 crypto support"
wlan wlan 2 network "802.11 support"
xl if_xl 2 network "3COM 3c90x / 3c90xB PCI ethernet card"
CD9660 cd9660 2 options "ISO 9660 Filesystem"
MSDOSFS msdosfs 2 options "MSDOS filsystem"
#NFSCLIENT nfsclient 2 options "Network Filesystem Client"

View File

@ -1,92 +0,0 @@
#!/usr/bin/awk -f
#
# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org>
# Copyright (c) 2002 Ruslan Ermilov <ru@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
function usage()
{
print "usage: driver-copy2.awk flop_num config_file src_ko_dir dst_ko_dir" > "/dev/stderr";
exit 1;
}
function err(eval, fmt, what)
{
printf "driver-copy2.awk: " fmt "\n", what > "/dev/stderr";
exit eval;
}
function readconfig()
{
while ((r = (getline < config)) > 0) {
sub("#.*$", "");
if (sub(/^[[:alnum:]_]+[ \t]+[[:alnum:]_]+[ \t]+[0-9]+[ \t]+[[:alnum:]_]+[ \t]+\".*\"[ \t]*$/, "&")) {
sub(/[ \t]+/, "#");
sub(/[ \t]+/, "#");
sub(/[ \t]+/, "#");
sub(/[ \t]+/, "#");
sub(/\"/, "");
sub(/\"/, "");
split($0, arg, "#");
flp[arg[2]] = arg[3];
dsc[arg[2]] = arg[5];
}
}
if (r == -1)
err(1, "error reading %s", config);
close(config);
}
BEGIN {
if (ARGC != 5)
usage();
fnum = ARGV[1];
config = ARGV[2];
srcdir = ARGV[3];
dstdir = ARGV[4];
readconfig();
if (system("test -d " srcdir) != 0)
err(1, "cannot find %s directory", srcdir);
if (system("test -d " dstdir) != 0)
err(1, "cannot find %s directory", dstdir);
for (f in flp) {
if (flp[f] != fnum)
continue;
srcfile = srcdir "/" f ".ko";
dstfile = dstdir "/" f ".ko";
dscfile = dstdir "/" f ".dsc";
print "Copying " f ".ko to " dstdir > "/dev/stderr";
if (system("cp " srcfile " " dstfile) != 0)
exit 1;
printf "%s", dsc[f] > dscfile;
close(dscfile);
}
}

View File

@ -1,43 +0,0 @@
#!/usr/bin/awk -f
#
# Copyright (c) 2002 Murray Stokely <murray@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# This script creates the DRIVERS.TXT manifest so users know exactly what
# is contained on the drivers.flp
BEGIN {
printf ("The following device drivers are available on the optional\n");
printf ("drivers.flp image.\n\n");
printf ("%-12s %s\n", "Driver", "Description");
printf ("----------------------------------------------------------------------\n");
}
{
DRIVER = substr(FILENAME, 1, index(FILENAME, ".dsc") -1);
printf ("%-12s %s\n", DRIVER, $0);
}

View File

@ -1,99 +0,0 @@
#!/usr/bin/awk -f
#
# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org>
# Copyright (c) 2002 Ruslan Ermilov <ru@FreeBSD.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
function usage()
{
print "usage: driver-remove.awk config_file BOOTMFS" > "/dev/stderr";
exit 1;
}
function err(eval, fmt, what)
{
printf "driver-remove.awk: " fmt "\n", what > "/dev/stderr";
exit eval;
}
function readconfig()
{
while ((r = (getline < config)) > 0) {
sub("#.*$", "");
if (sub(/^[[:alnum:]_]+[ \t]+[[:alnum:]_]+[ \t]+[0-9]+[ \t]+[[:alnum:]_]+[ \t]+\".*\"[ \t]*$/, "&")) {
sub(/[ \t]+/, "#");
sub(/[ \t]+/, "#");
sub(/[ \t]+/, "#");
sub(/[ \t]+/, "#");
sub(/\"/, "");
sub(/\"/, "");
split($0, arg, "#");
if (arg[4] == "options")
options[arg[1]] = 1;
else
drivers[arg[1]] = 1;
}
}
if (r == -1)
err(1, "error reading %s", config);
close(config);
}
BEGIN {
if (ARGC != 3)
usage();
config = ARGV[1];
bootmfs = ARGV[2];
readconfig();
lines = 0;
while ((r = (getline < bootmfs)) > 0) {
if (/^device[ \t]+[[:alnum:]_]+/) {
dev = $0;
sub(/^device[ \t]+/, "", dev);
sub(/[ \t]+.*$/, "", dev);
if (dev in drivers)
continue;
} else if (/^options[ \t]+[[:alnum:]_]+/) {
opt = $0;
sub(/^options[ \t]+/, "", opt);
sub(/[ \t]+.*$/, "", opt);
if (opt in options)
continue;
}
line[lines++] = $0;
}
if (r == -1)
err(1, "error reading %s", bootmfs);
close(bootmfs);
printf "" > bootmfs;
for (i = 0; i < lines; i++)
print line[i] >> bootmfs;
close(bootmfs);
}