Grub2 clang MBR image fix
cover Grub2 clang MBR image fix
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(-)
Signature · 1 line
2.39.0
PATCH 1/1 gentpl.py: Remove .interp section from .img files.
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.
--- gentpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
gentpl.py +1 -1
@@ -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 """)
Signature · 1 line
2.39.0
Re: [PATCH 1/1] gentpl.py: Remove .interp section from .img files.
LGTM
Quoted 38 lines · 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 <[email protected]>--- gentpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)gentpl.py +0
-2@@ -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
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Regards Vladimir 'phcoder' Serbinenko
Re: [PATCH 1/1] gentpl.py: Remove .interp section from .img files.
In reply to Nicholas VinsonQuoted 6 lines · 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 <[email protected]>
Daniel