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