The Android Open Source Project | 2068259 | 2009-03-03 19:29:32 -0800 | [diff] [blame] | 1 | .\" 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 |
| 19 | genext2fs \- 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 |
| 25 | as a normal (non-root) user. It does not require you to mount |
| 26 | the image file to copy files on it, nor does it require that |
| 27 | you become the superuser to make device nodes. |
| 28 | |
| 29 | The filesystem image is created in the file \fIoutput-image\fP. If not |
| 30 | specified, it is sent to stdout. |
| 31 | |
| 32 | By default, the maximum number of inodes in the filesystem is the minimum |
| 33 | number required to accommodate the initial contents. |
| 34 | In this way, a minimal filesystem (typically read-only) can be created with |
| 35 | minimal free inodes. |
| 36 | If required, free inodes can be added by passing the relevant options. |
| 37 | The filesystem image size in blocks can be minimised by trial and error. |
| 38 | .SH OPTIONS |
| 39 | .TP |
| 40 | .BI "\-x, \-\-starting\-image image" |
| 41 | Use this image as a starting point. |
| 42 | .TP |
| 43 | .BI "\-d, \-\-root directory[:path]" |
| 44 | Add the given directory and contents at a particular path (by default |
| 45 | the root). |
| 46 | .TP |
| 47 | .BI "\-D, \-\-devtable spec\-file[:path]" |
| 48 | Use \fBspec-file\fP to specify inodes to be added, at the given |
| 49 | path (by default the root), including files, directories and |
| 50 | special files like devices. |
| 51 | If the specified files are already present in the image, their |
| 52 | ownership and permission modes will be adjusted accordingly. |
| 53 | Furthermore, you can use a single table entry to create many devices |
| 54 | with a range of minor numbers (see examples below). |
| 55 | All specified inodes receive the mtime of \fBspec-file\fP itself. |
| 56 | .TP |
| 57 | .BI "\-b, \-\-size\-in\-blocks blocks" |
| 58 | Size of the image in blocks. |
| 59 | .TP |
| 60 | .BI "\-N, \-\-number\-of\-inodes inodes" |
| 61 | Maximum number of inodes. |
| 62 | .TP |
| 63 | .BI "\-i, \-\-bytes\-per\-inode ratio" |
| 64 | Used to calculate the maximum number of inodes from the available blocks. |
| 65 | .TP |
| 66 | .BI "\-m, \-\-reserved\-percentage" |
| 67 | Number 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" |
| 70 | Generate a block map file for this path. |
| 71 | .TP |
| 72 | .BI "\-e, \-\-fill\-value value" |
| 73 | Fill unallocated blocks with value. |
| 74 | .TP |
| 75 | .BI "\-z, \-\-allow\-holes" |
| 76 | Make files with holes. |
| 77 | .TP |
| 78 | .BI "\-f, \-\-faketime" |
| 79 | Use a timestamp of 0 for inode and filesystem creation, instead of the present. Useful for testing. |
| 80 | .TP |
| 81 | .BI "\-q, \-\-squash" |
| 82 | Squash permissions and owners (same as -P -U). |
| 83 | .TP |
| 84 | .BI "\-U, \-\-squash\-uids" |
| 85 | Squash ownership of inodes added using the -d option, making them all |
| 86 | owned by root:root. |
| 87 | .TP |
| 88 | .BI "\-P, \-\-squash\-perms" |
| 89 | Squash permissions of inodes added using the -d option. Analogous to |
| 90 | "umask 077". |
| 91 | .TP |
| 92 | .BI "\-v, \-\-verbose" |
| 93 | Print resulting filesystem structure. |
| 94 | .TP |
| 95 | .BI "\-V, \-\-version" |
| 96 | Print genext2fs version. |
| 97 | .TP |
| 98 | .BI "\-h, \-\-help" |
| 99 | Display help. |
| 100 | .SH EXAMPLES |
| 101 | |
| 102 | .EX |
| 103 | .B |
| 104 | genext2fs -b 1440 -d src /dev/fd0 |
| 105 | .EE |
| 106 | |
| 107 | All files in the |
| 108 | .I src |
| 109 | directory will be written to |
| 110 | .B /dev/fd0 |
| 111 | as a new ext2 filesystem image. You can then mount the floppy as |
| 112 | usual. |
| 113 | |
| 114 | .EX |
| 115 | .B |
| 116 | genext2fs -b 1024 -d src -D device_table.txt flashdisk.img |
| 117 | .EE |
| 118 | |
| 119 | This example builds a filesystem from all the files in |
| 120 | .I src, |
| 121 | then device nodes are created based on the contents of the file |
| 122 | .I device_table.txt. |
| 123 | Entries in the device table take the form of: |
| 124 | |
| 125 | <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count> |
| 126 | |
| 127 | where name is the file name and type can be one of: |
| 128 | .RS |
| 129 | .nf |
| 130 | f A regular file |
| 131 | d Directory |
| 132 | c Character special device file |
| 133 | b Block special device file |
| 134 | p Fifo (named pipe) |
| 135 | .fi |
| 136 | .RE |
| 137 | uid is the user id for the target file, gid is the group id for the |
| 138 | target file. The rest of the entries (major, minor, etc) apply only |
| 139 | to device special files. |
| 140 | |
| 141 | An 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 | |
| 158 | This device table creates the /dev directory, a character device |
| 159 | node /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 |
| 170 | This manual page was written by David Kimdon <dwhedon@debian.org>, |
| 171 | for the Debian GNU/Linux system (but may be used by others). |
| 172 | Examples provided by Erik Andersen <andersen@codepoet.org>. |