All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Grub2 clang MBR image fix
@ 2023-01-13  7:56 Nicholas Vinson
  2023-01-13  7:56 ` [PATCH 1/1] gentpl.py: Remove .interp section from .img files Nicholas Vinson
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Vinson @ 2023-01-13  7:56 UTC (permalink / raw)
  To: grub-devel; +Cc: Nicholas Vinson

When building grub, the files boot.img and diskboot.img are generated from ELF
reference images and have the expectation that they will be 512 bytes inside
each. However, when GRUB is built with clang, these files become bigger than
512-bytes because the name of the ELF interpreter is appended to each image due
to Clang creating a '.interp' section in the ELF reference image.

This patch corrects that issue by updating the objcopy calls so the '.interp'
section is not included when extracting the code from the ELF reference images.

Nicholas Vinson (1):
  gentpl.py: Remove .interp section from .img files.

 gentpl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.39.0



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

* [PATCH 1/1] gentpl.py: Remove .interp section from .img files.
  2023-01-13  7:56 [PATCH 0/1] Grub2 clang MBR image fix Nicholas Vinson
@ 2023-01-13  7:56 ` Nicholas Vinson
  2023-01-13  8:12   ` Vladimir 'phcoder' Serbinenko
  2023-01-17 17:46   ` Daniel Kiper
  0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Vinson @ 2023-01-13  7:56 UTC (permalink / raw)
  To: grub-devel; +Cc: Nicholas Vinson

Whn building .img files, a .interp section from the .image files will
sometimes be copied into the .img file. This additional section pushes
the .img file beyond the 512-byte limit and causes grub-install to fail
to run for i386-pc platforms.

Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
---
 gentpl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gentpl.py b/gentpl.py
index 9f51e4fb6..88abe5b0a 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -766,7 +766,7 @@ def image(defn, platform):
 if test x$(TARGET_APPLE_LINKER) = x1; then \
   $(MACHO2IMG) $< $@; \
 else \
-  $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx $< $@; \
+  $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .note.gnu.property -R .ARM.exidx -R .interp $< $@; \
 fi
 """)
 
-- 
2.39.0



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

* Re: [PATCH 1/1] gentpl.py: Remove .interp section from .img files.
  2023-01-13  7:56 ` [PATCH 1/1] gentpl.py: Remove .interp section from .img files Nicholas Vinson
@ 2023-01-13  8:12   ` Vladimir 'phcoder' Serbinenko
  2023-01-17 17:46   ` Daniel Kiper
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-01-13  8:12 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]

LGTM

On Fri, 13 Jan 2023 at 10:58, Nicholas Vinson <nvinson234@gmail.com> wrote:

> Whn building .img files, a .interp section from the .image files will
> sometimes be copied into the .img file. This additional section pushes
> the .img file beyond the 512-byte limit and causes grub-install to fail
> to run for i386-pc platforms.
>
> Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
> ---
>  gentpl.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gentpl.py b/gentpl.py
> index 9f51e4fb6..88abe5b0a 100644
> --- a/gentpl.py
> +++ b/gentpl.py
> @@ -766,7 +766,7 @@ def image(defn, platform):
>  if test x$(TARGET_APPLE_LINKER) = x1; then \
>    $(MACHO2IMG) $< $@; \
>  else \
> -  $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS)
> --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R
> .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R
> .note.gnu.property -R .ARM.exidx $< $@; \
> +  $(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS)
> --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R
> .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R
> .note.gnu.property -R .ARM.exidx -R .interp $< $@; \
>  fi
>  """)
>
> --
> 2.39.0
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: Type: text/html, Size: 2259 bytes --]

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

* Re: [PATCH 1/1] gentpl.py: Remove .interp section from .img files.
  2023-01-13  7:56 ` [PATCH 1/1] gentpl.py: Remove .interp section from .img files Nicholas Vinson
  2023-01-13  8:12   ` Vladimir 'phcoder' Serbinenko
@ 2023-01-17 17:46   ` Daniel Kiper
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2023-01-17 17:46 UTC (permalink / raw)
  To: Nicholas Vinson; +Cc: grub-devel

On Fri, Jan 13, 2023 at 02:56:35AM -0500, Nicholas Vinson wrote:
> Whn building .img files, a .interp section from the .image files will
> sometimes be copied into the .img file. This additional section pushes
> the .img file beyond the 512-byte limit and causes grub-install to fail
> to run for i386-pc platforms.
>
> Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


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

end of thread, other threads:[~2023-01-17 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-13  7:56 [PATCH 0/1] Grub2 clang MBR image fix Nicholas Vinson
2023-01-13  7:56 ` [PATCH 1/1] gentpl.py: Remove .interp section from .img files Nicholas Vinson
2023-01-13  8:12   ` Vladimir 'phcoder' Serbinenko
2023-01-17 17:46   ` Daniel Kiper

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.