1*1607a98bSabhinav.\" $NetBSD: MAKEDEV.8.template,v 1.21 2017/02/13 19:49:06 abhinav Exp $ 25c594b1cSwiz.\" 3378687ecSapb.\" Copyright (c) 2001, 2003, 2007, 2008 The NetBSD Foundation, Inc. 45c594b1cSwiz.\" All rights reserved. 55c594b1cSwiz.\" 65c594b1cSwiz.\" This code is derived from software contributed to The NetBSD Foundation 75c594b1cSwiz.\" by Thomas Klausner. 85c594b1cSwiz.\" 95c594b1cSwiz.\" Redistribution and use in source and binary forms, with or without 105c594b1cSwiz.\" modification, are permitted provided that the following conditions 115c594b1cSwiz.\" are met: 125c594b1cSwiz.\" 1. Redistributions of source code must retain the above copyright 135c594b1cSwiz.\" notice, this list of conditions and the following disclaimer. 145c594b1cSwiz.\" 2. Redistributions in binary form must reproduce the above copyright 155c594b1cSwiz.\" notice, this list of conditions and the following disclaimer in the 165c594b1cSwiz.\" documentation and/or other materials provided with the distribution. 175c594b1cSwiz.\" 185c594b1cSwiz.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 195c594b1cSwiz.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 205c594b1cSwiz.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 215c594b1cSwiz.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 225c594b1cSwiz.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 235c594b1cSwiz.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 245c594b1cSwiz.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 255c594b1cSwiz.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 265c594b1cSwiz.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 275c594b1cSwiz.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 285c594b1cSwiz.\" POSSIBILITY OF SUCH DAMAGE. 295c594b1cSwiz.\" 305c594b1cSwiz.Dd @@@DATE@@@ 317381215eSjdolecek.Dt MAKEDEV 8 325c594b1cSwiz.Os 335c594b1cSwiz.Sh NAME 345c594b1cSwiz.Nm MAKEDEV 355c594b1cSwiz.Nd create system and device special files 365c594b1cSwiz.Sh SYNOPSIS 37378687ecSapb.\" Please keep this in sync with MAKEDEV.local.8 385c594b1cSwiz.Nm 39fd3dad8dSjmcneill.Op Fl fMsu 40ef0d4ed8Swiz.Op Fl m Ar mknod 4176426884Sapb.Op Fl p Ar pax 42378687ecSapb.Op Fl t Ar mtree 4376426884Sapb.Bro Ar special | device Brc Op Ar ... 445c594b1cSwiz.Sh DESCRIPTION 455c594b1cSwiz.Nm 465c594b1cSwizis used to create system and device special files. 475c594b1cSwizAs arguments it takes the names of known devices, like 485c594b1cSwiz.Ar sd0 , 495c594b1cSwizor of special targets, like 505c594b1cSwiz.Pa all 515c594b1cSwizor 525c594b1cSwiz.Pa std , 538048a356Sapbwhich create a collection of device special files, 548048a356Sapbor 558048a356Sapb.Pa local , 568048a356Sapbwhich invokes 578048a356Sapb.Xr MAKEDEV.local 8 588048a356Sapbwith the 598048a356Sapb.Pa all 608048a356Sapbargument. 615c594b1cSwiz.Pp 625c594b1cSwizThe script is in 63378687ecSapb.Pa /dev/MAKEDEV . 64378687ecSapbDevices are created in the current working directory; 65378687ecSapbin normal use, 66378687ecSapb.Nm 67378687ecSapbshould be invoked with 685c594b1cSwiz.Pa /dev 69378687ecSapbas the current working directory. 70ef0d4ed8Swiz.Pp 71ef0d4ed8SwizSupported options are: 72ef0d4ed8Swiz.Bl -tag -width XmXmknodXX 73ef0d4ed8Swiz.It Fl f 74ef0d4ed8SwizForce permissions to be updated on existing devices. 756d3d3ebeSapbThis works only if 76378687ecSapb.Nm 77378687ecSapbinvokes 78378687ecSapb.Xr mknod 8 ; 79378687ecSapbit is not compatible with the 80378687ecSapb.Fl p , 81378687ecSapb.Fl s , 826d3d3ebeSapbor 83378687ecSapb.Fl t 846d3d3ebeSapboptions. 853fa05cb2Sdsl.It Fl M 863fa05cb2SdslCreate a memory file system, union mounted over the current directory, 873fa05cb2Sdslto contain the device special files. 88378687ecSapbThe memory file system is created using 89802860abSapb.Xr mount_tmpfs 8 90802860abSapbor 91378687ecSapb.Xr mount_mfs 8 , 92378687ecSapbin that order of preference. 936d3d3ebeSapb.Pp 9476426884SapbIf the 9576426884Sapb.Fl M 9676426884Sapbflag is specified more than once, then 9776426884Sapb.Nm 986d3d3ebeSapbassumes that it is being invoked from 99c1881841Swiz.Xr init 8 1006d3d3ebeSapbto populate a memory file system for 1016d3d3ebeSapb.Pa /dev . 1026d3d3ebeSapbIn this case, 1036d3d3ebeSapb.Nm 10476426884Sapbwill also redirect its output to the system console. 105ef0d4ed8Swiz.It Fl m Ar mknod 106378687ecSapbForce the use of 107378687ecSapb.Xr mknod 8 , 108378687ecSapband specify the name or path to the 109ef0d4ed8Swiz.Xr mknod 8 110ef0d4ed8Swizprogram. 111ef0d4ed8Swiz[Usually, $TOOL_MKNOD or mknod.] 11276426884Sapb.It Fl p Ar pax 113378687ecSapbForce the use of 114378687ecSapb.Xr pax 1 , 115378687ecSapband specify the name or path to the 11676426884Sapb.Xr pax 1 11776426884Sapbprogram. 118378687ecSapb[Usually, $TOOL_PAX or pax.] 119ef0d4ed8Swiz.It Fl s 120378687ecSapbGenerate an 121ef0d4ed8Swiz.Xr mtree 8 122ef0d4ed8Swizspecfile instead of creating devices. 123378687ecSapb.It Fl t Ar mtree 124378687ecSapbForce the use of 125378687ecSapb.Xr mtree 8 , 126378687ecSapband specify the name or path to the 127378687ecSapb.Xr mtree 8 128378687ecSapbprogram. 129378687ecSapb[Usually, $TOOL_MTREE or mtree.] 130fd3dad8dSjmcneill.It Fl u 131fd3dad8dSjmcneillDon't re-create devices that already exist. 132378687ecSapb.El 133378687ecSapb.Pp 134378687ecSapb.Nm 135378687ecSapbhas several possible methods of creating device nodes: 136378687ecSapb.Bl -bullet 137378687ecSapb.It 138378687ecSapbBy invoking the 139378687ecSapb.Xr mknod 8 140378687ecSapbcommand once for each device node. 141378687ecSapbThis is the traditional method, but it is slow because each device node 142378687ecSapbis created using a new process. 143378687ecSapb.Pp 144378687ecSapbThe 145378687ecSapb.Fl m 146378687ecSapboption forces 147378687ecSapb.Nm 148378687ecSapbto use the 149378687ecSapb.Xr mknod 8 150378687ecSapbmethod. 151378687ecSapb.It 152378687ecSapbBy internally creating a specfile in a format usable by 153378687ecSapb.Xr mtree 8 , 154378687ecSapband providing the specfile on standard input to a 155378687ecSapb.Xr pax 1 156378687ecSapbor 157378687ecSapb.Xr mtree 8 158378687ecSapbcommand, invoked with options that request it to create the device nodes 159378687ecSapbas well as any necessary subdirectories. 160378687ecSapbThis is much faster than creating device nodes with 161378687ecSapb.Xr mknod 8 , 162378687ecSapbbecause it requires much fewer processes; 163378687ecSapbhowever, it's not compatible with the 164378687ecSapb.Fl f 165378687ecSapboption. 166378687ecSapb.Pp 167378687ecSapbThe 168378687ecSapb.Fl p 169378687ecSapbor 170378687ecSapb.Fl t 171378687ecSapboptions force 172378687ecSapb.Nm 173378687ecSapbto use the 174378687ecSapb.Xr pax 1 175378687ecSapbor 176378687ecSapb.Xr mtree 8 177378687ecSapbmethods. 178378687ecSapb.It 179378687ecSapbIf the 180378687ecSapb.Fl s 181378687ecSapboption is specified, then 182378687ecSapb.Nm 183378687ecSapbwill not create device nodes at all, but will output 184378687ecSapba specfile in a format usable by 185378687ecSapb.Xr mtree 8 . 186ef0d4ed8Swiz.El 1875c594b1cSwiz.Pp 1886d3d3ebeSapbThe 189378687ecSapb.Fl m , Fl p , Fl s , 1906d3d3ebeSapband 191378687ecSapb.Fl t 1926d3d3ebeSapbflags are mutually exclusive. 1936d3d3ebeSapbIf none of these flags is specified, then 1946d3d3ebeSapb.Nm 195378687ecSapbwill use 196378687ecSapb.Xr mtree 8 , 197378687ecSapb.Xr pax 1 , 198378687ecSapbor 199378687ecSapb.Xr mknod 8 , 200378687ecSapbin that order of preference, depending on which commands 201378687ecSapbappear to be available and usable. 202378687ecSapbIn normal use, it's expected that 203378687ecSapb.Xr mtree 8 204378687ecSapbwill be available, so it will be chosen. 205378687ecSapbIf 206378687ecSapb.Nm 207378687ecSapbis invoked by 208378687ecSapb.Xr init 8 , 209378687ecSapbit's expected that 210378687ecSapb.Xr mtree 8 211378687ecSapbwill not be available, but 2126d3d3ebeSapb.Xr pax 1 213378687ecSapbmay be available. 2146d3d3ebeSapb.Pp 2155c594b1cSwizThe special targets supported on 2167381215eSjdolecek.Nx 2175c594b1cSwizare: 2185c594b1cSwiz.Pp 2195c594b1cSwiz@@@SPECIAL@@@ 2205c594b1cSwiz.Pp 2215c594b1cSwizPlease note that any hash marks 2225c594b1cSwiz.Pq Dq # 2235c594b1cSwizin the following list of supported device targets must be replaced by 2245c594b1cSwizdigits when calling 225990562bfSwiz.Nm : 2265c594b1cSwiz.Pp 2275c594b1cSwiz@@@DEVICES@@@ 22885ea48fdSapb.Sh ENVIRONMENT 22985ea48fdSapbThe following environment variables affect the execution of 23085ea48fdSapb.Nm : 23185ea48fdSapb.Pp 23285ea48fdSapb.Bl -tag -width indent 23385ea48fdSapb.It Ev MAKEDEV_AS_LIBRARY 23485ea48fdSapbIf this is set, then 23585ea48fdSapb.Nm 23685ea48fdSapbwill define several shell functions and then return, 23785ea48fdSapbignoring all its command line options and arguments. 23885ea48fdSapbThis is used to enable 23985ea48fdSapb.Xr MAKEDEV.local 8 24085ea48fdSapbto use the shell functions defined in 24185ea48fdSapb.Nm . 24285ea48fdSapb.El 2435c594b1cSwiz.Sh FILES 244dc47c556Swiz.Bl -tag -width "/dev/MAKEDEV.local" -compact 2455c594b1cSwiz.It Pa /dev 2465c594b1cSwizspecial device files directory 2475c594b1cSwiz.It Pa /dev/MAKEDEV 2485c594b1cSwizscript described in this man page 249dc47c556Swiz.It Pa /dev/MAKEDEV.local 2508048a356Sapbscript for site-specific devices 2515c594b1cSwiz.El 252dc47c556Swiz.Sh DIAGNOSTICS 253dc47c556SwizIf the script reports an error that is difficult to understand, 254dc47c556Swizyou can get more debugging output by using 255dc47c556Swiz.Dl Ic sh Fl x Ar MAKEDEV Ar argument . 2565c594b1cSwiz.Sh SEE ALSO 257a9b411c1Speter.Xr config 1 , 258d1c6bc87Sapb.Xr pax 1 , 2595c594b1cSwiz.Xr intro 4 , 260d1c6bc87Sapb.Xr diskless 8 , 261c1881841Swiz.Xr init 8 , 262c1881841Swiz.Xr MAKEDEV.local 8 , 263d1c6bc87Sapb.Xr mknod 8 , 264802860abSapb.Xr mount_mfs 8 , 265802860abSapb.Xr mount_tmpfs 8 , 266d1c6bc87Sapb.Xr mtree 8 267dc47c556Swiz.Sh HISTORY 268dc47c556SwizThe 269dc47c556Swiz.Nm 270dc47c556Swizcommand appeared in 271dc47c556Swiz.Bx 4.2 . 272378687ecSapbThe 273378687ecSapb.Fl f , 274378687ecSapb.Fl m , 275378687ecSapband 276378687ecSapb.Fl s 277378687ecSapboptions were added in 278378687ecSapb.Nx 2.0 . 279378687ecSapbThe 280378687ecSapb.Fl p , 281378687ecSapb.Fl t , 282378687ecSapband 283378687ecSapb.Fl M 284378687ecSapboptions were added in 285378687ecSapb.Nx 5.0 . 28685ea48fdSapbThe ability to be used as a function library was added in 28785ea48fdSapb.Nx 5.0 . 288378687ecSapb.Sh BUGS 289378687ecSapbThe 290378687ecSapb.Fl f 291378687ecSapboption is not compatible with the use of 292378687ecSapb.Xr mtree 8 293378687ecSapbor 294378687ecSapb.Xr pax 1 . 2957381215eSjdolecek.Sh NOTES 296d1c6bc87SapbNot all devices listed in this manpage are supported on all platforms. 297d1c6bc87Sapb.Pp 2985c594b1cSwizThis man page is generated automatically from the same sources 2995c594b1cSwizas 3005c594b1cSwiz.Pa /dev/MAKEDEV , 3015c594b1cSwizin which the device files are not always sorted, which may result 3024880b798Swizin an unusual (non-alphabetical) order. 303d1c6bc87Sapb.Pp 304d1c6bc87SapbIn order to allow a diskless 305d1c6bc87Sapb.Nx 306d1c6bc87Sapbclient to obtain its 307d1c6bc87Sapb.Pa /dev 308d1c6bc87Sapbdirectory from a file server running a foreign operating system, 309d1c6bc87Sapbone of the following techniques may be useful to populate 310d1c6bc87Sapba directory of device nodes on the foreign server: 311d1c6bc87Sapb.Bl -bullet 312d1c6bc87Sapb.It 313d1c6bc87SapbIf the foreign server is sufficiently similar to 314d1c6bc87Sapb.Nx , 315d1c6bc87Sapbrun 316d1c6bc87Sapb.Nm 317d1c6bc87Sapbin an appropriate directory of the foreign server, 318d1c6bc87Sapbusing the 319d1c6bc87Sapb.Fl m 320d1c6bc87Sapbflag to refer to a script that converts from command line 321d1c6bc87Sapbarguments that would be usable with the 322d1c6bc87Sapb.Nx 323d1c6bc87Sapb.Xr mknod 8 324d1c6bc87Sapbcommand to the equivalent commands for the foreign server. 325d1c6bc87Sapb.It 326d1c6bc87SapbRun 327d1c6bc87Sapb.Nm 328d1c6bc87Sapbwith the 329d1c6bc87Sapb.Fl s 330d1c6bc87Sapbflag to generate an 331d1c6bc87Sapb.Xr mtree 8 332d1c6bc87Sapbspecification file; this can be done on any host with a 333d1c6bc87SapbPOSIX-compliant shell and a few widely-available utilities. 334d1c6bc87SapbUse the 335d1c6bc87Sapb.Xr pax 1 336d1c6bc87Sapbcommand with the 337d1c6bc87Sapb.Fl w Fl M 338d1c6bc87Sapbflags to convert the 339d1c6bc87Sapb.Xr mtree 8 340d1c6bc87Sapbspecification file into an archive 341d1c6bc87Sapbin a format that supports device nodes 342d1c6bc87Sapb(such as 343d1c6bc87Sapb.Ar ustar 344d1c6bc87Sapbformat); 345d1c6bc87Sapbthis can be done on a 346d1c6bc87Sapb.Nx 347d1c6bc87Sapbhost, or can be done in a cross-build environment using 348d1c6bc87Sapb.Sy TOOLDIR Ns Pa /bin/nbpax . 349*1607a98bSabhinavFinally, use appropriate tools on the foreign server 350d1c6bc87Sapbto unpack the archive and create the device nodes. 351d1c6bc87Sapb.El 352