Add a globally applied substitution pattern for the console major number.

Use it when creating a temporary node for the console.
MAKEDEV -M should now output what it is doing.
This commit is contained in:
dsl 2007-03-09 13:57:54 +00:00
parent e893f67fa1
commit 5c2f2286e3
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/awk -
#
# $NetBSD: MAKEDEV.awk,v 1.16 2005/06/14 20:47:46 he Exp $
# $NetBSD: MAKEDEV.awk,v 1.17 2007/03/09 13:57:54 dsl Exp $
#
# Copyright (c) 2003 The NetBSD Foundation, Inc.
# All rights reserved.
@ -92,6 +92,11 @@ BEGIN {
}
close(file)
}
CONSOLE_CMAJOR = chr["cons"]
if (CONSOLE_CMAJOR == "") {
print "ERROR: no entry for 'cons' in majors file" > "/dev/stderr"
exit 1
}
# read MD config file for MD device targets
cfgfile = srcdir "/etc/etc." machine "/MAKEDEV.conf"
@ -214,7 +219,7 @@ BEGIN {
print "# Generated from:"
# MAKEDEV.awk (this script) RCS Id
ARCSID = "$NetBSD: MAKEDEV.awk,v 1.16 2005/06/14 20:47:46 he Exp $"
ARCSID = "$NetBSD: MAKEDEV.awk,v 1.17 2007/03/09 13:57:54 dsl Exp $"
gsub(/\$/, "", ARCSID)
print "# " ARCSID
@ -264,6 +269,7 @@ BEGIN {
sub(/%DISKMINOROFFSET%/, DISKMINOROFFSET)
sub(/%RAWDISK_OFF%/, RAWDISK_OFF)
sub(/%RAWDISK_NAME%/, RAWDISK_NAME)
sub(/%CONSOLE_CMAJOR%/, CONSOLE_CMAJOR)
parsed = ""
line = $0
while (match(line, /%[gu]id_[a-z]*%/)) {

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: MAKEDEV.tmpl,v 1.79 2007/03/03 06:36:01 apb Exp $
# $NetBSD: MAKEDEV.tmpl,v 1.80 2007/03/09 13:57:54 dsl Exp $
#
# Copyright (c) 2003,2007 The NetBSD Foundation, Inc.
# All rights reserved.
@ -1801,7 +1801,7 @@ create_mfs_dev()
mount_mfs -b 4096 -f 512 -s $fs_size -n $ninode -p 07555 -o union swap $dev_mountpoint
cd $dev_mountpoint
mknod -m 600 -g 0 -u 0 temp_console c %cons_chr% 0
mknod -m 600 -g 0 -u 0 temp_console c %CONSOLE_CMAJOR% 0
exec >temp_console 2>&1
rm temp_console
echo "Created mfs $dev_mountpoint ($fs_size blocks, $ninode inodes)"