From: Jonathan Liu <net147@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] grub: fix stage2 link with recent binutils
Date: Sat, 04 Aug 2012 20:42:46 +1000 [thread overview]
Message-ID: <501CFCA6.9040000@gmail.com> (raw)
In-Reply-To: <1343228609-3209-1-git-send-email-net147@gmail.com>
Any update on getting this merged?
Regards,
Jonathan
On 26/07/2012 1:03 AM, Jonathan Liu wrote:
> Using newer versions of binutils to compile GRUB results in the
> stage2 image being corrupt. This results in the message
> "Error 6: Mismatched or corrupt version of stage1/stage2"
> when installing grub. For example, this could occur if using a
> crosstool-ng glibc toolchain targetting Linux i686.
>
> The problem is mentioned on the Buildroot bug tracker [1] and
> on the OpenWRT bug tracker [2].
>
> [1] https://bugs.busybox.net/show_bug.cgi?id=4327
> [2] https://dev.openwrt.org/ticket/10444
>
> Signed-off-by: Jonathan Liu<net147@gmail.com>
> ---
> boot/grub/grub.500-add-stage2-ldscripts.patch | 77 +++++++++++++++++++++++++++
> 1 file changed, 77 insertions(+)
> create mode 100644 boot/grub/grub.500-add-stage2-ldscripts.patch
>
> diff --git a/boot/grub/grub.500-add-stage2-ldscripts.patch b/boot/grub/grub.500-add-stage2-ldscripts.patch
> new file mode 100644
> index 0000000..aff7ed4
> --- /dev/null
> +++ b/boot/grub/grub.500-add-stage2-ldscripts.patch
> @@ -0,0 +1,77 @@
> +From 8858927ddc6797489cad322fc2d2134aeae543cd Mon Sep 17 00:00:00 2001
> +From: Arnaud Lacombe<lacombar@gmail.com>
> +Date: Sun, 11 Dec 2011 16:44:02 -0500
> +Subject: [PATCH] add-stage2-ldscripts
> +
> +---
> + stage2/Makefile.am | 2 +-
> + stage2/Makefile.in | 2 +-
> + stage2/stage2.ldscripts | 30 ++++++++++++++++++++++++++++++
> + 3 files changed, 32 insertions(+), 2 deletions(-)
> + create mode 100644 stage2/stage2.ldscripts
> +
> +diff --git a/stage2/Makefile.am b/stage2/Makefile.am
> +index f8e6d42..ea28a4d 100644
> +--- a/stage2/Makefile.am
> ++++ b/stage2/Makefile.am
> +@@ -55,7 +55,7 @@ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
> + endif
> + MOSTLYCLEANFILES = $(noinst_PROGRAMS)
> +
> +-PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
> ++PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
> + START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
> + NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
> + PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
> +diff --git a/stage2/Makefile.in b/stage2/Makefile.in
> +index d0062bd..7bee2d5 100644
> +--- a/stage2/Makefile.in
> ++++ b/stage2/Makefile.in
> +@@ -468,7 +468,7 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
> + @DISKLESS_SUPPORT_FALSE at noinst_DATA = pre_stage2 start start_eltorito
> + @DISKLESS_SUPPORT_TRUE at noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
> + MOSTLYCLEANFILES = $(noinst_PROGRAMS)
> +-PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
> ++PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Tstage2.ldscripts
> + START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
> + NBLOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,0
> + PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
> +diff --git a/stage2/stage2.ldscripts b/stage2/stage2.ldscripts
> +new file mode 100644
> +index 0000000..2c8b8e1
> +--- /dev/null
> ++++ b/stage2/stage2.ldscripts
> +@@ -0,0 +1,30 @@
> ++/* Script for -N: mix text and data on same page; don't align data */
> ++OUTPUT_FORMAT("elf32-i386", "elf32-i386",
> ++ "elf32-i386")
> ++OUTPUT_ARCH(i386)
> ++ENTRY(_start)
> ++SECTIONS
> ++{
> ++ . = 0x8200;
> ++ .text :
> ++ {
> ++ _start = .;
> ++ *(.text .text.* )
> ++ }
> ++ .rodata : { *(.rodata .rodata.* ) }
> ++ /* Adjust the address for the data segment. We want to adjust up to
> ++ the same address within the page on the next page up. */
> ++ . = .;
> ++ .data : { *(.data .data.* ) }
> ++ __bss_start = .;
> ++ .bss :
> ++ {
> ++ *(.bss .bss.* )
> ++ *(COMMON)
> ++ . = ALIGN(. != 0 ? 32 / 8 : 1);
> ++ }
> ++ . = ALIGN(32 / 8);
> ++ . = ALIGN(32 / 8);
> ++ _end = .; PROVIDE (end = .);
> ++ .comment 0 : { *(.comment) }
> ++}
> +--
> +1.7.6.153.g78432
> +
next prev parent reply other threads:[~2012-08-04 10:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 15:03 [Buildroot] [PATCH] grub: fix stage2 link with recent binutils Jonathan Liu
2012-08-04 10:42 ` Jonathan Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-07-25 13:59 Jonathan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=501CFCA6.9040000@gmail.com \
--to=net147@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox