.\" $MirOS: src/usr.sbin/makefs/makefs.8,v 1.18 2018/12/25 19:38:31 tg Exp $ .\" $NetBSD: makefs.8,v 1.32 2009/01/20 20:47:25 bjh21 Exp $ .\" .\" Copyright (c) 2001-2003 Wasabi Systems, Inc. .\" All rights reserved. .\" .\" Written by Luke Mewburn for Wasabi Systems, Inc. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed for the NetBSD Project by .\" Wasabi Systems, Inc. .\" 4. The name of Wasabi Systems, Inc. may not be used to endorse .\" or promote products derived from this software without specific prior .\" written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\"- .\" Copyright (c) 2008, 2009, 2010, 2016, 2018 .\" mirabilos .\"- .\" Try to make GNU groff and AT&T nroff more compatible .\" * ` generates ‘ in gnroff, so use \` .\" * ' generates ’ in gnroff, \' generates ´, so use \*(aq .\" * - generates ‐ in gnroff, \- generates −, so .tr it to - .\" thus use - for hyphens and \- for minus signs and option dashes .\" * ~ is size-reduced and placed atop in groff, so use \*(TI .\" * ^ is size-reduced and placed atop in groff, so use \*(ha .\" * \(en does not work in nroff, so use \*(en .\" * <>| are problematic, so redefine and use \*(Lt\*(Gt\*(Ba .\" Also make sure to use \& *before* a punctuation char that is to not .\" be interpreted as punctuation, and especially with two-letter words .\" but also (after) a period that does not end a sentence (“e.g.\&”). .\" The section after the "doc" macropackage has been loaded contains .\" additional code to convene between the UCB mdoc macropackage (and .\" its variant as BSD mdoc in groff) and the GNU mdoc macropackage. .\" .ie \n(.g \{\ . if \*[.T]ascii .tr \-\N'45' . if \*[.T]latin1 .tr \-\N'45' . if \*[.T]utf8 .tr \-\N'45' . ds <= \[<=] . ds >= \[>=] . ds Rq \[rq] . ds Lq \[lq] . ds sL \(aq . ds sR \(aq . if \*[.T]utf8 .ds sL ` . if \*[.T]ps .ds sL ` . if \*[.T]utf8 .ds sR ' . if \*[.T]ps .ds sR ' . ds aq \(aq . ds TI \(ti . ds ha \(ha . ds en \(en .\} .el \{\ . ds aq ' . ds TI ~ . ds ha ^ . ds en \(em .\} .\" .\" Implement .Dd with the Mdocdate RCS keyword .\" .rn Dd xD .de Dd .ie \\$1$Mdocdate: \{\ . xD \\$2 \\$3, \\$4 .\} .el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .. .\" .\" .Dd must come before definition of .Mx, because when called .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" .Dd $Mdocdate: December 25 2018 $ .\" .\" Check which macro package we use, and do other -mdoc setup. .\" .ie \n(.g \{\ . if \*[.T]utf8 .tr \[la]\*(Lt . if \*[.T]utf8 .tr \[ra]\*(Gt . ie d volume-ds-1 .ds tT gnu . el .ie d doc-volume-ds-1 .ds tT gnp . el .ds tT bsd .\} .el .ds tT ucb .\" .\" Implement .Mx (MirBSD) .\" .ie "\*(tT"gnu" \{\ . eo . de Mx . nr curr-font \n[.f] . nr curr-size \n[.ps] . ds str-Mx \f[\n[curr-font]]\s[\n[curr-size]u] . ds str-Mx1 \*[Tn-font-size]\%MirBSD\*[str-Mx] . if !\n[arg-limit] \ . if \n[.$] \{\ . ds macro-name Mx . parse-args \$@ . \} . if (\n[arg-limit] > \n[arg-ptr]) \{\ . nr arg-ptr +1 . ie (\n[type\n[arg-ptr]] == 2) \ . as str-Mx1 \~\*[arg\n[arg-ptr]] . el \ . nr arg-ptr -1 . \} . ds arg\n[arg-ptr] "\*[str-Mx1] . nr type\n[arg-ptr] 2 . ds space\n[arg-ptr] "\*[space] . nr num-args (\n[arg-limit] - \n[arg-ptr]) . nr arg-limit \n[arg-ptr] . if \n[num-args] \ . parse-space-vector . print-recursive .. . ec . ds sP \s0 . ds tN \*[Tn-font-size] .\} .el .ie "\*(tT"gnp" \{\ . eo . de Mx . nr doc-curr-font \n[.f] . nr doc-curr-size \n[.ps] . ds doc-str-Mx \f[\n[doc-curr-font]]\s[\n[doc-curr-size]u] . ds doc-str-Mx1 \*[doc-Tn-font-size]\%MirBSD\*[doc-str-Mx] . if !\n[doc-arg-limit] \ . if \n[.$] \{\ . ds doc-macro-name Mx . doc-parse-args \$@ . \} . if (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\ . nr doc-arg-ptr +1 . ie (\n[doc-type\n[doc-arg-ptr]] == 2) \ . as doc-str-Mx1 \~\*[doc-arg\n[doc-arg-ptr]] . el \ . nr doc-arg-ptr -1 . \} . ds doc-arg\n[doc-arg-ptr] "\*[doc-str-Mx1] . nr doc-type\n[doc-arg-ptr] 2 . ds doc-space\n[doc-arg-ptr] "\*[doc-space] . nr doc-num-args (\n[doc-arg-limit] - \n[doc-arg-ptr]) . nr doc-arg-limit \n[doc-arg-ptr] . if \n[doc-num-args] \ . doc-parse-space-vector . doc-print-recursive .. . ec . ds sP \s0 . ds tN \*[doc-Tn-font-size] .\} .el \{\ . de Mx . nr cF \\n(.f . nr cZ \\n(.s . ds aa \&\f\\n(cF\s\\n(cZ . if \\n(aC==0 \{\ . ie \\n(.$==0 \&MirBSD\\*(aa . el .aV \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} . if \\n(aC>\\n(aP \{\ . nr aP \\n(aP+1 . ie \\n(C\\n(aP==2 \{\ . as b1 \&MirBSD\ #\&\\*(A\\n(aP\\*(aa . ie \\n(aC>\\n(aP \{\ . nr aP \\n(aP+1 . nR . \} . el .aZ . \} . el \{\ . as b1 \&MirBSD\\*(aa . nR . \} . \} .. .\} .\"- .Dt MAKEFS 8 .Os .Sh NAME .Nm makefs .Nd create a filesystem image from a directory tree .Sh SYNOPSIS .Nm .Op Fl x .Op Fl B Ar byte-order .Op Fl b Ar free-blocks .Op Fl d Ar debug-mask .Op Fl F Ar specfile .Op Fl f Ar free-files .Op Fl M Ar minimum-size .Op Fl m Ar maximum-size .Op Fl N Ar userdb-dir .Op Fl o Ar fs-options .Op Fl S Ar sector-size .Op Fl s Ar image-size .Op Fl t Ar fs-type .Op Fl T Ar maximum-time .Ar image-file .Ar directory .Sh DESCRIPTION The utility .Nm creates a filesystem image into .Ar image-file from the directory tree .Ar directory . No special devices or privileges are required to perform this task. .Pp The options are as follows: .Bl -tag -width flag .It Fl B Ar byte-order Set the byte order of the image to .Ar byte-order . Valid byte orders are .Ql 4321 , .Ql big , or .Ql be for big endian, and .Ql 1234 , .Ql little , or .Ql le for little endian. Some filesystems may have a fixed byte order; in those cases this argument will be ignored. .It Fl b Ar free-blocks Ensure that a minimum of .Ar free-blocks free blocks exist in the image. An optional .Ql % suffix may be provided to indicate that .Ar free-blocks indicates a percentage of the calculated image size. .It Fl d Ar debug-mask Enable various levels of debugging, depending upon which bits are set in .Ar debug-mask . XXX: document these .It Fl F Ar specfile Use .Ar specfile as an .Xr mtree 8 .Sq specfile specification. .Pp If a specfile entry exists in the underlying filesystem, its permissions and modification time will be used unless specifically overridden by the specfile. An error will be raised if the type of entry in the specfile conflicts with that of an existing entry. .Pp In the opposite case (where a specfile entry does not have an entry in the underlying filesystem) the following occurs: If the specfile entry is marked .Sy optional , the specfile entry is ignored. Otherwise, the entry will be created in the image, and it is necessary to specify at least the following parameters in the specfile: .Sy type , .Sy mode , .Sy gname , or .Sy gid , and .Sy uname or .Sy uid , .Sy device (in the case of block or character devices), and .Sy link (in the case of symbolic links). If .Sy time isn't provided, the current time will be used. If .Sy flags isn't provided, the current file flags will be used. Missing regular file entries will be created as zero-length files. .It Fl f Ar free-files Ensure that a minimum of .Ar free-files free files (inodes) exist in the image. An optional .Ql % suffix may be provided to indicate that .Ar free-files indicates a percentage of the calculated image size. .It Fl M Ar minimum-size Set the minimum size of the filesystem image to .Ar minimum-size . .It Fl m Ar maximum-size Set the maximum size of the filesystem image to .Ar maximum-size . An error will be raised if the target filesystem needs to be larger than this to accommodate the provided directory tree. .It Fl N Ar dbdir Use the user database text file .Pa master.passwd and group database text file .Pa group from .Ar dbdir , rather than using the results from the system's .Xr getpwnam 3 and .Xr getgrnam 3 (and related) library calls. .It Fl o Ar fs-options Set filesystem specific options. .Ar fs-options is a comma separated list of options. Valid filesystem specific options are detailed below. .It Fl S Ar sector-size Set the filesystem sector size to .Ar sector-size . .\" XXX: next line also true for cd9660? Defaults to 512. .It Fl s Ar image-size Set the size of the filesystem image to .Ar image-size . .It Fl t Ar fs-type Create an .Ar fs-type filesystem image. The following filesystem types are supported: .Bl -tag -width cd9660 -offset indent .It Sy ffs BSD fast filesystem (default). .It Sy cd9660 ISO 9660 filesystem. .El .It Fl T Ar maximum-time Clamp superblock and file timestamps to .Ar maximum-time seconds since the Epoch. .It Fl x Exclude filesystem nodes not explicitly listed in the specfile. .El .Pp Where sizes are specified, a decimal number of bytes is expected. Two or more numbers may be separated by an .Dq x to indicate a product. Each number may have one of the following optional suffixes: .Bl -tag -width 3n -offset indent -compact .It b Block; multiply by 512 .It k Kibi; multiply by 1024 (1 KiB) .It m Mebi; multiply by 1048576 (1 MiB) .It g Gibi; multiply by 1073741824 (1 GiB) .It t Tebi; multiply by 1099511627776 (1 TiB) .It w Word; multiply by the number of bytes in an integer .El .\" .\" .Ss FFS-specific options .Sy ffs images have ffs-specific optional parameters that may be provided. Each of the options consists of a keyword, an equal sign .Pq Ql = , and a value. The following keywords are supported: .Pp .Bl -tag -width optimization -offset indent -compact .It Sy avgfilesize Expected average file size. .It Sy avgfpdir Expected number of files per directory. .It Sy bsize Block size. .It Sy density Bytes per inode. .It Sy fsize Fragment size. .It Sy maxbpg Maximum blocks per file in a cylinder group. .It Sy minfree Minimum % free. .It Sy optimization Optimization preference; one of .Ql space or .Ql time . .It Sy extent Maximum extent size. .It Sy maxbpcg Maximum total number of blocks in a cylinder group. .It Sy version UFS version. 1 for FFS (default), 2 for UFS2. .El .Ss CD9660-specific options .Sy cd9660 images have ISO9660-specific optional parameters that may be provided. The arguments consist of a keyword and, optionally, an equal sign .Pq Ql = , and a value. The following keywords are supported: .Pp .Bl -tag -width omit-trailing-period -offset indent -compact .It Sy allow\-deep\-trees Allow the directory structure to exceed the maximum specified in the spec. .\" .It Sy allow\-illegal\-chars .\" Unknown .\" .It Sy allow\-lowercase .\" Unknown .It Sy allow\-max\-name Allow 37 instead of 33 characters for filenames by omitting the version id. .It Sy allow\-multidot Allow multiple dots in a filename. .It Sy applicationid Application ID of the image. .It Sy archimedes Use the .Ql ARCHIMEDES extension to encode .Tn RISC OS metadata. .It Sy boot\-info\-table Write a legacy 56-byte table at offset 8 into the boot image .Pq see below . .It Sy boot\-load\-segment Set load segment for the boot image. .It Sy bootimage Filename of a boot image in the format .Dq sysid;filename , where .Dq sysid is one of .Ql i386 , .Ql mac68k , .Ql macppc , or .Ql powerpc . .It Sy creation\-date Override PVD creation date. .It Sy effective\-date Override PVD effective date. .It Sy expiration\-date Override PVD expiration date. .It Sy generic\-bootimage Load a generic boot image into the first 32K of the cd9660 image. .It Sy hard\-disk\-boot Boot image is a hard disk image. .It Sy hide\-rr\-moved Assign the .Pa RR_MOVED directory a rock ridge name of the empty string instead of the default .Pa .rr_moved . .It Sy keep\-bad\-images Don't throw away images whose write was aborted due to an error. For debugging purposes. .It Sy label Label name of the image. .It Sy modification\-date Override PVD modification date. .It Sy no\-boot Boot image is not bootable. .It Sy no\-emul\-boot Boot image is a .Dq no emulation ElTorito image. .It Sy no\-trailing\-padding Do not pad the image (apparently Linux needs the padding). .It Sy omit\-trailing\-period Violate the standard, do not append a trailing period to filenames without an extension. .It Sy preparer Preparer ID of the image. .It Sy publisher Publisher ID of the image. .It Sy rockridge Use RockRidge extensions (for longer filenames, etc.). .It Sy rr\-squash Force uid 0, gid 0, and rationalised permission bits for RockRidge entries. .It Sy volumeid Volume set identifier of the image. .El .Pp The .Sy boot\-info\-table currently consists of the following fields (all 7.3.1 numbers), offsets relative to the boot image: .Bl -tag -width XXX -offset indent -compact .It Sy 0 8 bytes: kept as is, not part of checksum .It Sy 8 LBA of PVD .It Sy 12 LBA of boot image .It Sy 16 Size in bytes of boot image .It Sy 20 32-bit additive sum of all 32-bit words of boot image .It Sy 24 40 reserved bytes (MBZ) .It Sy 64 Begin of checksummed data, kept as is .El .Pp Dates (to override) are in 8.4.26.1 format .Pq Ar YYYYmmddHHMMSS00 and Universal Time, i.e. with zero offset from Greenwich Mean Time. .Sh SEE ALSO .Xr strsuftoll 3 , .Xr installboot 8 , .Xr mtree 8 , .Xr newfs 8 .Sh HISTORY The .Nm utility appeared in .Nx 1.6 . .Pp Support for overriding PVD dates and the boot info table was added in .Mx 11 . .Sh AUTHORS .An Luke Mewburn .Aq lukem@NetBSD.org (original program) .An Daniel Watt , .An Walter Deignan , .An Ryan Gabrys , .An Alan Perez-Rathke , .An Ram Vedam (cd9660 support) .An Thorsten Glaser Aq tg@mirbsd.org .Sh CAVEATS .Nm may be limited to images less than 2 GiB in size due to internal use of the long type.