I'm trying to get my first C kernel working, and after trying half a dozen linker scripts that I found in online tutorials I still get a strange kernel flat binary. Then I found this older thread http://forum.osdev.org/viewtopic.php?f= ... 2&start=15 and apparently the command
Code: Select all
ld -T link.ld -o kernel.bin prekernel.o kernel.o
Code: Select all
// hexdump of kernel.bin
00000000 e8 03 00 00 00 f4 90 90 83 ec 0c e8 14 00 00 00 |................|
00000010 83 ec 08 6a 00 68 00 10 10 00 e8 21 00 00 00 83 |...j.h.....!....|
00000020 c4 10 eb fe ba 00 80 0b 00 b8 00 00 00 00 c6 04 |................|
00000030 02 20 40 c6 04 02 0a 40 3d 9f 0f 00 00 76 ef c3 |. @....@=....v..|
00000040 56 53 8b 4c 24 0c 8b 5c 24 10 be 00 80 0b 00 8d |VS.L$..\$.......|
00000050 04 9b 89 c2 c1 e2 05 80 39 00 74 23 89 d3 80 39 |........9.t#...9|
00000060 0a 75 0b 81 c3 a0 00 00 00 89 da 41 eb 0c 8a 01 |.u.........A....|
00000070 88 04 16 41 42 c6 04 16 0a 42 80 39 00 75 df 5b |...AB....B.9.u.[|
00000080 5e c3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |^...............|
00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001000 58 49 58 20 53 79 73 74 65 6d 20 31 39 20 2d 20 |XIX System 19 - |
00001010 56 65 72 73 69 6f 6e 20 70 72 65 2d 41 6c 70 68 |Version pre-Alph|
00001020 61 00 |a.|
00001022
Code: Select all
// hexdump of kernel.bin
00000000 58 49 58 20 53 79 73 74 65 6d 20 31 39 20 2d 20 |XIX System 19 - |
00000010 56 65 72 73 69 6f 6e 20 70 72 65 2d 41 6c 70 68 |Version pre-Alph|
00000020 61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |a...............|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00100000 e8 62 00 00 00 f4 90 90 b8 00 00 00 00 c6 80 00 |.b..............|
00100010 80 0b 00 20 c6 80 01 80 0b 00 0a 83 c0 02 3d a0 |... ..........=.|
00100020 0f 00 00 75 e8 f3 c3 53 8b 5c 24 0c 8d 14 9b c1 |...u...S.\$.....|
00100030 e2 05 8b 4c 24 08 83 c1 01 eb 22 3c 0a 75 0b 83 |...L$....."<.u..|
00100040 c3 01 8d 14 9b c1 e2 05 eb 10 88 82 00 80 0b 00 |................|
00100050 c6 82 01 80 0b 00 0a 83 c2 02 83 c1 01 0f b6 41 |...............A|
00100060 ff 84 c0 75 d6 5b c3 83 ec 08 e8 99 ff ff ff c7 |...u.[..........|
00100070 44 24 04 00 00 00 00 c7 04 24 00 00 00 00 e8 a4 |D$.......$......|
00100080 ff ff ff eb fe 00 00 00 00 00 00 00 00 00 00 00 |................|
00100090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00101000
And I am using GCC 4.4.3 and ld 2.20.1I'm using "GCC 3.4.6" and "ld 2.15.92.0.2, 2004-09-27".
I tried to install the versions mentioned but perhaps because they are somewhat old, I couldn't, and besides that would be an inelegant solution.
Any help or pointers would be greatly appreciated.
Felipe R.