I'm writing a basic kernel right now. It's written in C++, and is based on the tutorial kernel at http://osdever.net/bkerndev/ , with some minor changes to function names, etc. I've gotten as far as trying to print on the screen, but the linker is messing up. To print something, I'm passing the "Hello, World!" string constant to kernel::screen::write(). Once I link this, though, grub decides to give me an "Unrecognized executable format" error. This is for good reason: when I "less" the compiled kernel, it starts with "Hello, World!" Any idea what's wrong?
I can post linker scripts, compile options, etc. if anyone wants them.
Problems with kernel linking
-
- Posts: 4
- Joined: Thu Dec 14, 2006 9:53 am
No need to do that, actually:
$ od -c -N 13 ceres-kernel.bin
0000000 H e l l o , W o r l d !
0000015
The first 13 bytes of the compiled kernel are actually Hello, World! I'm passing the compiled ASM loader as the first argument to ld, but still that damn string is the first thing in the file...
EDIT: $ mbchk ceres-kernel.bin
ceres-kernel.bin: No Multiboot header.
$ od -c -N 13 ceres-kernel.bin
0000000 H e l l o , W o r l d !
0000015
The first 13 bytes of the compiled kernel are actually Hello, World! I'm passing the compiled ASM loader as the first argument to ld, but still that damn string is the first thing in the file...
EDIT: $ mbchk ceres-kernel.bin
ceres-kernel.bin: No Multiboot header.
- Attachments
-
- link.ld
- My linker script.
- (338 Bytes) Downloaded 35 times
-
- loader.asm
- The loader source.
- (1.82 KiB) Downloaded 39 times