Super small 64bit OS

it doesn’t do much, but it does work!.. I saw it mentioned here, and the source archive can be downloaded here.

So I went through the steps of  building a 64bit cross tool to build it.. Although Qemu won’t boot the kernel directly, and it uses GRUB which isn’t so bad but I haven’t made a transparent boot system for it just yet…  Maybe I can use a CD-ROM ISO image…

C:\temp\trunk4>build
C:\temp\trunk4>del *.o kernel.bin kernel.ld
C:\temp\trunk4>x86_64-pc-elf-cpp -Iinclude -P -C -DLINKER_SCRIPT -o kernel.ld kernel.lds
C:\temp\trunk4>x86_64-pc-elf-gcc -Iinclude -Xassembler --divide -c -o startup.o startup.S
C:\temp\trunk4>x86_64-pc-elf-gcc -Wall  -nostdlib -nodefaultlibs -mcmodel=large -Iinclude -c -o kmain.o kmain.c
kmain.c: In function 'kmain':
kmain.c:17: warning: unused variable 'n'
kmain.c:15: warning: unused variable 'str'
C:\temp\trunk4>x86_64-pc-elf-gcc -Wall  -nostdlib -nodefaultlibs -mcmodel=large -Iinclude -c -o idt.o idt.c
C:\temp\trunk4>x86_64-pc-elf-gcc -Iinclude -Xassembler --divide -c -o isr.o isr.S
C:\temp\trunk4>x86_64-pc-elf-gcc -Wall  -nostdlib -nodefaultlibs -mcmodel=large -Iinclude -c -o pic.o pic.c
C:\temp\trunk4>x86_64-pc-elf-gcc -Wall  -nostdlib -nodefaultlibs -mcmodel=large -Iinclude -c -o console.o console.c
C:\temp\trunk4>x86_64-pc-elf-ld -nodefaultlibs -z max-page-size=0x1000 -o kernel.bin -T kernel.ld startup.o kmain.o idt.o isr.o pic.o console.o
C:\temp\trunk4>x86_64-pc-elf-objdump -S kernel.bin  1>kernel.asm

The ‘warnings’ are all my fault… As I wanted a string not the 1,2,3,4…

Grub boot flags

 

And here we are in 64bit long mode!

So for the two or three people who care, my archive is here… I may move crap around, but at the same time building a 64bit cross compiler was a real chore.. More so because that x86_64-elf bare targets didn’t exist until some time around 4.3.2 which… is involved to build.

3 thoughts on “Super small 64bit OS

  1. I’m using Windows XP only.
    I want to start writing my OS in 64-bit mode, but I don’t know what to do…
    I have downloaded and installed GCC from here:
    http://www.delorie.com/djgpp/zip-picker.html

    And I can’t find such a file like x86_64-pc-elf-ld in there.
    There are no files that starts with ‘x86_64…”
    They say I need that to build my kernel
    http://wiki.osdev.org/Creating_a_64-bit_kernel

    Could you help me please?
    Have a nice day!

    • DJGPP is a 32bit compiler for MS-DOS …. for something 64bit you’ll need a 64bit tool chain.. download my attempt at building this guys simple ‘hello’ kernel and see how far you get…

  2. I’m using Windows XP only.
    I want to start writing my OS in 64-bit mode, but I don’t know what to do…
    I have downloaded and installed GCC from here:
    http://www.delorie.com/djgpp/zip-picker.html

    And I can’t find such a file like x86_64-pc-elf-ld in there.
    There are no files that starts with ‘x86_64…”
    They say I need that to build my kernel
    http://wiki.osdev.org/Creating_a_64-bit_kernel

    Could you help me please?
    Have a nice day!

Leave a Reply