OSDev.org
https://forum.osdev.org/

How do I get started with OS development?
https://forum.osdev.org/viewtopic.php?f=1&t=31372
Page 1 of 2

Author:  joegantic [ Thu Feb 16, 2017 2:16 pm ]
Post subject:  How do I get started with OS development?

Hello.

It's joegantic and I want to get started with OS development. I know x86 Assembly. However, I want to go about making a shell for my OS and learning about things like how to make a shell by comparing strings, manipulating the BIOS (setting and getting time for example), filesystem and drivers.

I would like some help in getting in the right direction.

Cheers
Joe.

Author:  SpyderTL [ Thu Feb 16, 2017 8:37 pm ]
Post subject:  Re: How do I get started with OS development?

Well, you're in luck. You've found the best site on the internet.

Click on the "The OSDev.org Wiki" link at the top of the page, and read all of the pages under the "Basic Information" section. You'll find virtually everything you'll need on the wiki, but let us know if you have any questions. Be sure to let us know what decisions you've made about what tools you are going to use and what features you want your OS to have.

The only suggestion I would give at this point is to set yourself very small, very reasonable goals, like showing text on the screen, or reading key press events from the keyboard, and build on that over time.

Good luck, and let us know how we can help.

Author:  joegantic [ Fri Feb 17, 2017 10:05 am ]
Post subject:  Re: How do I get started with OS development?

I know some Assembly. However, what would be out there for learning more on how to do things? I mean like the interrupts are good but what about instructions, offsets and hardware? All they talk about is 1+2+3 is 123 and 4+5+6 is 456 in Assembly and not this and that. 1, 2 and 3 is 6.

How would I get knowledge for making a shell for my operating system?

I'm not planning on a Windows clone that has Java and Minecraft. That's just stupid.

Tutorials for x86 Assembly are horrible to learn from.

Author:  crunch [ Fri Feb 17, 2017 10:26 am ]
Post subject:  Re: How do I get started with OS development?

joegantic wrote:
I know some Assembly. However, what would be out there for learning more on how to do things? I mean like the interrupts are good but what about instructions, offsets and hardware? All they talk about is 1+2+3 is 123 and 4+5+6 is 456 in Assembly and not this and that. 1, 2 and 3 is 6.

How would I get knowledge for making a shell for my operating system?

I'm not planning on a Windows clone that has Java and Minecraft. That's just stupid.


There are tutorials on assembly out there I suppose - I never used them myself. It's useful to first have an understanding of computer architecture (what are registers? how is memory laid out? etc), and then just look over some assembly code or disassemble C programs. The intel manuals cover the architecture of the x86 platform

If you just want to make a shell, why not do it in your host (windows, linux, etc) OS first? A true userland shell will take quite some time to achieve.

Author:  joegantic [ Sat Feb 18, 2017 10:00 am ]
Post subject:  Re: How do I get started with OS development?

I will never get anywhere with x86 Assembly. All I'll get is a bunch of guides explaining how a CPU works. We want to know about registers, interrupts, memory addresses, functions, ASCII stuff, instructions etc. We don't want to know that 1 + 1 is 2 or 2 + 2 is 4.

The idea of a tutorial is to stop frustration and let you learn. Is there an Assembly tutorial that actually teach you about programming? The Intel manuals I found on the web are so useless. The Art of Assembly just teaches you about 100 + 100 is 100000 in Assembly and a bunch of blah blah blah. Please don't say reading about fruit is going to help you. How did you guys actually learn? Don't say we all learn from these kinda things because if you actually read them, you would probably be sleeping.

What Assembly tutorial out there has something useful?

Is there something that has examples of code?

Like for example:
mov ah, 100
mov al, ah
mov bl, al
add bl, 250

That's just a example.

Imagine a perfect tutorial when it teaches you actually about things you will use. Since I don't need to know about 500 + 500 or know that a computer has DIMM as a location for RAM to print a string for my OS.

crunch wrote:
joegantic wrote:
I know some Assembly. However, what would be out there for learning more on how to do things? I mean like the interrupts are good but what about instructions, offsets and hardware? All they talk about is 1+2+3 is 123 and 4+5+6 is 456 in Assembly and not this and that. 1, 2 and 3 is 6.

How would I get knowledge for making a shell for my operating system?

I'm not planning on a Windows clone that has Java and Minecraft. That's just stupid.


There are tutorials on assembly out there I suppose - I never used them myself. It's useful to first have an understanding of computer architecture (what are registers? how is memory laid out? etc), and then just look over some assembly code or disassemble C programs. The intel manuals cover the architecture of the x86 platform

If you just want to make a shell, why not do it in your host (windows, linux, etc) OS first? A true userland shell will take quite some time to achieve.


How did you learn then? It would be fabulous to know what tutorial someone is actually learning from. A shell for my OS? I could make that with bat files. What kind of shell are you talking about?

Author:  iansjack [ Sat Feb 18, 2017 11:14 am ]
Post subject:  Re: How do I get started with OS development?

I learnt by experimenting. As long as you understand the basics of computer architecture, the manuals should be enough to tell you what each instruction does. Two great aids to learning, IMO, are:

1. Single-stepping code in a debugger, inspecting what each instruction does to registers and memory.

2. Looking at the assembler code produced when compiling simple C programs.

But the truth is that you need very little assembler code to write an OS - the less the better. Concentrate on improving your C skills.

Author:  joegantic [ Sat Feb 18, 2017 11:19 am ]
Post subject:  Re: How do I get started with OS development?

I know some C but I don't want to use it for operating system development. I do know some x86 Assembly. If you look at the assembler code of C programs, then that isn't really learning. You just experimented until you found out how to print something with 32-bit and entering 64-bit? You just experimented until you found out what a word (not in Assembly but in real life) means? I'll try experimenting then.

Author:  crunch [ Sat Feb 18, 2017 11:23 am ]
Post subject:  Re: How do I get started with OS development?

Google "x86 assembly tutorial". UVA has a decent one. I personally prefer x86_64, and if youre using a 64 bit PC then I would recommend skipping straight to that. The ABI is easier to use, and you have more registers. A quick Google search turned up several good tutorials.

This is a fantastic resource on what each instruction does, taken from Intel manuals.

Here's some code I wrote when I was switching to 64 bit from 32 if you want some example code to look at.

Author:  iansjack [ Sat Feb 18, 2017 11:32 am ]
Post subject:  Re: How do I get started with OS development?

joegantic wrote:
I know some C but I don't want to use it for operating system development. I do know some x86 Assembly. If you look at the assembler code of C programs, then that isn't really learning. You just experimented until you found out how to print something with 32-bit and entering 64-bit? You just experimented until you found out what a word (not in Assembly but in real life) means? I'll try experimenting then.

Why wouldn't you want to use C? It was designed to write operating systems.

Looking at the code produced by an assembler is studying an example of how experienced programmers use assembler. Studying the code of good programmers is a great way of learning. (So is studying the code of bad programmers, as long as you can see why it's bad.)

Yes, I found out how to print something by eperimenting (once I had read how text mode works on a PC). And yes, in real life I find out what words mean by studying them in context, seeing how people use them, etc. I don't read the dictionary for pleasure.

If you want to get into OS development you are going to have to learn to glean information from reference sources rather than looking for tutorials on every little detail.

Author:  iansjack [ Sat Feb 18, 2017 11:36 am ]
Post subject:  Re: How do I get started with OS development?

crunch wrote:
if youre using a 64 bit PC then I would recommend skipping straight to that.
I'm a great fan of x64 assembler, but it does have certain difficulties for a complete novice, particularly in an OS context. I'm thinking mainly about paging. It's much easier to start with protected mode and then work up to long mode.

Author:  joegantic [ Sat Feb 18, 2017 11:45 am ]
Post subject:  Re: How do I get started with OS development?

Some people want to make their OS fully in Assembly. That's what FASM is for. C is a programming language. It is designed for many things, not just for OS development. I discourage people who use GRUB and linkers. I encourage people to write their own bootloader and kernel.

Author:  iansjack [ Sat Feb 18, 2017 12:03 pm ]
Post subject:  Re: How do I get started with OS development?

With all due respect, if you are just starting in OS development you are not in a position to sensibly encourage people to write their own bootloader, or to encourage/discourage them in any other respect.

You appear to be making some classic beginner's mistakes, but I wish you the best of luck with your project.

Author:  Lowl3v3l [ Sat Feb 18, 2017 12:23 pm ]
Post subject:  Re: How do I get started with OS development?

Okay so i'll start with the simple things i suppose.

First : fasm has a "linker" as well, you need to link programs to get to a real executable and fasm is doing that internally ;)
"write your own bootloader first" to learn about osdev is like suggesting "you should really start by building a better machine to melt steel" if somebody asks how to tune their car, practically useless. Especially for assembly, the differences between realmode 16 bit asembly and protected modes in 32 or 64 bit ( talking about x86 here) is way to big to learn anything really useful from it.

on the tutorial question : actually i found the art of assembly to be a pretty good book, it teaches you everything you need to know ( and you severely seem to lack basics here so you could really use it). Another one i like is Assembly Language for x86 Processors by Kip R. Irvine. And of course the absolutely unbeaten tutorials ( and his library!) from agner fog.
To generally learn thinking in asm i found The Art of Computer Programming extremely helpful( okay and it might be the best book series on computer science ever written or even conceived)
although it doesn't use x86 but a imaginary CPU called MMIX.

If you really have problems to implement even basic algorithms in assembly you should not even be thinking about using it for osdev ( or doing osdev at all for that matter), a common mistake people do especially with assembly is "oh i memorized all the instructions, now i know assembly". You don't.
Generally a good way to learn is reimplementing things like c library functions ( e.g. the string functions), those are comparatively small and simple so you should be able to just write down most of them.

Author:  joegantic [ Sun Feb 19, 2017 7:06 am ]
Post subject:  Re: How do I get started with OS development?

I encourage people who write a bootloader and kernel that doesn't need their software they marry which is GRUB.
This is what I like to see:

Non-GRUB and written in C or C++ operating system means:
No multiboot flag bootloader relying on the linker so it can call the kernel.

Something like:
BITS 16
org 0x7C00

mov ax, 100
mov bx, 200
mov cx, 300
mov dx, 400

mov ax, [thisisjustexample]

Learn to write code.

GRUB operating system that requires C and C++ means:

BITS 16
MULTIBOOT < 1000 0000 0 00000 0 0 0 0 0 0 0 0 0111 11 1 1 1

section .start
call KERNEL_MAIN

---

void dothis()
{
do that;
}

I encourage people to write their bootloader and kernel in Assembly. You're supposed to read the kernel, not link it. IBM would have never done that.

Don't try to copy Linux. Don't use GRUB unless you're gonna dual boot. Make your own MBR or bootloader blah blah blah.

Author:  joegantic [ Sun Feb 19, 2017 7:10 am ]
Post subject:  Re: How do I get started with OS development?

iansjack wrote:
With all due respect, if you are just starting in OS development you are not in a position to sensibly encourage people to write their own bootloader, or to encourage/discourage them in any other respect.

You appear to be making some classic beginner's mistakes, but I wish you the best of luck with your project.


joegantic wrote:
I know some Assembly. However, what would be out there for learning more on how to do things? I mean like the interrupts are good but what about instructions, offsets and hardware? All they talk about is 1+2+3 is 123 and 4+5+6 is 456 in Assembly and not this and that. 1, 2 and 3 is 6.

How would I get knowledge for making a shell for my operating system?

I'm not planning on a Windows clone that has Java and Minecraft. That's just stupid.

Tutorials for x86 Assembly are horrible to learn from.


Windows clone? Java and Minecraft?

Can't you read the words I'm not planning, sir? Can't you read the words?

Page 1 of 2 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/