1.\" $NetBSD: MAKEDEV.8.template,v 1.21 2017/02/13 19:49:06 abhinav 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 fMsu 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 8 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.It Fl u 131Don't re-create devices that already exist. 132.El 133.Pp 134.Nm 135has several possible methods of creating device nodes: 136.Bl -bullet 137.It 138By invoking the 139.Xr mknod 8 140command once for each device node. 141This is the traditional method, but it is slow because each device node 142is created using a new process. 143.Pp 144The 145.Fl m 146option forces 147.Nm 148to use the 149.Xr mknod 8 150method. 151.It 152By internally creating a specfile in a format usable by 153.Xr mtree 8 , 154and providing the specfile on standard input to a 155.Xr pax 1 156or 157.Xr mtree 8 158command, invoked with options that request it to create the device nodes 159as well as any necessary subdirectories. 160This is much faster than creating device nodes with 161.Xr mknod 8 , 162because it requires much fewer processes; 163however, it's not compatible with the 164.Fl f 165option. 166.Pp 167The 168.Fl p 169or 170.Fl t 171options force 172.Nm 173to use the 174.Xr pax 1 175or 176.Xr mtree 8 177methods. 178.It 179If the 180.Fl s 181option is specified, then 182.Nm 183will not create device nodes at all, but will output 184a specfile in a format usable by 185.Xr mtree 8 . 186.El 187.Pp 188The 189.Fl m , Fl p , Fl s , 190and 191.Fl t 192flags are mutually exclusive. 193If none of these flags is specified, then 194.Nm 195will use 196.Xr mtree 8 , 197.Xr pax 1 , 198or 199.Xr mknod 8 , 200in that order of preference, depending on which commands 201appear to be available and usable. 202In normal use, it's expected that 203.Xr mtree 8 204will be available, so it will be chosen. 205If 206.Nm 207is invoked by 208.Xr init 8 , 209it's expected that 210.Xr mtree 8 211will not be available, but 212.Xr pax 1 213may be available. 214.Pp 215The special targets supported on 216.Nx 217are: 218.Pp 219@@@SPECIAL@@@ 220.Pp 221Please note that any hash marks 222.Pq Dq # 223in the following list of supported device targets must be replaced by 224digits when calling 225.Nm : 226.Pp 227@@@DEVICES@@@ 228.Sh ENVIRONMENT 229The following environment variables affect the execution of 230.Nm : 231.Pp 232.Bl -tag -width indent 233.It Ev MAKEDEV_AS_LIBRARY 234If this is set, then 235.Nm 236will define several shell functions and then return, 237ignoring all its command line options and arguments. 238This is used to enable 239.Xr MAKEDEV.local 8 240to use the shell functions defined in 241.Nm . 242.El 243.Sh FILES 244.Bl -tag -width "/dev/MAKEDEV.local" -compact 245.It Pa /dev 246special device files directory 247.It Pa /dev/MAKEDEV 248script described in this man page 249.It Pa /dev/MAKEDEV.local 250script for site-specific devices 251.El 252.Sh DIAGNOSTICS 253If the script reports an error that is difficult to understand, 254you can get more debugging output by using 255.Dl Ic sh Fl x Ar MAKEDEV Ar argument . 256.Sh SEE ALSO 257.Xr config 1 , 258.Xr pax 1 , 259.Xr intro 4 , 260.Xr diskless 8 , 261.Xr init 8 , 262.Xr MAKEDEV.local 8 , 263.Xr mknod 8 , 264.Xr mount_mfs 8 , 265.Xr mount_tmpfs 8 , 266.Xr mtree 8 267.Sh HISTORY 268The 269.Nm 270command appeared in 271.Bx 4.2 . 272The 273.Fl f , 274.Fl m , 275and 276.Fl s 277options were added in 278.Nx 2.0 . 279The 280.Fl p , 281.Fl t , 282and 283.Fl M 284options were added in 285.Nx 5.0 . 286The ability to be used as a function library was added in 287.Nx 5.0 . 288.Sh BUGS 289The 290.Fl f 291option is not compatible with the use of 292.Xr mtree 8 293or 294.Xr pax 1 . 295.Sh NOTES 296Not all devices listed in this manpage are supported on all platforms. 297.Pp 298This man page is generated automatically from the same sources 299as 300.Pa /dev/MAKEDEV , 301in which the device files are not always sorted, which may result 302in an unusual (non-alphabetical) order. 303.Pp 304In order to allow a diskless 305.Nx 306client to obtain its 307.Pa /dev 308directory from a file server running a foreign operating system, 309one of the following techniques may be useful to populate 310a directory of device nodes on the foreign server: 311.Bl -bullet 312.It 313If the foreign server is sufficiently similar to 314.Nx , 315run 316.Nm 317in an appropriate directory of the foreign server, 318using the 319.Fl m 320flag to refer to a script that converts from command line 321arguments that would be usable with the 322.Nx 323.Xr mknod 8 324command to the equivalent commands for the foreign server. 325.It 326Run 327.Nm 328with the 329.Fl s 330flag to generate an 331.Xr mtree 8 332specification file; this can be done on any host with a 333POSIX-compliant shell and a few widely-available utilities. 334Use the 335.Xr pax 1 336command with the 337.Fl w Fl M 338flags to convert the 339.Xr mtree 8 340specification file into an archive 341in a format that supports device nodes 342(such as 343.Ar ustar 344format); 345this can be done on a 346.Nx 347host, or can be done in a cross-build environment using 348.Sy TOOLDIR Ns Pa /bin/nbpax . 349Finally, use appropriate tools on the foreign server 350to unpack the archive and create the device nodes. 351.El 352