Coding General Bootloader & Make File for Windows

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Coding General Bootloader & Make File for Windows

Post by onlyonemac »

thehardcoreOS wrote:I don't like Linux because GRUB overwrites MBR and then I need to use GRUB to boot Windows. Also if I don't use my keyboard and select Windows, Linux boots. Linux is not really fun to install since you need to create 3 partitions for it... I will consider installing Ubuntu if that will make any difference, but then I need to find a way to recover MBR.
  • Back up your MBR before installing Linux, or use GRUB4DOS which can be chainloaded by the Windows MBR
  • Set Windows as your default bootloader entry
  • Use a swapfile inside your main Linux partition, that means you only need to create 1 extra partition not 2 extra partitions, or find a distro that you can install inside your Windows partition
Problem solves. Or you can set up a persistent Linux flash drive, which is probably all that you need for OSdev.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Coding General Bootloader & Make File for Windows

Post by Combuster »

Installing Linux is the fanboy's answer, it's not necessary. Your real error is mixing 101 concepts you don't understand and then insist using them all together at the same time. Learn to split up your problem.

There are the Babysteps you can work from. Bootloaders are sufficiently challenging that you do not want to use C for a loooong time. At least until your bootloader itself is actually capable of loading a binary from disk. If you decide not to write your own bootloader and use GRUB after all, there's also tutorials in the wiki for that.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Coding General Bootloader & Make File for Windows

Post by iansjack »

Combuster wrote:Installing Linux is the fanboy's answer, it's not necessary.
That's a ridiculous statement (the first part of it).

Suggesting the use of Linux is purely pragmatic. It's not necessary, it's just easier. There is undeniably more information available about setting up and using the necessary tools for OS development under Linux than under Windows. The most satisfactory way of using Windows for this purpose is to install some pretend Linux - i.e. CygWin - on top of it. It's easier just to cut out the middle man and use the tools directly.
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Coding General Bootloader & Make File for Windows

Post by Roman »

thehardcoreOS wrote:I don't like Linux because GRUB overwrites MBR and then I need to use GRUB to boot Windows.
That's optional, you can employ a VBR install. As far as I know, Windows' boot manager should be able to chainload it then.
thehardcoreOS wrote:Also if I don't use my keyboard and select Windows, Linux boots.
GRUB can be set up to boot Windows by default or even not to boot anything automatically at all.
thehardcoreOS wrote:Linux is not really fun to install since you need to create 3 partitions for it...
That's completely false. You can lay out the partitions in any way, including a single partition setup.

To be honest, I want to advise you to learn to search the web – that's a very important skill for a programmer.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: Coding General Bootloader & Make File for Windows

Post by Roman »

Talking about Windows, I should note that there is the Windows subsystem for Linux (WSL) which is basically an Ubuntu rootfs executed by the Windows NT kernel.

OS X (aka macOS recently) appears to be pretty much suitable for OS development too. The default clang toolchain that comes with Xcode is able to target *-none-elf targets, it just needs to be augmented with binutils (that can be easily built from source).
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: Coding General Bootloader & Make File for Windows

Post by Octacone »

Guys please stop arguing and hello from Linux Ubuntu. Now I need to set up my GCC and Binutils aka long and painful process.
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Post Reply