Ronald G Minnich <[EMAIL PROTECTED]> writes:

> On 21 May 2002, Eric W. Biederman wrote:
> 
> > No but if you have ld newer that 1.10 you may have problems.
> 
Grr. I meant 2.10....

> GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)
> GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)

> 
> > Loading data a segment at 512K for 1824K bytes looks very suspcious.
> 
> I seems like it had coalesced all the data at 0x80000 up to the end of
> ramdisk (I moved ramdisk to 0x200000 to avoid 8M+ elfImage files) and then
> just loaded that to ram. But it does look strange.

Cool now I finally know what strange behavior is generating 8M+
elfImages.  Using 2M instead of 8M is actively dangerous.  And
uncompressed kernel is easily over 1M is size.

> > If it works the new mkelfImage should be more loader agnostic.
> > In particular it should work just fine under etherboot as well.
> 
> fails under etherboot 5.0.5, with the error
> Me: 10.0.4.22, Server: 10.0.4.1
> Before loading kernel in load
> Loading 10.0.4.1:/tftpboot/kernel (ELF)... segment in reserved area
> Unable to load file.
> 
> Looks like etherboot is unhappy about an elfImage segment overlapping
> 0x94000, just judging by my reading of the source.
> 
> > What does readelf -a say about your image?
> 
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   NOTE           0x001000 0x00080000 0x00080000 0x00208 0x00208 R   0x4
>   LOAD           0x001000 0x00080000 0x00080000 0x1c40f6 0x1c83ae RWE
> 0x1000
> 
>  Section to Segment mapping:
>   Segment Sections...
>    00     .note
>    01     .note .text .rodata .rodata.str1.1 .rodata.str1.32 .data .bss
> .nokill
> .kernel .ramdisk
> 
> 
> Linuxbios seems to agree with readelf about the layout. Interesting.
> 
> Should it really be all merged like this?

No the segments should not be merged.  I explicitly told ld to give me
4 headers.  It might be the strip command that removes junk from the
image, that is merging them. 

In build_elf_image could you try commenting out the lines labeled
below.  ld and I really don't get along very well right now.

sub build_elf_image
{
        my ($params, $dst, @srcs) = @_;
        my $lscript = "mkelfImage.lds";
        my $fd = new FileHandle;
        $fd->open(">$lscript");
        $fd->print("initrd_base = $params->{INITRD_BASE};\n");
        $fd->close();
        my $script = "$params->{PREFIX}/elfImage.lds";
        my $cmd = "$params->{LD} -o ${dst}.fat  -T $script " . join(" ", @srcs);
        system("$cmd");
        die "rc = $?" unless ($? == 0);
#        my $cmd2 = "$params->{OBJCOPY} ${dst}.fat ${dst} -S -R .comment -R .note0"; 
#        if (!$params->{RAMDISK}) {
#                $cmd2 .= " -R .ramdisk";
#        }
#        system("$cmd2");
#        die "rc = $?" unless ($? == 0);
        unlink("${dst}.obj",$lscript);
        unlink("${dst}.fat",$lscript);
        return $dst;
}

Eric



Reply via email to