Still trying to start

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

jal wrote:
JamesM wrote:2) If you don't want to use GRUB (or a similar compatible multiboot loader) then there's no point in even looking at ELF as all your binaries will have to be in raw format anyway!
I do not see why, as he could write an ELF bootloader himself? Or am I missing something here...


JAL
I agree, my OS uses coff files for the entire thing, kernel, apps, drivers. The kernel is the only one that's not relocateable howerver, but it's still a coff file with symbols for linking my drivers to the kernel. My bootloader jumps to the kernel based on it's location in the a.out header section of the coff file, and allocates space for the .bss. Plenty of people use ELF executeables because they are pretty easy to load/run, elf libraries are a bit more difficult, epsecially for a boot-loader (which is why I limited my kernel to executeable with symbols, since I always know it's location on boot it doesn't have to be relocateable). Anyways, other than that, there were some pretty good links provided for getting started. I use gcc and nasm, and compile from the command line, but use dev-cpp for its IDE (since i run it from my thumb-drive, where i do all my OS dev from so it's portable). I really need to get around to finishing up my format utility so I can replace the boot sector of the thumb drive with my bootloader, since my OS supports fat12/16/32 i can drag/drop files from windows to my OS and back again with ease, and much more space to work than a floppy disk.
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Is there a format I could use that supports external references, supports origin defining and can be easily used as an output form for GCC, NASM and LD?
Thanks in advance,

Jules
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Yes, ELF!
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

When I assemble with NASM in elf format it doesn't allow me to use org
Thanks,
Jules
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

Just define the start address when you link.

Cheers,
Adam
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

How can I do that?
and is it possible to make GCC output 16bit code?
Thanks,
Jules
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Oh good lord please at least *try* things before you reply, and *search* before you ask another question!

I know of at least two recent threads where the answer "Yes, GCC can emit 16 bit code but just so long as you use a flat segmentation model which most 16 bit apps don't". And look at the man pages for ld for your other answer.

ffs! ](*,)
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

suthers wrote:Is there a format I could use that supports external references, supports origin defining and can be easily used as an output form for GCC, NASM and LD?
Thanks in advance,

Jules
What exactly are you trying to do, maybe you are just trying to solve the wrong problem. You also ask about 16-bit code, so i have a feeling this is a bit more in depth than your first question leads us to beleive. Why are you trying to link different parts of your OS to different memory locations? Only a few reason I could see, 1.) switching to paged memory and running the kernel at higher memory (for me, I leave that to the bootloader so the kernel just has a base location), 2.) switching back to real-mode to call interrupts (write it in ASM and put it at a known location, and/or make it position independant, the function is short and allocating 1k below 1mb is pretty simple I would think. I can't really think of any other 'good' reasons. My OS currently supports .coff files, I load them to momory, then do all my relocations, and link ti dynamically in memory. I don't have much code that depends on it's actual location, the kernel is the only thing that knows where it is loaded on bootup, and is an executeable coff file with symbol's still in it so i can link all my drivers to it, which don't care where they are loaded because they are relocateable files and dynamically linked so they don't even care where the kernel resides or need any special call tables, etc. Anyways, please let us know why you need to do this, then we could probably help out a bit easier and see if you need to be doing what you're doing.
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

JamesM wrote: 2) If you don't want to use GRUB (or a similar compatible multiboot loader) then there's no point in even looking at ELF as all your binaries will have to be in raw format anyway!
I'm not using GRUB, or any other ready made loader, but most of my files will be in ELF format.
suthers wrote:I'm not using GRUB, or any other ready made loader, but most of my binaries will in be ELF format.
The Open Watcom linker can turn out binaries for just about every format under the sun (MS-DOS, Windows, OS/2, QNX, Netware, Pharlap, ELF).
Post Reply