blob: 53961a21779516029b51ff2c4d7b276ecbc12741 [file] [log] [blame]
The Android Open Source Project20682592009-03-03 19:29:32 -08001.\" Hey, EMACS: -*- nroff -*-
2.\" First parameter, NAME, should be all caps
3.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4.\" other parameters are allowed: see man(7), man(1)
5.TH GENEXT2FS 8 "August 19, 2006"
6.\" Please adjust this date whenever revising the manpage.
7.\"
8.\" Some roff macros, for reference:
9.\" .nh disable hyphenation
10.\" .hy enable hyphenation
11.\" .ad l left justify
12.\" .ad b justify to both left and right margins
13.\" .nf disable filling
14.\" .fi enable filling
15.\" .br insert line break
16.\" .sp <n> insert n+1 empty lines
17.\" for manpage-specific macros, see man(7)
18.SH NAME
19genext2fs \- ext2 filesystem generator for embedded systems
20.SH SYNOPSIS
21.B genext2fs
22.RI "[ options ] [ output\-image ]"
23.SH DESCRIPTION
24\fBgenext2fs\fP generates an ext2 filesystem
25as a normal (non-root) user. It does not require you to mount
26the image file to copy files on it, nor does it require that
27you become the superuser to make device nodes.
28
29The filesystem image is created in the file \fIoutput-image\fP. If not
30specified, it is sent to stdout.
31
32By default, the maximum number of inodes in the filesystem is the minimum
33number required to accommodate the initial contents.
34In this way, a minimal filesystem (typically read-only) can be created with
35minimal free inodes.
36If required, free inodes can be added by passing the relevant options.
37The filesystem image size in blocks can be minimised by trial and error.
38.SH OPTIONS
39.TP
40.BI "\-x, \-\-starting\-image image"
41Use this image as a starting point.
42.TP
43.BI "\-d, \-\-root directory[:path]"
44Add the given directory and contents at a particular path (by default
45the root).
46.TP
47.BI "\-D, \-\-devtable spec\-file[:path]"
48Use \fBspec-file\fP to specify inodes to be added, at the given
49path (by default the root), including files, directories and
50special files like devices.
51If the specified files are already present in the image, their
52ownership and permission modes will be adjusted accordingly.
53Furthermore, you can use a single table entry to create many devices
54with a range of minor numbers (see examples below).
55All specified inodes receive the mtime of \fBspec-file\fP itself.
56.TP
57.BI "\-b, \-\-size\-in\-blocks blocks"
58Size of the image in blocks.
59.TP
60.BI "\-N, \-\-number\-of\-inodes inodes"
61Maximum number of inodes.
62.TP
63.BI "\-i, \-\-bytes\-per\-inode ratio"
64Used to calculate the maximum number of inodes from the available blocks.
65.TP
66.BI "\-m, \-\-reserved\-percentage"
67Number of reserved blocks as a percentage of size. Reserving 0 blocks will prevent creation of the "lost+found" directory.
68.TP
69.BI "\-g, \-\-block\-map path"
70Generate a block map file for this path.
71.TP
72.BI "\-e, \-\-fill\-value value"
73Fill unallocated blocks with value.
74.TP
75.BI "\-z, \-\-allow\-holes"
76Make files with holes.
77.TP
78.BI "\-f, \-\-faketime"
79Use a timestamp of 0 for inode and filesystem creation, instead of the present. Useful for testing.
80.TP
81.BI "\-q, \-\-squash"
82Squash permissions and owners (same as -P -U).
83.TP
84.BI "\-U, \-\-squash\-uids"
85Squash ownership of inodes added using the -d option, making them all
86owned by root:root.
87.TP
88.BI "\-P, \-\-squash\-perms"
89Squash permissions of inodes added using the -d option. Analogous to
90"umask 077".
91.TP
92.BI "\-v, \-\-verbose"
93Print resulting filesystem structure.
94.TP
95.BI "\-V, \-\-version"
96Print genext2fs version.
97.TP
98.BI "\-h, \-\-help"
99Display help.
100.SH EXAMPLES
101
102.EX
103.B
104genext2fs -b 1440 -d src /dev/fd0
105.EE
106
107All files in the
108.I src
109directory will be written to
110.B /dev/fd0
111as a new ext2 filesystem image. You can then mount the floppy as
112usual.
113
114.EX
115.B
116genext2fs -b 1024 -d src -D device_table.txt flashdisk.img
117.EE
118
119This example builds a filesystem from all the files in
120.I src,
121then device nodes are created based on the contents of the file
122.I device_table.txt.
123Entries in the device table take the form of:
124
125<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
126
127where name is the file name and type can be one of:
128.RS
129.nf
130f A regular file
131d Directory
132c Character special device file
133b Block special device file
134p Fifo (named pipe)
135.fi
136.RE
137uid is the user id for the target file, gid is the group id for the
138target file. The rest of the entries (major, minor, etc) apply only
139to device special files.
140
141An example device file follows:
142
143.RS
144.nf
145# name type mode uid gid major minor start inc count
146
147/dev d 755 0 0 - - - - -
148/dev/mem c 640 0 0 1 1 0 0 -
149/dev/tty c 666 0 0 5 0 0 0 -
150/dev/tty c 666 0 0 4 0 0 1 6
151/dev/loop b 640 0 0 7 0 0 1 2
152/dev/hda b 640 0 0 3 0 0 0 -
153/dev/hda b 640 0 0 3 1 1 1 16
154/dev/log s 666 0 0 - - - - -
155.fi
156.RE
157
158This device table creates the /dev directory, a character device
159node /dev/mem (major 1, minor 1), and also creates /dev/tty,
160/dev/tty[0-5], /dev/loop[0-1], /dev/hda, /dev/hda1 to /dev/hda15 and
161/dev/log socket.
162
163.SH SEE ALSO
164.BR mkfs(8),
165.BR genromfs(8),
166.BR mkisofs(8),
167.BR mkfs.jffs2(1)
168.br
169.SH AUTHOR
170This manual page was written by David Kimdon <dwhedon@debian.org>,
171for the Debian GNU/Linux system (but may be used by others).
172Examples provided by Erik Andersen <andersen@codepoet.org>.