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.
sebihepp
Member
Posts: 195 Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp
Post
by sebihepp » Wed Mar 18, 2009 2:50 pm
Hi,
How can I tell my linker i586-elf-ld to fill the output file to a specified size with zeroes?
There's my linker script:
Code: Select all
ENTRY(start)
INPUT(bootloader.bin boot.bin)
OUTPUT(reserved.bin)
OUTPUT_FORMAT(binary)
MEMORY
{
FLOPPY : ORIGIN = 0x10000, LENGTH = 1474560-512
}
SECTIONS
{
.text :
{
*(.text)
*(.data)
*(.bss)
} >FLOPPY =0x00
}
TIA
Sebihepp
skyking
Member
Posts: 174 Joined: Sun Jan 06, 2008 8:41 am
Post
by skyking » Wed Mar 18, 2009 2:54 pm
My script for the boot sector might help (although I don't pad zeros):
Code: Select all
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(start)
SECTIONS
{
. = 0x000000;
.code : ALIGN(0x200)
{
KEEP(*(.head))
*(.text .text.*)
*(.data .data.*)
__code_end = .;
. = ALIGN(2);
FILL(0x55AA55AA);
. = ALIGN(0x200);
}
.bss : ALIGN(0x200)
{
__bss_beg = .;
KEEP(*(.bss .bss.*))
__bss_end = .;
}
}
sebihepp
Member
Posts: 195 Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp
Post
by sebihepp » Thu Mar 19, 2009 5:21 am
Thanks! Now it works.
Here's my linker script:
Code: Select all
ENTRY(start)
INPUT(bootloader.bin boot.bin)
OUTPUT(reserved.bin)
OUTPUT_FORMAT(binary)
SECTIONS
{
.text :
{
*(.text)
*(.data)
*(.bss)
FILL(0x00);
. = ALIGN(1474560-512);
}
}