1.\" $NetBSD: MAKEDEV.8.template,v 1.18 2008/04/30 13:10:57 martin Exp $ 2.\" 3.\" Copyright (c) 2001, 2003, 2007, 2008 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Thomas Klausner. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd @@@DATE@@@ 31.Dt MAKEDEV 8 32.Os 33.Sh NAME 34.Nm MAKEDEV 35.Nd create system and device special files 36.Sh SYNOPSIS 37.\" Please keep this in sync with MAKEDEV.local.8 38.Nm 39.Op Fl fMs 40.Op Fl m Ar mknod 41.Op Fl p Ar pax 42.Op Fl t Ar mtree 43.Bro Ar special | device Brc Op Ar ... 44.Sh DESCRIPTION 45.Nm 46is used to create system and device special files. 47As arguments it takes the names of known devices, like 48.Ar sd0 , 49or of special targets, like 50.Pa all 51or 52.Pa std , 53which create a collection of device special files, 54or 55.Pa local , 56which invokes 57.Xr MAKEDEV.local 8 58with the 59.Pa all 60argument. 61.Pp 62The script is in 63.Pa /dev/MAKEDEV . 64Devices are created in the current working directory; 65in normal use, 66.Nm 67should be invoked with 68.Pa /dev 69as the current working directory. 70.Pp 71Supported options are: 72.Bl -tag -width XmXmknodXX 73.It Fl f 74Force permissions to be updated on existing devices. 75This works only if 76.Nm 77invokes 78.Xr mknod 8 ; 79it is not compatible with the 80.Fl p , 81.Fl s , 82or 83.Fl t 84options. 85.It Fl M 86Create a memory file system, union mounted over the current directory, 87to contain the device special files. 88The memory file system is created using 89.Xr mount_tmpfs 8 90or 91.Xr mount_mfs 8 , 92in that order of preference. 93.Pp 94If the 95.Fl M 96flag is specified more than once, then 97.Nm 98assumes that it is being invoked from 99.Xr init 1 100to populate a memory file system for 101.Pa /dev . 102In this case, 103.Nm 104will also redirect its output to the system console. 105.It Fl m Ar mknod 106Force the use of 107.Xr mknod 8 , 108and specify the name or path to the 109.Xr mknod 8 110program. 111[Usually, $TOOL_MKNOD or mknod.] 112.It Fl p Ar pax 113Force the use of 114.Xr pax 1 , 115and specify the name or path to the 116.Xr pax 1 117program. 118[Usually, $TOOL_PAX or pax.] 119.It Fl s 120Generate an 121.Xr mtree 8 122specfile instead of creating devices. 123.It Fl t Ar mtree 124Force the use of 125.Xr mtree 8 , 126and specify the name or path to the 127.Xr mtree 8 128program. 129[Usually, $TOOL_MTREE or mtree.] 130.El 131.Pp 132.Nm 133has several possible methods of creating device nodes: 134.Bl -bullet 135.It 136By invoking the 137.Xr mknod 8 138command once for each device node. 139This is the traditional method, but it is slow because each device node 140is created using a new process. 141.Pp 142The 143.Fl m 144option forces 145.Nm 146to use the 147.Xr mknod 8 148method. 149.It 150By internally creating a specfile in a format usable by 151.Xr mtree 8 , 152and providing the specfile on standard input to a 153.Xr pax 1 154or 155.Xr mtree 8 156command, invoked with options that request it to create the device nodes 157as well as any necessary subdirectories. 158This is much faster than creating device nodes with 159.Xr mknod 8 , 160because it requires much fewer processes; 161however, it's not compatible with the 162.Fl f 163option. 164.Pp 165The 166.Fl p 167or 168.Fl t 169options force 170.Nm 171to use the 172.Xr pax 1 173or 174.Xr mtree 8 175methods. 176.It 177If the 178.Fl s 179option is specified, then 180.Nm 181will not create device nodes at all, but will output 182a specfile in a format usable by 183.Xr mtree 8 . 184.El 185.Pp 186The 187.Fl m , Fl p , Fl s , 188and 189.Fl t 190flags are mutually exclusive. 191If none of these flags is specified, then 192.Nm 193will use 194.Xr mtree 8 , 195.Xr pax 1 , 196or 197.Xr mknod 8 , 198in that order of preference, depending on which commands 199appear to be available and usable. 200In normal use, it's expected that 201.Xr mtree 8 202will be available, so it will be chosen. 203If 204.Nm 205is invoked by 206.Xr init 8 , 207it's expected that 208.Xr mtree 8 209will not be available, but 210.Xr pax 1 211may be available. 212.Pp 213The special targets supported on 214.Nx 215are: 216.Pp 217@@@SPECIAL@@@ 218.Pp 219Please note that any hash marks 220.Pq Dq # 221in the following list of supported device targets must be replaced by 222digits when calling 223.Nm : 224.Pp 225@@@DEVICES@@@ 226.Sh ENVIRONMENT 227The following environment variables affect the execution of 228.Nm : 229.Pp 230.Bl -tag -width indent 231.It Ev MAKEDEV_AS_LIBRARY 232If this is set, then 233.Nm 234will define several shell functions and then return, 235ignoring all its command line options and arguments. 236This is used to enable 237.Xr MAKEDEV.local 8 238to use the shell functions defined in 239.Nm . 240.El 241.Sh FILES 242.Bl -tag -width "/dev/MAKEDEV.local" -compact 243.It Pa /dev 244special device files directory 245.It Pa /dev/MAKEDEV 246script described in this man page 247.It Pa /dev/MAKEDEV.local 248script for site-specific devices 249.El 250.Sh DIAGNOSTICS 251If the script reports an error that is difficult to understand, 252you can get more debugging output by using 253.Dl Ic sh Fl x Ar MAKEDEV Ar argument . 254.Sh SEE ALSO 255.Xr config 1 , 256.Xr init 1 , 257.Xr pax 1 , 258.Xr intro 4 , 259.Xr MAKEDEV.local 8 , 260.Xr diskless 8 , 261.Xr mknod 8 , 262.Xr mount_mfs 8 , 263.Xr mount_tmpfs 8 , 264.Xr mtree 8 265.Sh HISTORY 266The 267.Nm 268command appeared in 269.Bx 4.2 . 270The 271.Fl f , 272.Fl m , 273and 274.Fl s 275options were added in 276.Nx 2.0 . 277The 278.Fl p , 279.Fl t , 280and 281.Fl M 282options were added in 283.Nx 5.0 . 284The ability to be used as a function library was added in 285.Nx 5.0 . 286.Sh BUGS 287The 288.Fl f 289option is not compatible with the use of 290.Xr mtree 8 291or 292.Xr pax 1 . 293.Sh NOTES 294Not all devices listed in this manpage are supported on all platforms. 295.Pp 296This man page is generated automatically from the same sources 297as 298.Pa /dev/MAKEDEV , 299in which the device files are not always sorted, which may result 300in an unusual (non-alphabetical) order. 301.Pp 302In order to allow a diskless 303.Nx 304client to obtain its 305.Pa /dev 306directory from a file server running a foreign operating system, 307one of the following techniques may be useful to populate 308a directory of device nodes on the foreign server: 309.Bl -bullet 310.It 311If the foreign server is sufficiently similar to 312.Nx , 313run 314.Nm 315in an appropriate directory of the foreign server, 316using the 317.Fl m 318flag to refer to a script that converts from command line 319arguments that would be usable with the 320.Nx 321.Xr mknod 8 322command to the equivalent commands for the foreign server. 323.It 324Run 325.Nm 326with the 327.Fl s 328flag to generate an 329.Xr mtree 8 330specification file; this can be done on any host with a 331POSIX-compliant shell and a few widely-available utilities. 332Use the 333.Xr pax 1 334command with the 335.Fl w Fl M 336flags to convert the 337.Xr mtree 8 338specification file into an archive 339in a format that supports device nodes 340(such as 341.Ar ustar 342format); 343this can be done on a 344.Nx 345host, or can be done in a cross-build environment using 346.Sy TOOLDIR Ns Pa /bin/nbpax . 347Finally, use apropriate tools on the foreign server 348to unpack the archive and create the device nodes. 349.El 350