Subject: Renumbering devices: the alternative
To: None <tech-kern@NetBSD.ORG>
From: Todd Vierling <tv@NetBSD.ORG>
List: tech-kern
Date: 01/13/1998 13:54:12
Note -- this is not exactly the same thing I posted to developers.  I'm
moving the topic back here under advice from several persons. 

There is one more alternative to the ugly bmajor()/bminor()/cmajor()/cminor()
hack I proposed earlier. 

Console upgrade.

If we _required_ that someone make a new /dev tree and run MAKEDEV in it,
we'd have no problems.  Release-to-release users will do this anyway, and
the procedure wouldn't be simple, but it would be possible for users
building off of -current. 

1. build new mknod(8) with new includes.
2. run new MAKEDEV in a directory such as /dev_new.
3. build new kernel.
4. boot new kernel single user.
5. `mount -u /dev_new/yourrootdevice0a /'
6. rename /dev to /dev_old; rename /dev_new to /dev.
7. sync (important!); reboot new kernel single user.
8. verify that `mount -u /' works and the root device is now read-write.
9. boot multi-user!
10. keep /dev_old around Just In Case, if desired.

The device macros would need zero conversion; we'd only have to purify some
hash number generators and such.  Platforms who do not have /dev/console at
cdev 0/0 (arm32 only) have a different method to follow--replace steps
4-6 with:
4. boot miniroot or floppy single-user.
5. `mount -u /dev/yourrootdevice0a /'
6. rename /mnt/dev to /mnt/dev_old; rename /mnt/dev_new to /mnt/dev.

It's either an ugly upgrade, or an ugly hack, so we need to make a real
choice.  I'm more and more favoring the ugly upgrade and ditching the 16 bit
devices in the process.  This conversion system is getting hairier by the
minute. 

We have binary compatibility for other OS's and older versions of our own OS
by turning on COMPAT_* options.  But only a few ports have /dev
compatibility with other OS's, and apparently it was done to make
side-grading to NetBSD easier.  We don't _really_ need /dev compatibility,
as long as it is possible to `upgrade' device nodes from a console install
context. 

=====
===== Todd Vierling (Personal tv@pobox.com) =====
== "There's a myth that there is a scarcity of justice to go around, so
== that if we extend justice to 'those people,' it will somehow erode the
== quality of justice everyone else receives."  -- Maria Price