Make & Change Directory Commands | 32 Bit OS Dev (in C)
Adding mkdir and chdir commands for the filesystem, so there can be more things than only a root folder.
Notes:
- Should probably include "C/stdlib.h" instead of "memory/malloc.h" for malloc use in non-kernel source files. Since stdlib has the C wrapper functions for malloc() and free() and would prevent using fully separate malloc instances in some cases, which isn't needed in the elf header. Probably a future bug in waiting.
- Also going to change the command function pointers to return an int (or int32_t) and take in a char** or char *argv[] instead. That way the commands can be more like programs that are loaded; they can have and use flags or command line options from having the full argument array, return error/status codes, etc.
Not sure why I didn't do that to start with.
OS Dev Playlist:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqZYHNLtOZ1MNxOt8myP5K0p
Git Repos:
https://git.sr.ht/~queso_fuego/quesos
https://github.com/queso-fuego/amateuros
Repo state at the start of this video:
git clone https://github.com/queso-fuego/amateuros
cd amateuros
git checkout 0dafbb75b4425f44d317db541938906f61d6084b
Repo state at the end of this video:
git checkout 59774ed484c8d2347b44f400c9c3745c97c38a8a
Next video:
- Maybe making commands slightly better, or working towards an initial file system setup
that is built from make_disk.c
Join the Community Discord: https://discord.gg/yKm4T89QFn
Contact: https://queso_fuego.srht.site/contact.html
- Let me know if there's anything specific you'd like to see!
Questions about setup/software/etc.?
Check the FAQ: https://queso_fuego.srht.site/about.html
Outline:
0:00:00 Intro, move elf loading function out of the kernel
0:08:29 Make new command arrays to later replace the if strcmp checks
0:17:37 mkdir function, then fail at debugging data bits again
0:55:06 chdir function, with lots of trial and error
1:39:27 Potential next topics & outro
Music credits:
Winter Night by Sakura Girl | https://soundcloud.com/sakuragirl_official
Music promoted by https://www.chosic.com/free-music/all/
Creative Commons CC BY 3.0
https://creativecommons.org/licenses/by/3.0/
#osdev #filesystem #mkdir