All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
@ 2013-11-20 22:33 Thierry Bultel
  2013-11-21  8:13 ` Thomas Petazzoni
  2014-04-20 10:16 ` Thomas Petazzoni
  0 siblings, 2 replies; 7+ messages in thread
From: Thierry Bultel @ 2013-11-20 22:33 UTC (permalink / raw)
  To: buildroot

When building stage2 with binutils >= 2.19.1, grub says it is corrupted
I have not tried to downgrade binutils to that version, since buildroot
offers 2.20.1 as oldest. The issue was reproduced with 2.23.2.

The following patch is clearly not mine.
I have found it at that location https://dev.openwrt.org/ticket/10444
where the issue is described, and the patch offered.

Successfully tested with an iso image in kvm, that else would hang on 
"Loading stage2 ..."

Signed-off-by: Thierry Bultel <thierry.bultel@wanadoo.fr>
---
 boot/grub/grub.500-add-stage2-ldscripts.patch |   58 +++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)
 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..e940daf
--- /dev/null
+++ b/boot/grub/grub.500-add-stage2-ldscripts.patch
@@ -0,0 +1,58 @@
+diff -Nru grub-0.97.orig/stage2/Makefile.am grub-0.97/stage2/Makefile.am
+--- grub-0.97.orig/stage2/Makefile.am	2013-11-20 23:06:38.770592458 +0100
++++ grub-0.97/stage2/Makefile.am	2013-11-20 23:14:15.296535523 +0100
+@@ -55,7 +55,7 @@
+ 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 -Nru grub-0.97.orig/stage2/Makefile.in grub-0.97/stage2/Makefile.in
+--- grub-0.97.orig/stage2/Makefile.in	2013-11-20 23:06:38.770592458 +0100
++++ grub-0.97/stage2/Makefile.in	2013-11-20 23:14:33.279985473 +0100
+@@ -470,7 +470,7 @@
+ @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 -Nru grub-0.97.orig/stage2/stage2.ldscripts grub-0.97/stage2/stage2.ldscripts
+--- grub-0.97.orig/stage2/stage2.ldscripts	1970-01-01 01:00:00.000000000 +0100
++++ grub-0.97/stage2/stage2.ldscripts	2013-11-20 23:14:51.282622012 +0100
+@@ -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.1

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

* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
  2013-11-20 22:33 [Buildroot] [PATCH 1/1] Added stage2 ldscripts Thierry Bultel
@ 2013-11-21  8:13 ` Thomas Petazzoni
  2013-11-21 10:04   ` Thierry Bultel
  2014-04-20 10:16 ` Thomas Petazzoni
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2013-11-21  8:13 UTC (permalink / raw)
  To: buildroot

Dear Thierry Bultel,

On Wed, 20 Nov 2013 23:33:28 +0100, Thierry Bultel wrote:
> When building stage2 with binutils >= 2.19.1, grub says it is corrupted
> I have not tried to downgrade binutils to that version, since buildroot
> offers 2.20.1 as oldest. The issue was reproduced with 2.23.2.
> 
> The following patch is clearly not mine.
> I have found it at that location https://dev.openwrt.org/ticket/10444
> where the issue is described, and the patch offered.
> 
> Successfully tested with an iso image in kvm, that else would hang on 
> "Loading stage2 ..."
> 
> Signed-off-by: Thierry Bultel <thierry.bultel@wanadoo.fr>
> ---
>  boot/grub/grub.500-add-stage2-ldscripts.patch |   58 +++++++++++++++++++++++++
>  1 files changed, 58 insertions(+), 0 deletions(-)
>  create mode 100644 boot/grub/grub.500-add-stage2-ldscripts.patch

This is weird, because I've built and run grub with the CodeSourcery
x86 toolchain, and the Buildroot toolchain (while testing my
http://lists.busybox.net/pipermail/buildroot/2013-November/082351.html
patch series), and it was just working fine.

Note however that
http://lists.busybox.net/pipermail/buildroot/2013-November/082365.html
makes a number of changes in the CFLAGS used to build Grub.

I've just pushed this branch (rebased on top of master) at:

  http://git.free-electrons.com/users/thomas-petazzoni/buildroot/log/?h=x86-stuff

Could you try this branch and see if it fixes the problem for you?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
  2013-11-21  8:13 ` Thomas Petazzoni
@ 2013-11-21 10:04   ` Thierry Bultel
  2013-11-21 10:47     ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Thierry Bultel @ 2013-11-21 10:04 UTC (permalink / raw)
  To: buildroot

Le 21/11/2013 09:13, Thomas Petazzoni a ?crit :
> Dear Thierry Bultel,
>
> On Wed, 20 Nov 2013 23:33:28 +0100, Thierry Bultel wrote:
>> When building stage2 with binutils >= 2.19.1, grub says it is corrupted
>> I have not tried to downgrade binutils to that version, since buildroot
>> offers 2.20.1 as oldest. The issue was reproduced with 2.23.2.
>>
>> The following patch is clearly not mine.
>> I have found it at that location https://dev.openwrt.org/ticket/10444
>> where the issue is described, and the patch offered.
>>
>> Successfully tested with an iso image in kvm, that else would hang on
>> "Loading stage2 ..."
>>
>> Signed-off-by: Thierry Bultel <thierry.bultel@wanadoo.fr>
>> ---
>>   boot/grub/grub.500-add-stage2-ldscripts.patch |   58 +++++++++++++++++++++++++
>>   1 files changed, 58 insertions(+), 0 deletions(-)
>>   create mode 100644 boot/grub/grub.500-add-stage2-ldscripts.patch
>
> This is weird, because I've built and run grub with the CodeSourcery
> x86 toolchain, and the Buildroot toolchain (while testing my
> http://lists.busybox.net/pipermail/buildroot/2013-November/082351.html
> patch series), and it was just working fine.
>

FYI my configuration uses Buildroot toolchain/binutils 2.23.2/gcc-4.7.x

> Note however that
> http://lists.busybox.net/pipermail/buildroot/2013-November/082365.html
> makes a number of changes in the CFLAGS used to build Grub.
>
> I've just pushed this branch (rebased on top of master) at:
>
>    http://git.free-electrons.com/users/thomas-petazzoni/buildroot/log/?h=x86-stuff
>
> Could you try this branch and see if it fixes the problem for you?

I have taken your branch and compiled it. I am testing like this:

sudo kvm -cdrom rootfs.iso9660

which works with upstream + the lscript patch

However, on your branch, the grub menu does not show up, I am only 
getting the grub minimal prompt. For the moment I cannot figure out why.

So that would mean that stage2 is OK but there is another extra issue.

Thierry

>
> Thanks a lot!
>
> Thomas
>

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

* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
  2013-11-21 10:04   ` Thierry Bultel
@ 2013-11-21 10:47     ` Thomas Petazzoni
  2013-11-21 14:47       ` Thierry Bultel
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2013-11-21 10:47 UTC (permalink / raw)
  To: buildroot

Dear Thierry Bultel,

On Thu, 21 Nov 2013 11:04:25 +0100, Thierry Bultel wrote:

> I have taken your branch and compiled it. I am testing like this:
> 
> sudo kvm -cdrom rootfs.iso9660
> 
> which works with upstream + the lscript patch
> 
> However, on your branch, the grub menu does not show up, I am only 
> getting the grub minimal prompt. For the moment I cannot figure out why.
> 
> So that would mean that stage2 is OK but there is another extra issue.

I *believe* this usually means that it can't find the grub
configuration file.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
  2013-11-21 10:47     ` Thomas Petazzoni
@ 2013-11-21 14:47       ` Thierry Bultel
  2013-11-21 15:05         ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Thierry Bultel @ 2013-11-21 14:47 UTC (permalink / raw)
  To: buildroot

Le 21/11/2013 11:47, Thomas Petazzoni a ?crit :
> Dear Thierry Bultel,
>
> On Thu, 21 Nov 2013 11:04:25 +0100, Thierry Bultel wrote:
>
>> I have taken your branch and compiled it. I am testing like this:
>>
>> sudo kvm -cdrom rootfs.iso9660
>>
>> which works with upstream + the lscript patch
>>
>> However, on your branch, the grub menu does not show up, I am only
>> getting the grub minimal prompt. For the moment I cannot figure out why.
>>
>> So that would mean that stage2 is OK but there is another extra issue.
>
> I *believe* this usually means that it can't find the grub
> configuration file.

Yes that's the point. I have attempted to debug:
grub_open fails on /boot/grub/menu.lst

But when I mount my iso image, it is there:

$ ls /mnt/boot/grub/
menu.lst         stage2_eltorito

I finally found out that it is grub does not support the iso9660 filesystem.

I have added it to the list of supported ones and it works.
That is a little bit annoying to have to do it manually.

On your branch it is explicitly deselected when configured, whereas it 
was configured by default on mainstream.

I think it could be could to :
1) Set the supported FS as choices in xconfig
2) Make iso9660 automatically selected when an iso image must be built

Regards
Thierry


>
> Thomas
>

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

* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
  2013-11-21 14:47       ` Thierry Bultel
@ 2013-11-21 15:05         ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2013-11-21 15:05 UTC (permalink / raw)
  To: buildroot

Dear Thierry Bultel,

On Thu, 21 Nov 2013 15:47:25 +0100, Thierry Bultel wrote:

> Yes that's the point. I have attempted to debug:
> grub_open fails on /boot/grub/menu.lst
> 
> But when I mount my iso image, it is there:
> 
> $ ls /mnt/boot/grub/
> menu.lst         stage2_eltorito
> 
> I finally found out that it is grub does not support the iso9660
> filesystem.

Aah!

> I have added it to the list of supported ones and it works.
> That is a little bit annoying to have to do it manually.
> 
> On your branch it is explicitly deselected when configured, whereas
> it was configured by default on mainstream.
> 
> I think it could be could to :
> 1) Set the supported FS as choices in xconfig

Did you realize that such an option exists, and is added by my patch
set ? :-)

See:

  http://git.free-electrons.com/users/thomas-petazzoni/buildroot/commit/?h=x86-stuff&id=b01db75a6d7165005f9fb069c340f4206160c7f5

which adds the BR2_TARGET_GRUB_FS_SUPPORT option. You simply need to
change it from "ext2fs fat" to "ext2fs fat iso9660" and that's it.

Can you confirm that it works for you?

Also, could you share how you build your ISO image with Grub ? I would
be interested in adding these details to the Config.in help text, as I
did to explain how to create a disk image that has grub installed.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] Added stage2 ldscripts
  2013-11-20 22:33 [Buildroot] [PATCH 1/1] Added stage2 ldscripts Thierry Bultel
  2013-11-21  8:13 ` Thomas Petazzoni
@ 2014-04-20 10:16 ` Thomas Petazzoni
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-04-20 10:16 UTC (permalink / raw)
  To: buildroot

Dear Thierry Bultel,

On Wed, 20 Nov 2013 23:33:28 +0100, Thierry Bultel wrote:
> When building stage2 with binutils >= 2.19.1, grub says it is corrupted
> I have not tried to downgrade binutils to that version, since buildroot
> offers 2.20.1 as oldest. The issue was reproduced with 2.23.2.
> 
> The following patch is clearly not mine.
> I have found it at that location https://dev.openwrt.org/ticket/10444
> where the issue is described, and the patch offered.
> 
> Successfully tested with an iso image in kvm, that else would hang on 
> "Loading stage2 ..."
> 
> Signed-off-by: Thierry Bultel <thierry.bultel@wanadoo.fr>
> ---
>  boot/grub/grub.500-add-stage2-ldscripts.patch |   58 +++++++++++++++++++++++++
>  1 files changed, 58 insertions(+), 0 deletions(-)
>  create mode 100644 boot/grub/grub.500-add-stage2-ldscripts.patch

As our discussion has shown, this patch is in fact not necessary. I've
consequently marked it as Rejected in patchwork. Do not hesitate to let
me know if you still have unsolved issues with grub.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2014-04-20 10:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 22:33 [Buildroot] [PATCH 1/1] Added stage2 ldscripts Thierry Bultel
2013-11-21  8:13 ` Thomas Petazzoni
2013-11-21 10:04   ` Thierry Bultel
2013-11-21 10:47     ` Thomas Petazzoni
2013-11-21 14:47       ` Thierry Bultel
2013-11-21 15:05         ` Thomas Petazzoni
2014-04-20 10:16 ` Thomas Petazzoni

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.