Hi folks,
EROFS [1] is a lightweight read-only filesystem designed for performance
which has already been shipped in most Linux distributions as well as widely
used in several scenarios, such as Android system partitions, container
images, and rootfs for embedded devices.
This patch brings EROFS uncompressed support together with related tests.
Now, it's possible to boot directly through GRUB with an EROFS rootfs.
EROFS compressed files will be supported later since it has more work to
polish.
[1] https://erofs.docs.kernel.org
v12:
20240517044054.2752375-1-hsiangkao@linux.alibaba.com">https://lore.kernel.org/grub-devel/20240517044054.2752375-1-hsiangkao@linux.alibaba.com
changelog since v12:
- Address ALIGN_UP_OVF() suggested by Daniel:
Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl">https://lore.kernel.org/grub-devel/Zkcv7G7MJBg8sKiE@tomti.i.net-space.pl
Tested-by Link (Commit 1):
https://lists.gnu.org/archive/html/grub-devel/2024-05/msg00001.html
Reviewed-by Link (Commit 2):
https://lists.gnu.org/archive/html/grub-devel/2024-04/msg00101.html
Reviewed-by Link (Commit 2):
ZkZ8fdd+ZCkT+t7n@tomti.i.net-space.pl/">https://lore.kernel.org/grub-devel/ZkZ8fdd+ZCkT+t7n@tomti.i.net-space.pl/
Gao Xiang (1):
safemath: Add ALIGN_UP_OVF() that checks for {over,under}flow
Yifan Zhao (2):
fs/erofs: Add support for EROFS
fs/erofs: Add tests for EROFS in grub-fs-tester
.gitignore | 1 +
INSTALL | 8 +-
Makefile.util.def | 7 +
docs/grub.texi | 3 +-
grub-core/Makefile.core.def | 5 +
grub-core/fs/erofs.c | 1000 ++++++++++++++++++++++++++++++++++
include/grub/safemath.h | 16 +
tests/erofs_test.in | 20 +
tests/util/grub-fs-tester.in | 32 +-
9 files changed, 1080 insertions(+), 12 deletions(-)
create mode 100644 grub-core/fs/erofs.c
create mode 100644 tests/erofs_test.in
Interdiff against v12:
diff --git a/grub-core/fs/erofs.c b/grub-core/fs/erofs.c
index 630f95e75..005d975de 100644
--- a/grub-core/fs/erofs.c
+++ b/grub-core/fs/erofs.c
@@ -405,10 +405,8 @@ erofs_map_blocks_chunkmode (grub_fshelp_node_t node,
if (grub_add (pos, erofs_inode_xattr_ibody_size (node), &pos))
return grub_error (GRUB_ERR_OUT_OF_RANGE, "chunkmap position overflow when
adding xattr size");
- /* pos = ALIGN_UP(pos, unit) */
- if (grub_add (pos, unit - 1, &pos))
+ if (ALIGN_UP_OVF (pos, unit - 1, &pos))