Subject: Re: Unified MAKEDEV
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 10/15/2003 21:00:22
In article <200310152049.h9FKnWWH029888@s102-n054.tele2.cz>,
Jaromir Dolecek <jdolecek@NetBSD.org> wrote:

Looks nice. You might want to take a look at the shell functions
I added in my implementation of the same, and incorporate them
in your MAKEDEV.tmpl to speed things up. I posted it a while ago
here, but I can send you another copy.

christos

>
>There is a template-driven unidifed MAKEDEV framework now committed
>into tree. This produces fully functional MAKEDEV script from
>single MAKEDEV template, removing the need to maintain the
>separate MAKEDEV scripts for every platform.
>This is not activated yet, barring feedback and testing.
>
>There are three compotents of the framework:
>1. etc/MAKEDEV.tmpl - the template
>2. etc.${MACHINE}/MAKEDEV.conf - MD config file
>3. etc/MAKEDEV.awk - script producing the platform MAKEDEV script
>
>Most of the devices in the former MD MAKEDEV scripts
>were moved to the unified template. Only small number of the devices
>was left in the MD parts, basically unique devices of hp300/vax
>or devices/targets varying significantly between platforms (ttyB*,
>tty[a-j], init).
>
>The template contains series of entries such as:
>
>wskbd)
>        rm -f wskbd
>        mknod wskbd c %wskbd_chr% 1
>        chmod 600 wskbd
>        ;;
>
>
>If the platform has defined major for such device, the
>%*_chr% is replaced by the appropriate character device major
>and %*_blk% is replaced by block device major. No explicit
>major number is ever hardcoded into the template, all numbers
>are taken from sys/conf/majors or sys/arch/*/conf/majors.*
>as appropriate.
>If the platform doesn't define major for the device, the
>entry is not added into output and won't appear in final script.
>
>All the pseudo targets (such as 'audit', 'usbs' etc) are
>currently generated into output script even on platforms
>which don't have support for appropriate devices. There
>is no harm with them being present, and this simplifies
>the generation process.
>
>The disk devices are now created using a shell function.  The particular
>function used by platform is chosen according to whether the platform
>supports 8 partitions, 16 partitions, or 16 partitions with
>the high minor offset hack. Every place creating the disk device
>calls the appropriate function, avoiding some cut&paste errors. The info
>about partitioning used by platform is currently stored
>in the MD MAKEDEV.conf file. It is done this way only because
>it simplifies the initial implementation a bit, it would be possible
>to get the information by parsing kernel include files too.
>
>The platform-dependant MAKEDEV manpages are going to be replaced
>by single MI manpage containing entries for all devices for all
>platforms, so MAKEDEV(8) would become a cross-platform reference.
>
>Unless there would be serious objections to this thing, I'd
>switch over all archs once I'd confirm the list of generated devices
>matches the former MD MAKEDEV script.
>
>Before this happens, the script for any given platform can
>be generated as:
>	> export MACHINE=luna68k MACHINE_ARCH=m68k
>	> cd src/etc && awk -f MAKEDEV.awk MAKEDEV.tmpl  > tempfile
>
>Any opinions are welcome :)
>
>Jaromir
>
>(Also CC'ed to tech-kern, since this is related to recent discussions)
>-- 
>Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
>-=- We should be mindful of the potential goal, but as the tantric    -=-
>-=- Buddhist masters say, ``You may notice during meditation that you -=-
>-=- sometimes levitate or glow.   Do not let this distract you.''     -=-