[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading an ELF executable

From: Rogelio M. Serrano Jr.
Subject: Re: Loading an ELF executable
Date: Wed, 31 Oct 2001 10:02:23 +0800 (PHT)

On Tue, 30 Oct 2001, Robert K. wrote:

> Hi!
> I'd like to write a standalone program for some reason.
> So I compiled a test program that pokes around in the VGA-text memory. I
> used the gnu c++ compiler that is included with Redhat 7.1 and compiled
> like this:
> gcc -nostdlib -e main -o test test.cxx
> If I try GRUB to load it, GRUB tells me, that it can't recognize the
> format.
> I thought GRUB is capable of ELF?
> So, how do I have to compile a program in order to comply?

Its not as simple as that. You need to define a multiboot header in the
executable within the first 8 k of the image. take a look at the example
programs in the multiboot info pages. You might also need to include all
the libraries needed to run the program. by using the -static switch but
you have to watch out for bloat if you use the standard libraries. You
need noni-standard c++ runtime support for that which is not
available yet. Perhaps you can help me finish the one im building :-)
You are using c++ right? 

you might try:
    gcc -nostdlib -static -Ttext 100000 -e main -o test test.cxx 

but i doubt it will run.

> _______________________________________________
> Bug-grub mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-grub

reply via email to

[Prev in Thread] Current Thread [Next in Thread]