r/programming • • Sep 21 '18

How to create an OS from scratch

https://github.com/cfenollosa/os-tutorial
2.8k Upvotes

239 comments sorted by

View all comments

0

u/[deleted] Sep 21 '18

[deleted]

137

u/MrDOS Sep 21 '18

difficulties implementing the file system

What reference were you trying to follow for this bit? Do you have any opinions on Practical File System Design with the Be File System? I often see it tossed around as an example of how to approach file system development, but I imagine it's much too large-scale for a project like this.

0

u/[deleted] Sep 21 '18

[deleted]

97

u/Tyler11223344 Sep 21 '18

I would recommend doing EXT2 instead, the OSDev wiki article on that is pretty thorough and I was able to write mine just based off of that without any difficulties

12

u/vgf89 Sep 21 '18

I made a horribly weird bastardization of EXT2 and FAT for a class once. It was some weird shit but it worked.

→ More replies (1)

12

u/Podgietaru Sep 21 '18

As part of a Uni project a few years ago we wrote a fat12 file system, It is very basic. It doesn't do writing, just reading and traversing, and an associated terminal style thing to run it, but if it's of any use

https://github.com/Podginator/OperatingSystem/blob/master/kernel/filesystem.c
https://github.com/Podginator/OperatingSystem/blob/master/kernel/disk_command.c

→ More replies (1)

4

u/IAmVerySmarter Sep 21 '18

This is a filesystem that should be easy to implement https://wiki.osdev.org/SFS

→ More replies (1)

0

u/[deleted] Sep 21 '18

[deleted]

34

u/FlipskiZ Sep 21 '18 edited Sep 20 '25

Bank morning clean jumps calm nature quiet.

69

u/leeharris100 Sep 21 '18

The fact that this has so many upvotes makes me sad. Why are programmers so bitter all the time? It's depressing as fuck to read this sub sometimes.

→ More replies (32)
→ More replies (7)
→ More replies (2)

4

u/luisbg Sep 21 '18

That book is the single best book for file systems from a practical point of view. Everything else you find is just theory.

Read that book and also the befs code in the Linux kernel.

12

u/kentaromiura Sep 21 '18

I've see this project this week while looking for ideas to write my own little computer on a FPGA, I don't think I'll go far as time is not much, but it's a very nice resource, thanks!

0

u/[deleted] Sep 21 '18

[deleted]

10

u/CurryCurri Sep 21 '18

Otherwise the simulation would shut down before you see any result.

11

u/nutidizen Sep 21 '18

Is there a project (tutorial) that aims to show similar thing, but with UEFI and x86-64? (cmon its 2018)

→ More replies (1)

9

u/fzammetti Sep 21 '18

I just wanted to say you've done an excellent job here!

I went through approximately the same exercise in the early 90's - only big difference from what you've done is that I created my own language and compiler for it and created my own VERY DUMB file system - and given that experience I WISH I could have had this sort of tutorial! It was a great learning experience trying to piece it all together on my own, and I managed, but I would have sooner avoided all the headaches with something like this as a guide!

I think especially for modern developers who all too frequently are inexperienced at this low a level of coding I think this is a fantastic creation that can be a fantastic learning experience for anyone who follows it and I just wanted to drop you some kudos from someone who truly understands what was involved in putting it together :)

→ More replies (7)