How does it work install the system to disk?

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.
Post Reply
Patrick367
Posts: 3
Joined: Tue Jul 27, 2021 6:26 pm

How does it work install the system to disk?

Post by Patrick367 »

Hi, I currently have a ridiculously simple and small operating system, but I was wondering how this idea of ​​loading an operating system onto a disk, HD, SSD works, as mine is currently on the bootable pendrive and when it shuts down, everything is lost.

The bootloader loads my approximately 150b kernel at address 0800h:0000h if I were to load this to disk, would I have to load an exact copy of the same kernel that I load in memory, just on hd? (and all other files)

That's assuming I've already developed a filesystem and drivers to read and write to hd, which isn't the case.

And as would be the mechanics of an installer like Windows, I would have to load in main memory a kind of "installer kernel" that installs the file system on hd (or a partition), and then load the kernel and the whole program . on hd?

but to do that this "installer kernel" would already have to have driver support to detect hd and write to it, and many other things

How does it usually work?

Obs: if there is a typo, understand that I translated on google translator
Octocontrabass
Member
Member
Posts: 5567
Joined: Mon Mar 25, 2013 7:01 pm

Re: How does it work install the system to disk?

Post by Octocontrabass »

The "installer kernel" is the same as the regular kernel. To install the OS, there is a program that copies the bootloader, kernel, and other OS files to the disk.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: How does it work install the system to disk?

Post by Klakap »

How does it work install the system to disk?
Well, it depends on these three questions:
1. Do you want to have on computer only your OS, or you want to do multiboot
2. Is your bootloader GRUB or your own bootloader is loading simple some sectors from disk where is your kernel or your bootloader is loading your kernel from some filesystem
3. Are you installing your OS to legacy or UEFI

Good installer is complex thing. But, for testing you probably do not need anything difficult like it can seem. I personally have my 15 years old computer for testing and I have these answers:
1. I want to have only my OS
2. My bootloader simply read sectors from 1 to end of kernel
3. Legacy boot

So my installer currently works very simply:
1. Write bootloader to sector 0
2. Write kernel from sector 1
3. Everything is done.
Post Reply