OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 30, 2017 4:46 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: How do I get started with OS development?
PostPosted: Thu Feb 16, 2017 2:16 pm 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Thu Feb 16, 2017 8:37 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 927
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.

_________________
Project: OZone
Source: CodePlex / GitHub
Current Task: CPU Emulation

"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Fri Feb 17, 2017 10:05 am 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Fri Feb 17, 2017 10:26 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 31, 2016 9:53 pm
Posts: 81
Location: San Diego, CA
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.

_________________
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 10:00 am 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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?


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 11:14 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2665
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 11:19 am 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 11:23 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 31, 2016 9:53 pm
Posts: 81
Location: San Diego, CA
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.

_________________
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 11:32 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2665
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 11:36 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2665
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 11:45 am 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 12:03 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2665
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sat Feb 18, 2017 12:23 pm 
Offline

Joined: Mon Aug 29, 2016 12:33 pm
Posts: 7
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sun Feb 19, 2017 7:06 am 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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.


Top
 Profile  
 
 Post subject: Re: How do I get started with OS development?
PostPosted: Sun Feb 19, 2017 7:10 am 
Offline

Joined: Thu Feb 16, 2017 2:10 pm
Posts: 9
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: akasei, Bing [Bot], Yahoo [Bot] and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group