Subject: Re: dev/MAKEDEV not portable
To: Simon J. Gerraty <sjg@notboss.cdn.telstra.com.au>
From: Chris G. Demetriou <cgd@pa.dec.com>
List: current-users
Date: 12/17/1997 11:01:25
> Sounds silly doesn't it.

Not really, but only because it runs much deeper than you indicated.  8-)

> However, for the purpose of building a diskless environment on a
> non-NetBSD server, it would be handy if:
> 
> a) there were a dev.tgz package or
> b) dev/MAKEDEV could be run on the server.

I agree with that (the former, really).  I don't think the latter is
easy to do (but not for the reason you suggest).


> At present the use of cute features like $(($unit + 16)) etc
> rules out b.  `expr ` may be sub-optimal, but for something that gets
> run only once or twice in the lifetime of a system, optimization is
> a non-issue.

This isn't really a valid concern, in my book.  Shell math is a POSIX
thing, and UNIX systems which don't provide POSIX (or "close enough to
POSIX") shells are broken in this day and age.  Sure, the POSIX shell
might not be /bin/sh on the target system. "so run MAKEDEV with the
POSIX shell."

The real reason that MAKEDEV can't necessarily be run on the server is
that the server's mknod and device node format may be (grossly 8-)
different than that of the client.  That means that what you really
need is a "netbsd_mknod" binary to create the device nodes, or other
deep magic to make sure the right device nodes are created.  Usually
systems 'mknod()' syscalls will do the right thing (the 'device'
argument is usually just a 32-bit value that's not interpreted), but
mknod(8) may be translating from major/minor into that 32-bit number
in an incompatible way.



cgd