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

v14: 
https://lore.kernel.org/grub-devel/20240517125641.3346171-1-hsiang...@linux.alibaba.com
changelog since v12:
- drop unnecessary check of `align` in ALIGN_UP_OVF() sicne it is mostly
  a non zero const that we can trust suggested by Vladimir and Boyang:
  
https://lore.kernel.org/grub-devel/CAEaD8JNwa8W=3lvavedg0hbyz10+xhedwcsv8tqe5md_13s...@mail.gmail.com

Reviewed-by Link (Commit 1): 
https://lore.kernel.org/grub-devel/zkuadi5z+e%2fmk...@tomti.i.net-space.pl
Tested-by Link (Commit 2): 
https://lists.gnu.org/archive/html/grub-devel/2024-05/msg00001.html
Reviewed-by Link (Commit 3): 
https://lists.gnu.org/archive/html/grub-devel/2024-04/msg00101.html
Reviewed-by Link (Commit 3): 
https://lore.kernel.org/grub-devel/zkz8fdd+zckt+...@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 v14:

diff --git a/include/grub/safemath.h b/include/grub/safemath.h
index baaea0ef4..bb8a5b39c 100644
--- a/include/grub/safemath.h
+++ b/include/grub/safemath.h
@@ -32,19 +32,19 @@
 
 #define grub_cast(a, res)      grub_add ((a), 0, (res))
 
+/*
+ * It's caller's responsibility that `align` should not equal to 0 and
+ * it must be a power of 2.
+ */
 #define ALIGN_UP_OVF(v, align, res)                    \
 ({                                                     \
   bool __failed;                                       \
-  typeof(v) a;                                         \
+  typeof(v) __a = ((typeof(v))(align) - 1);            \
                                                        \
-  __failed = grub_sub ((typeof(v))(align), 1, &a);     \
+  __failed = grub_add (v, __a, res);                   \
   if (__failed == false)                               \
     {                                                  \
-    __failed = grub_add (v, a, res);                   \
-    if (__failed == false)                             \
-      {                                                        \
-        *(res) &= ~a;                                  \
-      }                                                        \
+      *(res) &= ~__a;                                  \
     }                                                  \
 __failed;})
 
-- 
2.39.3


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to