forked from dan/liminix
fixup 98243d43da
This commit is contained in:
parent
3194262eb3
commit
07e7d63ade
|
@ -1,4 +1,4 @@
|
|||
From e01c82f9f405dd24d333ffd1aadd772835706e26 Mon Sep 17 00:00:00 2001
|
||||
From 21c84f244520f3656ffff3cc9b213d70480dc36d Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Barlow <dan@telent.net>
|
||||
Date: Fri, 31 Mar 2023 23:33:04 +0100
|
||||
Subject: [PATCH] mkfs.jffs2: add --graft option
|
||||
|
@ -12,11 +12,11 @@ mkfs.jffs2 -r ./rootfs --graft $HOME/Pictures:/pictures
|
|||
to add your photo collection into the filesystem at /pictures
|
||||
without first copying it to rootfs
|
||||
---
|
||||
jffsX-utils/mkfs.jffs2.c | 61 ++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 59 insertions(+), 2 deletions(-)
|
||||
jffsX-utils/mkfs.jffs2.c | 63 ++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 61 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
|
||||
index bd67634..c54bcb8 100644
|
||||
index bd67634..ebf2d98 100644
|
||||
--- a/jffsX-utils/mkfs.jffs2.c
|
||||
+++ b/jffsX-utils/mkfs.jffs2.c
|
||||
@@ -112,6 +112,13 @@ static int squash_perms = 0;
|
||||
|
@ -33,22 +33,24 @@ index bd67634..c54bcb8 100644
|
|||
static uint32_t find_hardlink(struct filesystem_entry *e)
|
||||
{
|
||||
struct filesystem_entry *f;
|
||||
@@ -597,6 +604,14 @@ static void cleanup(struct filesystem_entry *dir)
|
||||
@@ -597,6 +604,16 @@ static void cleanup(struct filesystem_entry *dir)
|
||||
}
|
||||
}
|
||||
|
||||
+static void free_grafts(struct graft *graft)
|
||||
+{
|
||||
+ if(graft->next) free_grafts(graft->next);
|
||||
+ free((char *)graft->source);
|
||||
+ free((char *)graft);
|
||||
+ if(graft) {
|
||||
+ if(graft->next) free_grafts(graft->next);
|
||||
+ free((char *)graft->source);
|
||||
+ free((char *)graft);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Here is where we do the actual creation of the file system */
|
||||
#include "mtd/jffs2-user.h"
|
||||
|
||||
@@ -1359,6 +1374,7 @@ static void create_target_filesystem(struct filesystem_entry *root)
|
||||
@@ -1359,6 +1376,7 @@ static void create_target_filesystem(struct filesystem_entry *root)
|
||||
static struct option long_options[] = {
|
||||
{"pad", 2, NULL, 'p'},
|
||||
{"root", 1, NULL, 'r'},
|
||||
|
@ -56,7 +58,7 @@ index bd67634..c54bcb8 100644
|
|||
{"pagesize", 1, NULL, 's'},
|
||||
{"eraseblock", 1, NULL, 'e'},
|
||||
{"output", 1, NULL, 'o'},
|
||||
@@ -1396,6 +1412,9 @@ static const char helptext[] =
|
||||
@@ -1396,6 +1414,9 @@ static const char helptext[] =
|
||||
" not specified, the output is padded to the end of\n"
|
||||
" the final erase block\n"
|
||||
" -r, -d, --root=DIR Build file system from directory DIR (default: cwd)\n"
|
||||
|
@ -66,7 +68,7 @@ index bd67634..c54bcb8 100644
|
|||
" -s, --pagesize=SIZE Use page size (max data node size) SIZE.\n"
|
||||
" Set according to target system's memory management\n"
|
||||
" page size (default: 4KiB)\n"
|
||||
@@ -1430,6 +1449,24 @@ static const char helptext[] =
|
||||
@@ -1430,6 +1451,24 @@ static const char helptext[] =
|
||||
" -V, --version Display version information\n"
|
||||
" -i, --incremental=FILE Parse FILE and generate appendage output for it\n\n";
|
||||
|
||||
|
@ -91,7 +93,7 @@ index bd67634..c54bcb8 100644
|
|||
static int load_next_block(void) {
|
||||
|
||||
int ret;
|
||||
@@ -1579,7 +1616,7 @@ int main(int argc, char **argv)
|
||||
@@ -1579,7 +1618,7 @@ int main(int argc, char **argv)
|
||||
jffs2_compressors_init();
|
||||
|
||||
while ((opt = getopt_long(argc, argv,
|
||||
|
@ -100,7 +102,7 @@ index bd67634..c54bcb8 100644
|
|||
{
|
||||
switch (opt) {
|
||||
case 'D':
|
||||
@@ -1598,6 +1635,18 @@ int main(int argc, char **argv)
|
||||
@@ -1598,6 +1637,18 @@ int main(int argc, char **argv)
|
||||
rootdir = xstrdup(optarg);
|
||||
break;
|
||||
|
||||
|
@ -119,12 +121,12 @@ index bd67634..c54bcb8 100644
|
|||
case 's':
|
||||
page_size = strtol(optarg, NULL, 0);
|
||||
warn_page_size = 0; /* set by user, so don't need to warn */
|
||||
@@ -1784,13 +1833,21 @@ int main(int argc, char **argv)
|
||||
@@ -1784,13 +1835,21 @@ int main(int argc, char **argv)
|
||||
parse_image();
|
||||
|
||||
root = recursive_add_host_directory(NULL, "/", cwd);
|
||||
-
|
||||
+ for(struct graft *g = grafts; g->source; g=g->next) {
|
||||
+ for(struct graft *g = grafts; g && g->source; g=g->next) {
|
||||
+ struct filesystem_entry * entry =
|
||||
+ find_filesystem_entry(root, (char *) g->dest, S_IFDIR);
|
||||
+ if(!entry)
|
||||
|
|
Loading…
Reference in New Issue