http://www.osdever.net/bkerndev/index.php
It works perfectly before I compile the source that prints on screen.
When I try to link scrn.c file on "printing onscreen" step, the string "Hello, world" exists at the beginning of "aout" binary file.
The hexdump which doesn't have a string "Hello, world!" shows as follows:
Code: Select all
0000000 00bc 1030 e900 0022 0000 9090 b002 1bad
0000010 0003 0001 4ffb e451 000c 0010 0000 0010
0000020 1000 0010 3000 0010 0000 0010 03e8 0000
0000030 9000 9090 8955 83e5 08ec e483 83f0 10ec
0000040 feeb 0000 c3c3 c3c3 548b 0424 0fec c0b6
0000050 8bc3 2454 0f04 44b6 0824 c3ee 0000 0000
0000060 0000 0000 0000 0000 0000 0000 0000 0000
*
0001000
However, If I link everything as described in tutorial, "Hello, world!" comes at the beginning as follows:
Code: Select all
0000000 6548 6c6c 2c6f 7720 726f 646c 000a 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
*
0100000 00bc 1040 e900 0022 0000 9090 b002 1bad
0100010 0003 0001 4ffb e451 000c 0010 0000 0010
0100020 1004 0010 400c 0010 0000 0010 4de8 0000
The file GRUB recognize is described when using "file" utility:
kernel.bin: data
However, the latter one looks like ASCII format file.
Code: Select all
kernel.bin: ASCII text
lastly, I post my linker script file that tutorial gave me.
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys)
{
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
I hope to get a good answer soon.