OS Development on Windows




OS Development on Windows

Postby algorithman » 31. May 2017, 09:38

In the videos, I do the development on Linux. I have said numerous times that I don't care about how to do it on windows, but I have been asked so often, that I think we should at least have a forum-discussion on the topic where you can exchange your experiences

https://www.youtube.com/watch?v=6MJUGVFAXKg and https://www.youtube.com/watch?v=YLFRs081pIU might be good starting points.

to my knowledge, nobody has succeeded in transfering the WYOOS code to windows, but here are some pointers to how it should be doable theoretically
  • most of the codes should carry over 1:1 - every WYOOS part that only communicates with other WYOOS parts should be safe
  • that includes drivers, since they communicate with WYOOS port objects.
  • also things that communicate with the processor directly (the things written in assembler) should be safe. I'm thinking of GDT, IDT, interruptstubs and Ports here.

So what doesn't work?
  • Windows Compilers & Linkers have difficulties with ELF being the target format. You might compile a GCC-Cross-Compiler for that. https://www.google.com/search?q=gcc+cro ... er+windows
  • NASM has a wildly different syntax than GASM, in particular, the order of the operands is switched. For example in GASM, MOV X Y copies the content of X into Y, whereas in NASM it copies the content of Y into X.
  • I have no Idea how the Windows boot-loader works and how/if you can hook into it. Maybe you can compile grub-mkrescue on windows - otherwise you probably need to write your own boot-loader. The stuff from the hard-drive and partition-table videos should tell you enough to understand how to do that. In the video I linked above, the guy shows some assembler code of a boot loader, but be warned: most boot loaders only work on very few machines.
  • With your own boot loader, you probably also have to write your own code for creating an .iso image with your boot loader. In the video I linked above, the guy puts his own boot loader on a floppy drive with a ready made tool.

If you write your own boot loader
  • You probably don't need the cross-compiler, since it was GRUB that required the ELF format
  • Also you don't need the magic number
  • Your boot loader will have to find the kernels entry point though (which depends on the output format you choose)
  • From your own boot loader, you don't get the multiboot structure, which told us the RAM size for example
  • You might have the bootloader set the stack pointer, so you might not need the loader.s
User avatar
algorithman
Administrator
 
Posts: 49
Joined: 2. Mar 2017, 11:40

by Advertising » 31. May 2017, 09:38

Advertising
 

Re: OS Development on Windows

Postby rigewo02 » 6. Jun 2017, 09:05

I tried to do it on Windows and succeded.

First, you will have to download the ghost-i686-elf-tools for Windows. This is a cross-compiled version of binutils 2.24 and GCC 4.8.2 for Windows with the target platfom being i686-elf. It includes as and gcc.

The forum thread:
http://forum.osdev.org/viewtopic.php?f=2&t=27746

To be able to compile, you either have to write a .bat file or download MinGW to execute a makefile.
I currently didn't find a way to use grub on Windows, so you currently have to use qemu.
rigewo02
 
Posts: 2
Joined: 6. Jun 2017, 08:48


Return to General Discussion

Who is online

No registered users

cron