[ECOS] Grub "Error 12" when booting Redboot under Qemu

Grant Edwards grant.b.edwards@gmail.com
Tue Mar 22 13:54:00 GMT 2011


I'm attempting to test my rewritten DHCP code for RedBoot using Qemu
(which I've used before for testing both RedBoot and full-up apps).  

It works fine if I leave the verbose output disabled, but when I
enable verbose output (which compiles in about 5 more "diag_printf()"
calls and a couple arrays of strings), Grub then refuses to load the
file.

Without the extra diag_printf() calls, the console looks like this:

      Booting '/redboot-works.elf'

    kernel /redboot-works.elf
       [Multiboot-elf, <0x108000:0x13800:0x107e4>, shtab=0x12c1e0,
    entry=0x108000]

    +
    Requesting IP conf via BOOTP/DHCP...
    [normal RedBoot startup stuff...]

With the extra diag_printf() calls, it looks like this:

      Booting '/redboot-broken.elf'
    
    kernel /redboot-broken.elf
    
    Error 13: Invalid or unsupported executable format
    
    Press any key to continue...

The only difference I can see between the redboot.elf file that works
and the one that doesn't is the size:

    $ file */*redboot*.elf
    grub-14662-tree/redboot-works.elf:  ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
    grub-14687-tree/redboot-broken.elf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
    
    $ ls -l */*redboot*.elf
    -rwxr-xr-x 1 grante users 84540 Mar 21 16:14 grub-14662-tree/redboot-works.elf
    -rwxr-xr-x 1 grante users 89948 Mar 21 16:14 grub-14687-tree/redboot-broken.elf
    
    $ size */*redboot*.elf
       text    data     bss     dec     hex filename
      77466    2400   67556  147422   23fde grub-14662-tree/redboot-works.elf
      82806    2464   70372  155642   25ffa grub-14687-tree/redboot-broken.elf


    i386-elf-objdump -h */*redboot*.elf
    
    grub-14662-tree/redboot-works.elf:     file format elf32-i386
    
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .vectors      00000000  00108000  00108000  00014800  2**0
                      CONTENTS
      1 .text         0000fe26  00108000  00108000  00001000  2**2
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      2 .fini         00000000  00117e28  00117e28  00014800  2**0
                      CONTENTS
      3 .rodata1      00000000  00117e28  00117e28  00014800  2**0
                      CONTENTS
      4 .rodata       00003074  00117e28  00117e28  00010e28  2**5
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      5 .fixup        00000000  0011ae9c  0011ae9c  00014800  2**0
                      CONTENTS
      6 .gcc_except_table 00000000  0011ae9c  0011ae9c  00014800  2**0
                      CONTENTS
      7 .data         00000960  0011aea0  0011aea0  00013ea0  2**5
                      CONTENTS, ALLOC, LOAD, DATA
      8 .sbss         00000000  0011b800  0011b800  00014800  2**0
                      CONTENTS
      9 .bss          000107e4  0011b800  0011b800  00014800  2**5
                      ALLOC
    
    grub-14687-tree/redboot-broken.elf:     file format elf32-i386
    
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .vectors      00000000  00108000  00108000  00015d20  2**0
                      CONTENTS
      1 .text         0001100a  00108000  00108000  00001000  2**2
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      2 .fini         00000000  0011900c  0011900c  00015d20  2**0
                      CONTENTS
      3 .rodata1      00000000  00119010  00119010  00015d20  2**0
                      CONTENTS
      4 .rodata       0000336c  00119010  00119010  00012010  2**5
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      5 .fixup        00000000  0011c37c  0011c37c  00015d20  2**0
                      CONTENTS
      6 .gcc_except_table 00000000  0011c37c  0011c37c  00015d20  2**0
                      CONTENTS
      7 .data         000009a0  0011c380  0011c380  00015380  2**5
                      CONTENTS, ALLOC, LOAD, DATA
      8 .sbss         00000000  0011cd20  0011cd20  00015d20  2**0
                      CONTENTS
      9 .bss          000112e4  0011cd20  0011cd20  00015d20  2**5
                      ALLOC
    
          
The only thing I can see that looks significant is that the .text
segment in the working version is <64KB, and in the non-working
version it's >64KB.

But, I can run other eCos apps that are far bigger than 64KB such as
this one:

    $ ls -l grub-14807-tree/server.elf
    -rwxr-xr-x 1 grante users 318140 Mar 21 16:32 grub-14807-tree/server.elf
    
    $ file grub-14807-tree/server.elf 
    grub-14807-tree/server.elf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
    
    $ size grub-14807-tree/server.elf
       text    data     bss     dec     hex filename
     306992    6472 1279896 1593360  185010 grub-14807-tree/server.elf
     
    $ i386-elf-objdump --headers grub-14807-tree/server.elf
    
    grub-14807-tree/server.elf:     file format elf32-i386
    
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
      0 .vectors      00000000  00108000  00108000  0004d880  2**0
                      CONTENTS
      1 .text         000449f5  00108000  00108000  00001000  2**3
                      CONTENTS, ALLOC, LOAD, READONLY, CODE
      2 .fini         00000000  0014c9f8  0014c9f8  0004d880  2**0
                      CONTENTS
      3 .rodata1      00000000  0014c9f8  0014c9f8  0004d880  2**0
                      CONTENTS
      4 .rodata       0000653b  0014c9f8  0014c9f8  000459f8  2**5
                      CONTENTS, ALLOC, LOAD, READONLY, DATA
      5 .fixup        00000000  00152f34  00152f34  0004d880  2**0
                      CONTENTS
      6 .gcc_except_table 00000000  00152f34  00152f34  0004d880  2**0
                      CONTENTS
      7 .data         00001948  00152f38  00152f38  0004bf38  2**5
                      CONTENTS, ALLOC, LOAD, DATA
      8 .sbss         00000000  00154880  00154880  0004d880  2**0
                      CONTENTS
      9 .bss          00138798  00154880  00154880  0004d880  2**5


I'm stumped.  Any clues?      
  
-- 
Grant Edwards               grant.b.edwards        Yow! Do you think the
                                  at               "Monkees" should get gas on
                              gmail.com            odd or even days?


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list