Skip to contentSkip to conversation

fs/squashfs: tweaks and cleanups

PATCH New Yann E. MORIN 2 participants 5 messages Jul 10, 2017 – Jul 11, 2017 SquashFS file system

lore
Share & tools
lore
#0 lore raw

v2 cover fs/squashfs: tweaks and cleanups

Hello All!

The Linux kernel refuses to ount a squashfs image tha is not padded to a 256KiB boundary. Fix that when generating the image, and drop the workaround we had in our testing infra.

Clean up squashfs.mk at the same time.

Changes v1 -> v2:
- padding to 256KiB (not 1MiB) looks like it is enough

Regards,
Yann E. MORIN.

The following changes since commit 704db1586c1408106e1337bc7a2ab3cfec593899

support/testing: unbreak run-tests -l (2017-07-10 23:51:33 +0200)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to d93a18bd0729d35c7b7e3ce7e810d8fbf69af522

support/test: don't workaround squashfs padding (2017-07-11 00:08:17 +0200)

----------------------------------------------------------------
Yann E. MORIN (3):
fs/squashfs: cleanup if-else cascade fs/squashfs: align size to 256KiB support/test: don't workaround squashfs padding

 DEVELOPERS                                |  1 +
 fs/squashfs/squashfs.mk                   | 15 ++++++---------
 support/testing/tests/fs/test_squashfs.py |  1 -
 3 files changed, 7 insertions(+), 10 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/3 fs/squashfs: cleanup if-else cascade

And add myself to the DEVELOPPERS for squashfs.

---
 DEVELOPERS              |  1 +
 fs/squashfs/squashfs.mk | 12 +++---------
 2 files changed, 4 insertions(+), 9 deletions(-)
DEVELOPERS +1 -0
index 1ec405a570..f392838efe 100644
@@ -1777,6 +1777,7 @@ N:	Wojciech Nizi?ski <[email protected]>
 F:	package/fwup/
 
 N:	Yann E. MORIN <[email protected]>
+F:	fs/squashfs/
 F:	package/cegui06/
 F:	package/celt051/
 F:	package/dtc/
fs/squashfs/squashfs.mk +3 -9
index 68a57b074a..342c7a8a37 100644
@@ -8,21 +8,15 @@ ROOTFS_SQUASHFS_DEPENDENCIES = host-squashfs
 
 ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZ4),y)
 ROOTFS_SQUASHFS_ARGS += -comp lz4 -Xhc
-else
-ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZO),y)
+else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZO),y)
 ROOTFS_SQUASHFS_ARGS += -comp lzo
-else
-ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZMA),y)
+else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZMA),y)
 ROOTFS_SQUASHFS_ARGS += -comp lzma
-else
-ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_XZ),y)
+else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_XZ),y)
 ROOTFS_SQUASHFS_ARGS += -comp xz
 else
 ROOTFS_SQUASHFS_ARGS += -comp gzip
 endif
-endif
-endif
-endif
 
 define ROOTFS_SQUASHFS_CMD
 	$(HOST_DIR)/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
Signature · 1 line
2.11.0
#3 lore raw

PATCH v2 2/3 fs/squashfs: align size to 256KiB

In reply to Yann E. MORIN

By experimental evidence, the Linux kernel will refuse to mount a squashfs image/partition that is not padded to a 256kiB boundary.

We already have a similar workaround in the testing infrastructure, in support/testing/tests/fs/test_squashfs.py at 26.

Use that workaround directly during the squashfs generation.

Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v2:
- drop the requirements to just 256KiB

---
 fs/squashfs/squashfs.mk | 3 +++
 1 file changed, 3 insertions(+)
fs/squashfs/squashfs.mk +3 -0
index 342c7a8a37..bf697acb3d 100644
@@ -18,9 +18,12 @@ else
 ROOTFS_SQUASHFS_ARGS += -comp gzip
 endif
 
+# Experimental evidence shows that a squashfs image size must be
+# a multiple of 256KiB.
 define ROOTFS_SQUASHFS_CMD
 	$(HOST_DIR)/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
 		$(ROOTFS_SQUASHFS_ARGS)
+	truncate -s %256k $@
 endef
 
 $(eval $(call ROOTFS_TARGET,squashfs))
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 3/3 support/test: don't workaround squashfs padding

In reply to Yann E. MORIN

We now create properly-padded squashfs images, so we need not do it in the testing infra, In fact, we want to catch such a change as a regression (the system won't boot).

Cc Thomas Petazzoni <[email protected]>
---
 support/testing/tests/fs/test_squashfs.py | 1 -
 1 file changed, 1 deletion(-)
support/testing/tests/fs/test_squashfs.py +0 -1
index b205b6a55a..228a8179fd 100644
@@ -23,7 +23,6 @@ BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y
         self.assertEqual(out[3], "Compression lz4")
 
         img = os.path.join(self.builddir, "images", "rootfs.squashfs")
-        subprocess.call(["truncate", "-s", "%1M", img])
 
         self.emulator.boot(arch="armv7",
                            kernel="builtin",
Signature · 1 line
2.11.0