From: Jan Luebbe <jlu@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Jan Luebbe <jlu@pengutronix.de>
Subject: [ptxdist] [PATCH] image_ext2: improve image generation and support ext4
Date: Thu, 31 May 2012 15:27:08 +0200 [thread overview]
Message-ID: <1338470828-8339-1-git-send-email-jlu@pengutronix.de> (raw)
In some cases, genext2fs does not produce enough inodes. Specify
16384 bytes per inode by default (can be overridden using
IMAGE_EXT2_EXTRA_ARGS).
Also run e2fsck in all cases to generate a UUID in the superblock.
Finally support upgrading the image to ext4.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
platforms/image_ext2.in | 14 +++++++++++---
rules/post/image_ext2.make | 25 +++++++++++++++++++------
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/platforms/image_ext2.in b/platforms/image_ext2.in
index c26efd0..d87a8f5 100644
--- a/platforms/image_ext2.in
+++ b/platforms/image_ext2.in
@@ -14,7 +14,7 @@ config IMAGE_EXT2_SIZE
default 20480
prompt "Size in kilobytes"
help
- FIXME: This item needs to be documented
+ Size of the image in kilobytes
config IMAGE_EXT2_EXTRA_ARGS
string
@@ -33,9 +33,17 @@ config IMAGE_EXT2_GZIP
config IMAGE_EXT2_JOURNAL
bool
select HOST_E2FSPROGS
- prompt "Add a journal to the ext2 file system image, making it ext3"
+ prompt "Upgrade the ext2 file system image to ext3 by adding a journal"
+ help
+ Enable this option if you want to mount the root file system as
+ an ext3 image.
+
+config IMAGE_EXT2_EXT4
+ bool
+ select IMAGE_EXT2_JOURNAL
+ prompt "Upgrade the ext2 file system image to ext4"
help
Enable this option if you want to mount the root file system as
- ext3 image.
+ an ext4 image.
endif
diff --git a/rules/post/image_ext2.make b/rules/post/image_ext2.make
index ed7d037..9988ce5 100644
--- a/rules/post/image_ext2.make
+++ b/rules/post/image_ext2.make
@@ -13,13 +13,14 @@ SEL_ROOTFS-$(PTXCONF_IMAGE_EXT2_GZIP) += $(IMAGEDIR)/root.ext2.gz
$(IMAGEDIR)/root.ext2: $(STATEDIR)/image_working_dir
@echo -n "Creating root.ext2 from working dir..."
- @cd $(image/work_dir); \
+ @cd $(image/work_dir); \
(awk -F: $(DOPERMISSIONS) $(image/permissions) && \
( \
echo -n "$(PTXCONF_SYSROOT_HOST)/bin/genext2fs "; \
echo -n "-b $(PTXCONF_IMAGE_EXT2_SIZE) "; \
+ echo -n "-i 16384 "; \
echo -n "$(PTXCONF_IMAGE_EXT2_EXTRA_ARGS) "; \
- echo -n "-d $(image/work_dir) "; \
+ echo -n "-d $(image/work_dir) "; \
echo "$@" ) \
) | $(FAKEROOT) --
@echo "done."
@@ -31,12 +32,24 @@ ifdef PTXCONF_IMAGE_EXT2_JOURNAL
# # mode we use output redirection (and since we're operating on files
# # and not on real block devices, it's very unlikely that there are
# # errors we want to see.
- @echo -n "Adding a journal to root.ext2 ..."
- @tune2fs -j "$(IMAGEDIR)/root.ext2" > /dev/null
- @e2fsck -y "$(IMAGEDIR)/root.ext2" > /dev/null 2>&1
- @echo "done."
+ @echo -n "Upgrading root.ext2 to ext3..."
+ @tune2fs -O has_journal "$(IMAGEDIR)/root.ext2" >/dev/null
+ @echo "done."
+endif
+
+ifdef PTXCONF_IMAGE_EXT2_EXT4
+ @echo -n "Upgrading root.ext2 to ext4..."
+ @tune2fs -O extents,uninit_bg,dir_index "$(IMAGEDIR)/root.ext2" >/dev/null
+ @echo "done."
endif
+ @echo -n "Running e2fsck on root.ext2..."
+ @e2fsck -pvfD "$(IMAGEDIR)/root.ext2" >/dev/null 2>&1; test $$? -le 2
+ @echo "done."
+
+ @echo -n "Summary of root.ext2:"
+ @e2fsck -pvf "$(IMAGEDIR)/root.ext2"
+
$(IMAGEDIR)/root.ext2.gz: $(IMAGEDIR)/root.ext2
@echo -n "Creating root.ext2.gz from root.ext2...";
@rm -f $@
--
1.7.9.5
--
ptxdist mailing list
ptxdist@pengutronix.de
reply other threads:[~2012-05-31 13:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338470828-8339-1-git-send-email-jlu@pengutronix.de \
--to=jlu@pengutronix.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox