Hi everyone, I am new in this forum, and i have a question:
I want to write a boot loader, for testing propose, only for display text whit the bios interrupt 0x10, but i don't get it whit GAS&LD, there is a way to do that?
It's posible to compile 16-bit real mode code whit GAS&LD?, i found the .code16 directive, but doesn't work, there is options for ld?...
I am new to os-programming...
Thanks.
Saludos.
boot loader whit gcc?
Re: boot loader whit gcc?
You're better off forgetting about realmode, or you'll not learn anything interesting. Do programming under FreeDOS & OpenWatcom C compiler as MZ executables if you want BIOS interrupts, you could even load the program with Alex bootprog if you really want it bootable.
For 32-bit OS-dev in GCC you should take a look at the wiki on how to set up a cross-compiler and read some tutorials on basic kernels and the screen. But remember, real men use assembly.
Haha, even if that's not for you I recommend playing around with bootsectors and second stage loaders a bit before committing to GRUB or anything else, you'll learn valuable stuff.
For 32-bit OS-dev in GCC you should take a look at the wiki on how to set up a cross-compiler and read some tutorials on basic kernels and the screen. But remember, real men use assembly.
Haha, even if that's not for you I recommend playing around with bootsectors and second stage loaders a bit before committing to GRUB or anything else, you'll learn valuable stuff.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: boot loader whit gcc?
The file generated by the assembler is in whatever object format the toolchain is targeting, ELF, PE.. etc.
You can convert it to a headerless binary with objcopy, or alternatively you'll want to use a linker script with ld.
You can convert it to a headerless binary with objcopy, or alternatively you'll want to use a linker script with ld.
Re: boot loader whit gcc?
Oh, great info!... reading.... thanksbubach wrote:You're better off forgetting about realmode, or you'll not learn anything interesting. Do programming under FreeDOS & OpenWatcom C compiler as MZ executables if you want BIOS interrupts, you could even load the program with Alex bootprog if you really want it bootable.
For 32-bit OS-dev in GCC you should take a look at the wiki on how to set up a cross-compiler and read some tutorials on basic kernels and the screen. But remember, real men use assembly.
Haha, even if that's not for you I recommend playing around with bootsectors and second stage loaders a bit before committing to GRUB or anything else, you'll learn valuable stuff.
I will try whit [objdump -O binary...], thanks....Brynet-Inc wrote:The file generated by the assembler is in whatever object format the toolchain is targeting, ELF, PE.. etc.
You can convert it to a headerless binary with objcopy, or alternatively you'll want to use a linker script with ld.
Re: Boot loader with gcc?
Hi,
Regards,
Shikhin
You seem to misspell it everywhere. It's with, and not whit.GABOSNAKE wrote:I will try whit [objdump -O binary...], thanks....
Regards,
Shikhin
Re: Boot loader with gcc?
thank's for the adviceShikhin wrote:Hi,
You seem to misspell it everywhere. It's with, and not whit.GABOSNAKE wrote:I will try whit [objdump -O binary...], thanks....
Regards,
Shikhin
And... I found the way to assembly the bootloader using as&ld
We need to add at top of the source
Code: Select all
.code16
Code: Select all
ld -Ttext 0x7c00 --oformat binary -o $@ $<
At this point we have a flat binary, so the next part is format the bootloader:
512 bytes & and at offset 0x1FE the word 0xAA55
And it work's...
Last edited by GABOSNAKE on Tue Feb 14, 2012 1:08 am, edited 1 time in total.