aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/makefs/makefs.c
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2015-10-13 02:32:15 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2015-10-13 02:32:15 +0000
commita08b904c5e3a4722e6d0fde092d6d23f8d82d697 (patch)
tree624a5e122cf9c1abc1c780a869c3606fec4d002d /usr.sbin/makefs/makefs.c
parentdcaa560af093cefde796a1f3fd9f61c9ee9f1b5d (diff)
downloadsrc-a08b904c5e3a4722e6d0fde092d6d23f8d82d697.tar.gz
src-a08b904c5e3a4722e6d0fde092d6d23f8d82d697.zip
makefs: introduce a new option to specify what to round the resulting
image up to. From ticket: While trying to run FreeBSD/mips on some device having very small flash media, one is forced to compress file system with mkulzma(8) utility. It is desirable to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8) and big compression block size like 65535 bytes to mkulzma at the same time. Then one obtains very good comression ratios (like 75% and more) but faces the following problem. geom_uncompress kernel module reports GEOM provider size rounded up to its compression block size. Generally, this changes original media size and now it fails to match the size of embedded UFS file system that leads to other problems, f.e. geom_label kernel module does not like this and skips the file system while tasting the GEOM and looking for UFS label. This makes it impossible to refer to the file system using known UFS label instead of something like /dev/map/rootfs.uncompress. The following patch introduces new command line option "-r roundup" for makefs that makes it round up the image to specified block size. Hence, geom_uncompress does not change GEOM media size for images rounded that way and geom_label accepts such GEOMs just fine. With the patch applied, one can use following commands: $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs $ mkulzma -s 65536 -o fs.img.ulzma fs.img PR: bin/203707 Submitted by: <eugen@grosbein.net>
Notes
Notes: svn path=/head/; revision=289203
Diffstat (limited to 'usr.sbin/makefs/makefs.c')
-rw-r--r--usr.sbin/makefs/makefs.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c
index bf10034f00d1..5e419ccb0d89 100644
--- a/usr.sbin/makefs/makefs.c
+++ b/usr.sbin/makefs/makefs.c
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
- while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:xZ")) != -1) {
+ while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pr:s:S:t:xZ")) != -1) {
switch (ch) {
case 'B':
@@ -209,6 +209,12 @@ main(int argc, char *argv[])
fsoptions.sparse = 1;
break;
+ case 'r':
+ /* Round image size up to specified block size */
+ fsoptions.roundup =
+ strsuftoll("roundup", optarg, 0, LLONG_MAX);
+ break;
+
case 's':
fsoptions.minsize = fsoptions.maxsize =
strsuftoll("size", optarg, 1LL, LLONG_MAX);
@@ -359,9 +365,9 @@ usage(void)
prog = getprogname();
fprintf(stderr,
"usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n"
-"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]\n"
-"\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-xZ]\n"
-"\t[-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
+"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-r roundup ]\n"
+"\t[-s image-size] [-b free-blocks] [-f free-files] [-F mtree-specfile]\n"
+"\t[-xZ] [-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
prog);
exit(1);
}