From edd13c30c56e420502eac88394d1919f56dee448 Mon Sep 17 00:00:00 2001
From: EnderIce2
Date: Sat, 4 Jan 2025 07:52:29 +0200
Subject: [PATCH] chore: Update markdown files
Added CODE_OF_CONDUCT.md
Added CONTRIBUTING.md
Moved CREDITS.md
Moved LICENSES.md
Added SECURITY.md
Added STYLE_GUIDE.md
Signed-off-by: EnderIce2
---
CODE_OF_CONDUCT.md | 128 ++++++++++++++++
CONTRIBUTING.md | 70 +++++++++
Kernel/CREDITS.md => CREDITS.md | 0
Kernel/LICENSES.md | 54 -------
.../heap_allocators/liballoc_1_1/LICENSE | 10 ++
LICENSE => LICENSE.md | 0
LICENSES.md | 59 ++++++++
Makefile | 5 +-
README.md | 138 ++++++++++++++++--
SECURITY.md | 39 +++++
STYLE_GUIDE.md | 91 ++++++++++++
11 files changed, 523 insertions(+), 71 deletions(-)
create mode 100644 CODE_OF_CONDUCT.md
create mode 100644 CONTRIBUTING.md
rename Kernel/CREDITS.md => CREDITS.md (100%)
delete mode 100644 Kernel/LICENSES.md
create mode 100644 Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE
rename LICENSE => LICENSE.md (100%)
create mode 100644 LICENSES.md
create mode 100644 SECURITY.md
create mode 100644 STYLE_GUIDE.md
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..6b9c6e8f
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,128 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity
+and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the
+ overall community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+ address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+enderice2@protonmail.com.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series
+of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or
+permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within
+the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0, available at
+https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct
+enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at
+https://www.contributor-covenant.org/translations.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..e67567cc
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,70 @@
+# Contributing to Fennix
+
+We welcome contributions to Fennix! Whether you are reporting a bug, suggesting a feature, or submitting a pull request, weβre excited to collaborate with you.
+
+## Table of Contents
+- [How to Contribute](#how-to-contribute)
+- [Code of Conduct](#code-of-conduct)
+- [Getting Started](#getting-started)
+- [Pull Request Guidelines](#pull-request-guidelines)
+- [Reporting Issues](#reporting-issues)
+- [Style Guide](#style-guide)
+
+---
+
+## How to Contribute
+
+1. **Check existing issues or discussions** to see if your idea has already been mentioned or if someone is already working on it.
+2. If youβre new to the project, consider contributing to [good first issues](https://github.com/EnderIce2/Fennix/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
+3. Fork the repository and create a new branch for your changes.
+
+---
+
+## Code of Conduct
+
+By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). Be respectful and inclusive while interacting with the community.
+
+---
+
+## Getting Started
+
+1. Fork this repository and clone your fork.
+2. Set up your development environment according to the [README.md](README.md) or any other setup guide provided.
+3. Ensure all tests pass before submitting changes. Add tests for new features where applicable.
+
+---
+
+## Pull Request Guidelines
+
+1. Keep pull requests focused on a single issue or feature.
+2. Write clear, descriptive commit messages.
+3. Ensure all tests pass before submitting your PR.
+4. Include a detailed description of your changes and reference any relevant issue numbers.
+5. Be open to feedback and revise your pull request if requested.
+6. Mark your pull request as a draft if itβs still a work in progress.
+
+---
+
+## Reporting Issues
+
+1. Check if the issue has already been reported.
+2. Include a clear and descriptive title.
+3. Provide detailed steps to reproduce the problem (if applicable).
+4. Mention your environment details (e.g., OS, version, etc.).
+5. Attach screenshots or logs if they help explain the issue.
+
+---
+
+## Style Guide
+
+Follow the coding style used in the repository to ensure consistency. Adhere to:
+- Use CamelCase for all names.
+- Start function and global declaration names with an uppercase letter.
+- Start local variable names with a lowercase letter.
+- Maintain consistent formatting and commenting guidelines.
+
+Refer to the [style guide document](STYLE_GUIDE.md) if available.
+
+---
+
+Thank you for contributing! Your effort makes Fennix better for everyone. If you have any questions, feel free to reach out by opening an issue or joining our discussions.
diff --git a/Kernel/CREDITS.md b/CREDITS.md
similarity index 100%
rename from Kernel/CREDITS.md
rename to CREDITS.md
diff --git a/Kernel/LICENSES.md b/Kernel/LICENSES.md
deleted file mode 100644
index 4031f84e..00000000
--- a/Kernel/LICENSES.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Licenses in the project
-
-This project uses code from other projects, each with its own licenses.
-Below are the licenses associated with these components.
-Make sure to read and comply with these licenses before using or redistributing this software.
-
-## printf
-
-- **License:** The MIT License (MIT)
-- **Location:** [library/printf.c](library/printf.c) [include/printf.h](include/printf.h)
-
-## stb_image
-
-- **License:** The MIT License (MIT) and Public Domain
-- **Location:** [include/stb/image.h](include/stb/image.h)
-
-## stb_image_resize
-
-- **License:** The MIT License (MIT) and Public Domain
-- **Location:** [include/stb/image_resize.h](include/stb/image_resize.h)
-
-## cargs
-
-- **License:** The MIT License (MIT)
-- **Location:** [library/cargs.c](library/cargs.c) [include/cargs.h](include/cargs.h)
-
-## cwalk
-
-- **License:** The MIT License (MIT)
-- **Location:** [library/cwalk.c](library/cwalk.c) [include/cwalk.h](include/cwalk.h)
-
-## Tamsyn Font (v1.11)
-
-- **License:** Unknown
-- **Location:** [files/tamsyn-font-1.11/LICENSE](files/tamsyn-font-1.11/LICENSE)
-
-## liballoc
-
-- **License:** Public Domain
-- **Location:** [https://raw.githubusercontent.com/blanham/liballoc/master/LICENSE](https://raw.githubusercontent.com/blanham/liballoc/master/LICENSE)
-
-## rpmalloc
-
-- **License:** The MIT License (MIT) and Public Domain
-- **Location:** [https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE](https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE)
-
-## ini.h
-
-- **License:** The MIT License (MIT) and Public Domain
-- **Location:** [include/ini.h](include/ini.h)
-
----
-
-Please refer to the respective license files for the full text of each license.
diff --git a/Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE b/Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE
new file mode 100644
index 00000000..63d14cd2
--- /dev/null
+++ b/Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE
@@ -0,0 +1,10 @@
+
+This code is released into the public domain. Use this code at your own
+risk. Feel free to use it for whatever purpose you want. I take no responsibilty or
+whatever if anything goes wrong. Use it at your own risk.
+
+If you have any fixes or patches, please email me.
+
+Durand Miller
+
+
diff --git a/LICENSE b/LICENSE.md
similarity index 100%
rename from LICENSE
rename to LICENSE.md
diff --git a/LICENSES.md b/LICENSES.md
new file mode 100644
index 00000000..61bd40b3
--- /dev/null
+++ b/LICENSES.md
@@ -0,0 +1,59 @@
+# Licenses in the project
+
+This project uses code from other projects, each with its own licenses.
+Below are the licenses associated with these components.
+Make sure to read and comply with these licenses before using or redistributing this software.
+
+## printf
+
+- **License:** The MIT License (MIT)
+- **Location(s):** [Kernel/library/printf.c](Kernel/library/printf.c) [Kernel/include/printf.h](Kernel/include/printf.h) [Userspace/libc/src/print/LICENSE](Userspace/libc/src/print/LICENSE)
+
+## stb_image
+
+- **License:** The MIT License (MIT) and Public Domain
+- **Location(s):** [Kernel/include/stb/image.h](Kernel/include/stb/image.h)
+
+## stb_image_resize
+
+- **License:** The MIT License (MIT) and Public Domain
+- **Location(s):** [Kernel/include/stb/image_resize.h](Kernel/include/stb/image_resize.h)
+
+## cargs
+
+- **License:** The MIT License (MIT)
+- **Location(s):** [Kernel/library/cargs.c](Kernel/library/cargs.c) [Kernel/include/cargs.h](Kernel/include/cargs.h)
+
+## cwalk
+
+- **License:** The MIT License (MIT)
+- **Location(s):** [Kernel/library/cwalk.c](Kernel/library/cwalk.c) [Kernel/include/cwalk.h](Kernel/include/cwalk.h)
+
+## Tamsyn Font (v1.11)
+
+- **License:** Unknown
+- **Location(s):** [Kernel/files/tamsyn-font-1.11/LICENSE](Kernel/files/tamsyn-font-1.11/LICENSE)
+
+## liballoc
+
+- **License:** Public Domain
+- **Location(s):** [Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE](Kernel/core/memory/heap_allocators/liballoc_1_1/LICENSE) [Userspace/libc/src/mem/LICENSE](Userspace/libc/src/mem/LICENSE)
+
+## rpmalloc
+
+- **License:** The MIT License (MIT) and Public Domain
+- **Location(s):** [https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE](https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE)
+
+## ini.h
+
+- **License:** The MIT License (MIT) and Public Domain
+- **Location(s):** [Kernel/include/ini.h](Kernel/include/ini.h)
+
+## nanoprintf.h
+
+- **License:** Unlicense and 0BSD
+- **Location(s):** [Userspace/libc/interpreter/nanoprintf.h](Userspace/libc/interpreter/nanoprintf.h)
+
+---
+
+Please refer to the respective license files for the full text of each license.
diff --git a/Makefile b/Makefile
index 1090bb65..a91ef696 100644
--- a/Makefile
+++ b/Makefile
@@ -92,9 +92,12 @@ endif
# Install necessary packages, build cross-compiler etc...
tools:
make --quiet -C tools all
+
+setup:
make --quiet -C Kernel prepare
- make --quiet -C Userspace prepare
make --quiet -C Drivers prepare
+ make --quiet -C Userspace prepare
+ $(MAKE) tools
build: build_kernel build_userspace build_drivers build_image
diff --git a/README.md b/README.md
index e672c3ab..a4c4cfb1 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,138 @@
-# Fennix
+
+

+
Fennix Operating System
+
-Opeating System from scratch made in C and C++
+
+
+
+
+
+
+
+
+
+Fennix is an operating system built from scratch using C and C++.
---
-#### How to compile & run
+> [!CAUTION]
+> The project is still in development and is not yet ready for production use.
+> Please use a virtual machine to run the OS.
-- Clone repo using:
-```bash
-git clone --recurse-submodules https://github.com/EnderIce2/Fennix.git
+## Features
+
+- π§© Flexible and modular
+ - You can easily choose the components you want to include in the kernel
+- ποΈ Compatible with multiple platforms
+ - Supports i386, AMD64 and AArch64 platforms
+- π¦ Support for different operating system binaries
+ - You can run Linux and Windows binaries
+- π¨οΈ Driver support
+ - Supports a variety of drivers for different hardware components
+- π Detailed documentation
+ - The project is well-documented using Doxygen
+
+> [!IMPORTANT]
+> Some features are still in development and may not be fully functional.
+
+## Getting Started
+
+### πΎ Download ISO Image
+
+You can download the development ISO image from the [Actions](https://github.com/EnderIce2/Fennix/actions/workflows/makefile.yml) tab on the GitHub repository.
+
+
+### π οΈ Prerequisites
+
+To build the project, you need to have the following tools installed:
+
+- `make`
+- `gcc`
+- `ld`
+- ... and other standard Unix tools
+ - These can be installed using `build-essential` on Ubuntu or `base-devel` on Arch Linux
+- `doxygen` (optional)
+ - To generate the documentation
+
+### π Installation
+
+You can install the project by building it from source.
+
+#### Cloning the Repository
+
+First, clone the repository using Git:
+
+```sh
+git clone https://github.com/EnderIce2/fennix.git
+cd fennix
```
-- Build the cross-compiler and other tools:
-```bash
-make tools
+#### Preparing the Environment
+
+Before building the project, you need to build the cross-compiler toolchain and QEMU. You can do this by running the following command:
+
+```sh
+make setup
```
-- Compile using:
-```bash
+This will clone, patch, and build the required tools for you.
+
+#### Building the Project
+
+To build the project, run:
+
+```sh
make build
```
-- Run using:
-```bash
+This will build the kernel, userspace, and drivers. The iso image will be `Fennix.iso`.
+
+#### Running the OS
+
+You can run the OS using QEMU. First, build the project, then run:
+
+```sh
make run
```
-- Clean using:
-```bash
-make clean
+#### Additional Configuration
+
+You can configure the project by editing the `config.mk` file.
+
+## π§ͺ Debugging
+
+If you use Visual Studio Code, you can press `F5` to start debugging the OS.
+The configuration is already set up for you.
+
+> [!TIP]
+> Make sure you built the project at least once before debugging.
+
+## π Documentation
+
+The project documentation is generated using Doxygen.
+To generate the documentation, run:
+
+```sh
+make docs
```
+
+The documentation will be available in the `doxygen-doc/docs` directory.
+
+## π¨βπ» Contributing
+
+Contributions are welcome!
+Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to contribute to this project.
+
+### Contributors
+
+
+
+
+
+## π License
+
+Fennix is licensed under the GNU General Public License v3.0.
+See the [LICENSE.md](LICENSE.md) file for more details.
+
+Other licenses used in the project can be found in the [LICENSES.md](LICENSES.md) file.
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 00000000..f204fd9f
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,39 @@
+# Security Policy
+
+## Supported Versions
+
+Fennix is a comprehensive operating system comprising:
+- **Kernel**: Core OS functionality.
+- **Drivers**: Hardware interaction layers.
+- **Userspace**: Libraries and utilities, including `libc` and essential services like `init`.
+
+We actively support the latest version of Fennix. Older versions may receive security updates at our discretion.
+
+## Reporting a Vulnerability
+
+To report a security vulnerability, please follow these steps:
+
+1. **Do not disclose the vulnerability publicly** until it has been addressed.
+2. Use [GitHub Issues](https://github.com/EnderIce2/Fennix/issues/new/choose) to report the vulnerability. If you prefer to report it privately, e-mail me at **[enderice2@protonmail.com](mailto:enderice2@protonmail.com)** with the following details:
+ - A clear and detailed description of the vulnerability.
+ - Steps to reproduce the issue.
+ - Any potential impact of the vulnerability.
+ - Relevant logs, screenshots, or proof-of-concept code (if applicable).
+3. We will acknowledge your report within 5 business days.
+
+## Our Process
+
+1. **Triage**: We will validate the vulnerability and determine its severity.
+2. **Resolution**: If confirmed, we will develop and test a fix.
+3. **Notification**: You will be notified once the issue is resolved. If applicable, credit will be given to you in the release notes.
+4. **Update**: The fix will be included in a public release. Ensure you update your system to the latest version.
+
+## General Guidelines
+
+- Keep your Fennix installation updated to benefit from the latest security patches.
+- Regularly review and apply updates to third-party packages and dependencies used in your userspace applications.
+
+---
+
+Thank you for helping to make Fennix a secure and reliable operating system for everyone!
+
diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md
new file mode 100644
index 00000000..b2ea13cf
--- /dev/null
+++ b/STYLE_GUIDE.md
@@ -0,0 +1,91 @@
+# Fennix Style Guide
+
+This document outlines the coding standards and style guidelines for contributing to the Fennix project. Consistent code helps improve readability, maintainability, and collaboration.
+
+## General Naming Conventions
+
+- **CamelCase** is used for all identifiers:
+ - Function and global declaration names must start with an uppercase letter.
+ - Example: `InitializeKernel`, `LoadModule`
+ - Local variable names must start with a lowercase letter.
+ - Example: `bufferSize`, `inputString`
+
+## Code Formatting
+
+- **File formatting** should follow the "Visual Studio" style:
+ - Use `Tab` for indentation. Each `Tab` should represent one level of indentation.
+ - Consistently format files by using "Format Document" (available in editors like Visual Studio or VS Code).
+ - Code blocks must align correctly with their containing structure (e.g., functions, loops).
+
+### Example
+
+```c
+void InitializeKernel()
+{
+ int bufferSize = 1024;
+ char *inputString = AllocateMemory(bufferSize);
+ if (inputString == NULL)
+ {
+ HandleError("Memory allocation failed");
+ return;
+ }
+
+ int status = LoadModules(inputString);
+ if (status == 0)
+ return 0;
+
+ // Continue with the initialization
+}
+```
+
+## Commenting Guidelines
+
+- Write clear and concise comments to describe the purpose and functionality of the code if necessary. (**Avoid unnecessary comments.**)
+ - A good explanation of this is [here](https://youtu.be/Bf7vDBBOBUA).
+- Use inline comments sparingly to clarify complex logic.
+- Document public APIs using Doxygen-style comments.
+
+### Example
+
+```c
+/**
+ * @brief Initializes the kernel.
+ *
+ * This function initializes the kernel by loading modules and setting up the environment.
+ */
+void InitializeKernel();
+
+
+void ProcessData()
+{
+ /* Read data from the buffer */
+ size_t bytesRead = ReadData(buffer, MAX_BUFFER_SIZE);
+ if (bytesRead == 0) /* No data read */
+ {
+ HandleError("No data read");
+ return;
+ }
+}
+```
+
+## Guidelines for File Structure
+
+- Group related functions together.
+- Use a consistent order for declarations: global variables, private functions, public functions.
+- Separate sections of code with blank lines for better readability.
+- Avoid having too many functions in a single file.
+- End each file with a newline character.
+
+## Best Practices
+
+- Ensure code is clean and free of unnecessary or redundant elements.
+- Follow the DRY principle (Donβt Repeat Yourself) by reusing existing functions and utilities.
+
+## Automated Tools
+
+- Use linters or formatters integrated into your editor to ensure consistent style.
+- Run tests and validate changes before submitting.
+
+---
+
+Adhering to these guidelines ensures that the Fennix codebase remains robust, readable, and easy to maintain. Thank you for your effort and commitment to quality!