All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/7] configure: Look for .otf fonts
@ 2024-09-03 17:58 Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations Vladimir Serbinenko
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d4a14bf93..fe5493246 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1875,7 +1875,7 @@ AC_ARG_WITH([unifont],
 
 if test "x$with_unifont" = x; then
   # search in well-known directories
-  for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
+  for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz otf otf.gz; do
     for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc /usr/pkg/share/fonts/X11/misc /usr/local/share/fonts/gnu-unifont /usr/local/share/fonts/unifont; do
       if test -f "$dir/unifont.$ext"; then
         md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations
  2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
@ 2024-09-03 17:58 ` Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 3/7] xzembed: Silence warning when no BCJ is available Vladimir Serbinenko
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Otherwise depending on compiler we end up with umoddi3 reference and
failed module dependency resolution

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/fs/erofs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grub-core/fs/erofs.c b/grub-core/fs/erofs.c
index 46cfc2e5c..f2a82e988 100644
--- a/grub-core/fs/erofs.c
+++ b/grub-core/fs/erofs.c
@@ -357,13 +357,13 @@ erofs_map_blocks_flatmode (grub_fshelp_node_t node,
     {
       if (grub_add (erofs_iloc (node), erofs_inode_size (node), &map->m_pa) ||
 	  grub_add (map->m_pa, erofs_inode_xattr_ibody_size (node), &map->m_pa) ||
-	  grub_add (map->m_pa, map->m_la % blocksz, &map->m_pa))
+	  grub_add (map->m_pa, map->m_la & (blocksz - 1), &map->m_pa))
 	return grub_error (GRUB_ERR_OUT_OF_RANGE, "m_pa overflow when handling tailpacking");
       if (grub_sub (file_size, map->m_la, &map->m_plen))
 	return grub_error (GRUB_ERR_OUT_OF_RANGE, "m_plen overflow when handling tailpacking");
 
       /* No overflow as map->m_plen <= UINT64_MAX - blocksz + 1. */
-      if (((map->m_pa % blocksz) + map->m_plen) > blocksz)
+      if (((map->m_pa & (blocksz - 1)) + map->m_plen) > blocksz)
 	return grub_error (GRUB_ERR_BAD_FS,
                            "inline data cross block boundary @ inode %" PRIuGRUB_UINT64_T,
                            node->ino);
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/7] xzembed: Silence warning when no BCJ is available
  2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations Vladimir Serbinenko
@ 2024-09-03 17:58 ` Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 4/7] configure: Add -mno-gpopt option Vladimir Serbinenko
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

BCJ is not available for all platforms hence arguments may end up unused

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 grub-core/lib/xzembed/xz_dec_bcj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/lib/xzembed/xz_dec_bcj.c b/grub-core/lib/xzembed/xz_dec_bcj.c
index bf6b5862e..aef4638d4 100644
--- a/grub-core/lib/xzembed/xz_dec_bcj.c
+++ b/grub-core/lib/xzembed/xz_dec_bcj.c
@@ -353,7 +353,7 @@ static noinline_for_stack size_t bcj_sparc(
  * avoid pointers to static data (at least on x86).
  */
 static void bcj_apply(struct xz_dec_bcj *s,
-		uint8_t *buf, size_t *pos, size_t size)
+		      uint8_t *buf __attribute__((unused)), size_t *pos, size_t size __attribute__((unused)))
 {
 	size_t filtered;
 
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/7] configure: Add -mno-gpopt option
  2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 3/7] xzembed: Silence warning when no BCJ is available Vladimir Serbinenko
@ 2024-09-03 17:58 ` Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 5/7] gentpl: Put startup_raw.S into beginning of the image Vladimir Serbinenko
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Without it compiler generates GPREL16 references which do not work
with our memory layout

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 configure.ac | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/configure.ac b/configure.ac
index fe5493246..c3d9398ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,9 +802,21 @@ if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
   if test "x$grub_cv_cc_mflush_func" = xyes; then
     TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
   fi
+
+  AC_CACHE_CHECK([whether -mno-gpopt works], [grub_cv_cc_mno_gpopt], [
+    CFLAGS="$TARGET_CFLAGS -mno-gpopt -Werror"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+        [grub_cv_cc_mno_gpopt=yes],
+	[grub_cv_cc_mno_gpopt=no])
+  ])
+
+  if test "x$grub_cv_cc_mno_gpopt" = xyes; then
+    TARGET_CFLAGS="$TARGET_CFLAGS -mno-gpopt"
+  fi
 fi
 
 
+
 # Force no alignment to save space on i386.
 if test "x$target_cpu" = xi386; then
   TARGET_CFLAGS="$TARGET_CFLAGS -falign-functions=1"
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 5/7] gentpl: Put startup_raw.S into beginning of the image
  2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
                   ` (2 preceding siblings ...)
  2024-09-03 17:58 ` [PATCH v2 4/7] configure: Add -mno-gpopt option Vladimir Serbinenko
@ 2024-09-03 17:58 ` Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 6/7] offsets: Set mod_align to 4 on mips Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start Vladimir Serbinenko
  5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Otherwise it breaks the decompressors for mips platforms

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 gentpl.py                   | 4 ++--
 grub-core/Makefile.core.def | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gentpl.py b/gentpl.py
index 3b12eca6c..d8c6965d8 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -634,7 +634,7 @@ def extra_dist(defn):
 def extra_dep(defn):
     return foreach_value(defn, "depends", lambda value: value + " ")
 
-def platform_sources(defn, p): return platform_values(defn, p, "")
+def platform_sources(defn, p): return platform_values(defn, p, "_head") + platform_values(defn, p, "")
 def platform_nodist_sources(defn, p): return platform_values(defn, p, "_nodist")
 
 def platform_startup(defn, p): return platform_specific_values(defn, p, "_startup", "startup")
@@ -660,7 +660,7 @@ def first_time(defn, snippet):
 def is_platform_independent(defn):
     if 'enable' in defn:
         return False
-    for suffix in [ "", "_nodist" ]:
+    for suffix in [ "", "_head", "_nodist" ]:
         template = platform_values(defn, GRUB_PLATFORMS[0], suffix)
         for platform in GRUB_PLATFORMS[1:]:
             if template != platform_values(defn, platform, suffix):
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 705d73fab..063ef5dd7 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -536,7 +536,7 @@ image = {
 
 image = {
   name = xz_decompress;
-  mips = boot/mips/startup_raw.S;
+  mips_head = boot/mips/startup_raw.S;
   common = boot/decompressor/minilib.c;
   common = boot/decompressor/xz.c;
   common = lib/xzembed/xz_dec_bcj.c;
@@ -554,7 +554,7 @@ image = {
 
 image = {
   name = none_decompress;
-  mips = boot/mips/startup_raw.S;
+  mips_head = boot/mips/startup_raw.S;
   common = boot/decompressor/none.c;
 
   cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 6/7] offsets: Set mod_align to 4 on mips
  2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
                   ` (3 preceding siblings ...)
  2024-09-03 17:58 ` [PATCH v2 5/7] gentpl: Put startup_raw.S into beginning of the image Vladimir Serbinenko
@ 2024-09-03 17:58 ` Vladimir Serbinenko
  2024-09-03 17:58 ` [PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start Vladimir Serbinenko
  5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Module structure has natural alignment of 4. Respect it explicitly
rather than relying on the fact that _end is usually aligned

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 include/grub/offsets.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/grub/offsets.h b/include/grub/offsets.h
index 871e1cd4c..442dc31de 100644
--- a/include/grub/offsets.h
+++ b/include/grub/offsets.h
@@ -118,9 +118,9 @@
 #define GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN 3
 #define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN (1 << GRUB_KERNEL_SPARC64_IEEE1275_LOG_MOD_ALIGN)
 
-#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
-#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
-#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
+#define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x4
+#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x4
+#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x4
 
 #define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 	0x8
 #define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE	0x4
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start
  2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
                   ` (4 preceding siblings ...)
  2024-09-03 17:58 ` [PATCH v2 6/7] offsets: Set mod_align to 4 on mips Vladimir Serbinenko
@ 2024-09-03 17:58 ` Vladimir Serbinenko
  5 siblings, 0 replies; 7+ messages in thread
From: Vladimir Serbinenko @ 2024-09-03 17:58 UTC (permalink / raw)
  To: grub-devel; +Cc: Vladimir Serbinenko

Assembly code looks for modules at __bss_start. Make this position explicit
rather than matching bss alignment and module alignment.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 util/grub-mkimagexx.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index e50b29533..fe6085c8b 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -2431,6 +2431,8 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
   if (!is_relocatable (image_target))
     {
       Elf_Addr current_address = layout->kernel_size;
+      Elf_Addr bss_start = layout->kernel_size;
+      bool is_first = true;
 
       for (i = 0, s = smd.sections;
 	   i < smd.num_sections;
@@ -2453,6 +2455,12 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
 	      current_address = grub_host_to_target_addr (s->sh_addr)
 		- image_target->link_addr;
 
+	    if (is_first)
+	      {
+		bss_start = current_address;
+		is_first = false;
+	      }
+
 	    smd.vaddrs[i] = current_address
 	      + image_target->vaddr_offset;
 	    current_address += grub_host_to_target_addr (s->sh_size);
@@ -2460,6 +2468,16 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
       current_address = ALIGN_UP (current_address + image_target->vaddr_offset,
 				  image_target->section_align)
 	- image_target->vaddr_offset;
+
+      if (image_target->id == IMAGE_YEELOONG_FLASH
+	  || image_target->id == IMAGE_FULOONG2F_FLASH
+	  || image_target->id == IMAGE_LOONGSON_ELF
+	  || image_target->id == IMAGE_QEMU_MIPS_FLASH
+	  || image_target->id == IMAGE_MIPS_ARC)
+	{
+	  layout->kernel_size = bss_start;
+	}
+
       layout->bss_size = current_address - layout->kernel_size;
     }
   else
-- 
2.39.2


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-03 18:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 17:58 [PATCH v2 1/7] configure: Look for .otf fonts Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 3/7] xzembed: Silence warning when no BCJ is available Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 4/7] configure: Add -mno-gpopt option Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 5/7] gentpl: Put startup_raw.S into beginning of the image Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 6/7] offsets: Set mod_align to 4 on mips Vladimir Serbinenko
2024-09-03 17:58 ` [PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start Vladimir Serbinenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.