Modify

Opened 5 years ago

Closed 4 years ago

Last modified 2 years ago

#10444 closed defect (fixed)

grub: Error 6: Mismatched or corrupt version of stage1/stage2, Target: i386_gcc-4.6.1_glibc-2.13

Reported by: rossb@… Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

Target: i386_gcc-4.6.1_glibc-2.13

make menuconfig. select binutils (2.20.1
2.21 2.21.1 )

after selecting each binutils version:

make toolchain/binutils/clean
make toolchain/binutils/compile V=99
make toolchain/grub/clean
make toolchain/grub/install V=99
make

Results (make target/linux install):
Running "install /boot/grub/stage1 (hd0) (hd0)1+21 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... failed
Error 6: Mismatched or corrupt version of stage1/stage2

Now, repeat above with binutils 2.19.1
Results (make target/linux install):

Running "install /boot/grub/stage1 (hd0) (hd0)1+21 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded

Done.

This may be due to the combo: i386_gcc-4.6.1_glibc-2.13, which is non-standard.

Can provode ssh credentials if anyone wants to debug this.

Attachments (1)

0001-package-grub-fix-stage2-link-with-recent-binutils.patch (3.7 KB) - added by lacombar@… 5 years ago.
grub `stage2' ldscripts

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by lacombar@…

I confirm that downgrading binutils from 2.21.1 to 2.19.1 fixes the issue with the current trunk.

my config is using vanilla gcc 4.6.1 and uClibc 0.9.32.

comment:2 Changed 5 years ago by lacombar@…

ok, the `stage2' binary produced by binutils 2.21.1 is corrupt. It is chocking on the following check:

`grub-0.97/stage2/builtins.c':2414:

/* Sanity check. */
if (*(stage2_buffer + STAGE2_STAGE2_ID) != STAGE2_ID_STAGE2)

{

errnum = ERR_BAD_VERSION;
goto fail;

}

It expects 0', but gets 0x44'.

If I replaces the stage2' binary produced by binutils 2.21.1, by the stage2' binary produced by binutils 2.19.1, then everything works fine again...

comment:3 Changed 5 years ago by lacombar@…

the `pre_stage2' is not correct. The good binary starts with:

00000000 EA 70 82 00 00 00 03 02 FF FF FF 00 00 00 00 00 00 00

whereas the bad one starts with:

00000000 55 57 56 53 81 EC 3C 20 00 00 A1 14 E0 06 00 89 44 24

if you have a closer look, the right data are present in the bad binary, but at a non-zero offset:

00000160 EA 70 82 00 00 00 03 02 FF FF FF 00 00 00 00 00 00 00

Actually, the 0x160 bytes appearing before are valid code:

Disassembly of section .text of the bad binary:

00008200 <journal_init>:

8200: 55 push %ebp
8201: 57 push %edi
8202: 56 push %esi
8203: 53 push %ebx
8204: 81 ec 3c 20 00 00 sub $0x203c,%esp
820a: a1 14 e0 06 00 mov 0x6e014,%eax
820f: 89 44 24 1c mov %eax,0x1c(%esp)
8213: 8d 8c 24 24 20 00 00 lea 0x2024(%esp),%ecx
821a: ba 0c 00 00 00 mov $0xc,%edx
821f: e8 fc e7 00 00 call 16a20 <journal_read>

[...]

00008360 <_start>:

8360: ea 70 82 00 00 00 03 ljmp $0x300,$0x8270
8367: 02 ff add %bh,%bh

00008368 <install_partition>:

8368: ff (bad)
8369: ff (bad)
836a: ff 00 incl (%eax)

0000836c <saved_entryno>:

836c: 00 00 add %al,(%eax)

...

00008370 <stage2_id>:

...

00008371 <force_lba>:

...

Disassembly of section .text of the good binary:

00008200 <_start>:

8200: ea 70 82 00 00 00 03 ljmp $0x300,$0x8270
8207: 02 ff add %bh,%bh

00008208 <install_partition>:

8208: ff (bad)
8209: ff (bad)
820a: ff 00 incl (%eax)

0000820c <saved_entryno>:

820c: 00 00 add %al,(%eax)

...

00008210 <stage2_id>:

...

00008211 <force_lba>:

...

Q.E.D.

Changed 5 years ago by lacombar@…

grub `stage2' ldscripts

comment:4 Changed 5 years ago by rossb@…

Can confirm with my config: Target: i386_gcc-4.6.1_glibc-2.13, binutils-2.21.1,
the patch by lacombar@ fixes the issue. THANKS...

Running "install /boot/grub/stage1 (hd0) (hd0)1+21 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded

comment:5 Changed 4 years ago by nbd

  • Resolution set to fixed
  • Status changed from new to closed

committed in r30484, thanks

comment:6 Changed 2 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.