Skip to content

Commit

Permalink
docs: Add info for doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbigshaq committed Jul 26, 2024
1 parent 6d79f16 commit f7abe22
Show file tree
Hide file tree
Showing 66 changed files with 1,595 additions and 432 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ tmp/
*.o
**/*.o
disk.img
dgen/
dgen/
doxygen-awesome-css/
*.log
.idea/
Empty file removed .gitmodules
Empty file.
226 changes: 226 additions & 0 deletions DoxygenLayout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.9.1 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="Documentation" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="interfaces" visible="yes" title="">
<tab type="interfacelist" visible="yes" title="" intro=""/>
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="structs" visible="yes" title="">
<tab type="structlist" visible="yes" title="" intro=""/>
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
</tab>
<tab type="exceptions" visible="yes" title="">
<tab type="exceptionlist" visible="yes" title="" intro=""/>
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>

<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>

<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>

<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<interfaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<structs visible="yes" title=""/>
<exceptions visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>

<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<sequences title=""/>
<dictionaries title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>

<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
55 changes: 14 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# GenesisOS

<p align="center">
<img src='docs/images/logo.png' />
<br />
Expand All @@ -7,7 +8,7 @@
<img src='https://img.shields.io/badge/arch-x86/32bit-blue' />
</p>

Dumb project I made because I wanted to learn about kernels and how they work. You are welcomed to contribute to my chaos and join the cult.
Small project I made because I wanted to learn about kernels and how they work.

This operating system have the following features:
* Kernel allocator
Expand All @@ -16,15 +17,23 @@ This operating system have the following features:
* Disk: ATA PIO
* Syscalls
* Scheduler (_Round-Robin_ algorithm)
* Console/UART driver
* Serial/UART driver
* Filesystem: Support FAT32
* ELF Loader
* Userland shell/init binary
* Devices/File descriptors(not rly/partial)
* Devices/File descriptors
* VGA Driver
* BMP Renderer

All this work, just to load a userland ELF binary that echoes back whatever you write to it by calling `SYS_read` and `SYS_write`:

All this work, just to load an ELF binary that echoes back whatever you write to it by calling `SYS_read` and `SYS_write`:
![genesis-gif](docs/images/gfx-terminal.gif)

<img src='docs/images/terminal.gif' />
More info:
* [Build Instructions](docs/build_instructions.md)
* [IDE Configuration](docs/ide.md)

# References

To write this project, I used:
* _Intel SDM Vol 3_(`325384-sdm-vol-3abcd.pdf`)
Expand All @@ -33,39 +42,3 @@ To write this project, I used:
* "_The little book about OS development_": https://littleosbook.github.io/
* Academic projects: SerenityOS, JOS and xv6 (to get inspiration for design ideas)
* _nanobyte-dev_ YT channel to get introduction on FAT filesystems.


# Build & Run

Launch an `ubuntu:20.04` container and follow the steps below
```sh
docker run -v $(pwd):/share/ --rm --privileged --name osdev -it ubuntu:20.04
```

```
cmake -GNinja -S . -B build/
```

This will generate a `build/` directory, with a _ninja_ file in it.
* To start the build with ninja and generate a filesystem, run `./scripts/build.sh`
* To run GenesisOS, run `./scripts/run.sh`

# Debug

To debug:
1. Run `make qemu-gdb`
2. Connect with gdb by running `target remote :12345`

# Security

Found a security issue? Good, fix it and send a PR.

>There are plenty of vulns around the codebase. I'm considering opening a special activities/event for vuln researchers who are interested in OSDev so we can learn and grow together. Should update about it in the Discord server.
# Compile DB

For easier code navigation and auto-completion, use _clangd_'s vscode plugin + [compiledb](https://github.com/nickdiego/compiledb).

```
compiledb make iso
```
56 changes: 56 additions & 0 deletions docs/build_instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# Build Instructions
@brief Compiling the OS

@note
> [!NOTE]
> This project don't have support for Windows(or at least I never tried to), if you're running Windows, generate a build using WSL/Docker and then run the final OS image with `./meta/run.bat`.

## Dependencies

All the dependencies to build and run this project can be found in `./deps-container.sh`


## Docker

Launch an `ubuntu:22.04` container and follow the steps below
```sh
docker run -v $(pwd):/share/ --rm --privileged --name osdev -it ubuntu:22.04
```

And follow the same steps as described in '_Linux/Windows(WSL)_' below.

## Linux/Windows(WSL)

To build, run `./meta/build.sh`
```
$ ./meta/build.sh
-- The C compiler identification is Clang 18.1.8
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (1.3s)
-- Generating done (0.2s)
-- Build files have been written to: /home/sidequest/repos/GenesisOS/build
ninja: Entering directory `build/'
[43/48] Filesystem: Generating FAT32 disk image
33+0 records in
33+0 records out
34603008 bytes (35 MB, 33 MiB) copied, 0.0830217 s, 417 MB/s
[47/48] GenesisOS: Building kernel.elf
[+] kernel.elf built successfully
[48/48] ISO: Generating ISO w/ grub-mkrescue
[+] GenesisOS built successfully
[*] Merging compile commands databases
[+] Done
```

# Run

* If you're on Linux, run `./meta/run.sh` to start the OS with QEMU.
* On Windows, run `.\meta\run.bat` and make sure you have QEMU installed in the default path(`C:\Program Files\qemu\qemu-system-i386.exe`)
15 changes: 15 additions & 0 deletions docs/ide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# IDE Configuration
@brief Config the IDE for easier code navigation.

The build process will generate a compilation database for your IDE, if you're using vscode,
download [LLVM's clangd](https://clangd.llvm.org/) extension and use the following configuration in `.vscode/settings.json`:

```json
{
"clangd.arguments": [
"--compile-commands-dir=${workspaceFolder}/build"
]
}
```

This will tell the clangd server where the database is and allow easier code navigation.
Binary file added docs/images/8259-PIN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/gfx-terminal.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pic-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f7abe22

Please sign in to comment.