Updated files

This commit is contained in:
Alex
2022-09-29 02:07:21 +03:00
parent b766196550
commit 884b50a351
24 changed files with 4254 additions and 4 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: EnderIce2 # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

33
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,33 @@
---
name: Bug report / crash
about: Create a report to help find bugs
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshot or Video**
If applicable, add screenshots or videos to help explain your problem.
**Serial Port Output**
Serial port output (file .log or .txt).
**System Information**
- CPU:
- RAM:
- GPU:
- Motherboard:
- Virtual Machine:
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

276
.github/workflows/makefile.yml vendored Normal file
View File

@ -0,0 +1,276 @@
name: Build OS
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
deploydoc:
name: Deploy Documentation to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Doxygen
run: sudo apt-get install doxygen make -y
- name: Generate Documentation
run: make doxygen
- name: Copy GitHub Pages Website
run: cp -r tools/website/* doxygen-doc/
- name: Deploy documentation
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: doxygen-doc
buildcompiler:
name: Build Cross-Compiler (GCC)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache cross Folder
id: cache-cross
uses: actions/cache@v3
with:
path: tools/cross
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
- name: Update System
if: steps.cache-cross.outputs.cache-hit != 'true'
run: sudo apt-get update
- name: Install GCC Dependencies
if: steps.cache-cross.outputs.cache-hit != 'true'
run: sudo apt install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libzstd-dev libisl-dev autoconf m4 automake gettext gperf dejagnu guile-3.0 guile-3.0-dev expect tcl autogen tex-common sphinx-common git ssh diffutils patch -y
- name: Clone All
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C clone_all
- name: Compile Binutils amd64
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C do_binutils64
- name: Compile Binutils i686
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C do_binutils32
- name: Compile Binutils aarch64
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C do_binutilsarm64
- name: Compile GCC amd64
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C do_gcc64
- name: Compile GCC i686
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C do_gcc32
- name: Compile GCC aarch64
if: steps.cache-cross.outputs.cache-hit != 'true'
run: make --quiet -C do_gccarm64
compilegnuefi:
name: Build GNU-EFI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache gnu-efi Folder
id: cache-gnuefi
uses: actions/cache@v3
with:
path: Lynx/gnu-efi
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
- name: Update System
if: steps.cache-gnuefi.outputs.cache-hit != 'true'
run: sudo apt-get update
- name: Install MinGW compiler
if: steps.cache-gnuefi.outputs.cache-hit != 'true'
run: sudo apt-get install make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
- name: Get GNU-EFI source code and compile it
if: steps.cache-gnuefi.outputs.cache-hit != 'true'
run: make Lynx prepare
analyze:
name: Analyze with CodeQL
runs-on: ubuntu-latest
needs: [buildcompiler, compilegnuefi]
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Install Packages
run: sudo apt-get update && sudo apt-get install xorriso mtools genisoimage ovmf nasm doxygen make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo -y
- name: Cache cross
id: cache-cross
uses: actions/cache@v3
with:
path: tools/cross
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
- name: Cache gnuefi
id: cache-gnuefi
uses: actions/cache@v3
with:
path: Lynx/gnu-efi
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
- name: Build OS
run: |
make build_lynx
make build_kernel
make build_userspace
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
compile64:
name: Build amd64
runs-on: ubuntu-latest
needs: [buildcompiler, compilegnuefi]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Update & Install Required Packages
run: |
sudo apt-get update
sudo apt-get install xorriso mtools genisoimage ovmf nasm doxygen make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
- name: Cache cross Folder
id: cache-cross
uses: actions/cache@v3
with:
path: tools/cross
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
- name: Cache gnu-efi Folder
id: cache-gnuefi
uses: actions/cache@v3
with:
path: Lynx/gnu-efi
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
- name: Configure Makefile.conf
run: sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
- name: Build
run: make build
- name: Upload Artifact
uses: actions/upload-artifact@v3.0.0
with:
name: Fennix-amd64
path: Fennix.iso
compile32:
name: Build i686
runs-on: ubuntu-latest
needs: [buildcompiler, compilegnuefi]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Update & Install Required Packages
run: |
sudo apt-get update
sudo apt-get install xorriso mtools genisoimage ovmf nasm doxygen make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
- name: Cache cross Folder
id: cache-cross
uses: actions/cache@v3
with:
path: tools/cross
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
- name: Cache gnu-efi Folder
id: cache-gnuefi
uses: actions/cache@v3
with:
path: Lynx/gnu-efi
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
- name: Configure Makefile.conf
run: sed -i 's/.*OSARCH = .*/OSARCH = i686/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
- name: Build
run: make build
- name: Upload Artifact
uses: actions/upload-artifact@v3.0.0
with:
name: Fennix-i686
path: Fennix.iso
compilearm64:
name: Build aarch64
runs-on: ubuntu-latest
needs: [buildcompiler, compilegnuefi]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Update & Install Required Packages
run: |
sudo apt-get update
sudo apt-get install xorriso mtools genisoimage ovmf nasm doxygen make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64 -y
- name: Cache cross Folder
id: cache-cross
uses: actions/cache@v3
with:
path: tools/cross
key: ${{ runner.os }}-cross-${{ hashFiles('tools/Makefile') }}
- name: Cache gnu-efi Folder
id: cache-gnuefi
uses: actions/cache@v3
with:
path: Lynx/gnu-efi
key: ${{ runner.os }}-gnuefi-${{ hashFiles('Lynx/Makefile') }}
- name: Configure Makefile.conf
run: sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./Makefile.conf && cat Makefile.conf | grep OSARCH
- name: Build
run: make build
- name: Upload Artifact
uses: actions/upload-artifact@v3.0.0
with:
name: Fennix-aarch64
path: Fennix.iso

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
iso_tmp_data
tools/*
!tools/website
!tools/Makefile
!tools/*.c
!tools/*.cpp
!tools/*.cfg
doxygen-doc
*.log
*.img
*.iso

2659
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

3
Doxygen_README.md Normal file
View File

@ -0,0 +1,3 @@
# Doxygen
This is a README file for the Doxygen.

View File

@ -5,6 +5,9 @@
}
],
"settings": {
"debug.allowBreakpointsEverywhere": true
"debug.allowBreakpointsEverywhere": true,
"files.associations": {
"ostream": "cpp"
}
}
}

1
Initrd/Test.txt Normal file
View File

@ -0,0 +1 @@
Hello World!

2
Kernel

Submodule Kernel updated: 96412135fd...6d5f7e9372

2
Lynx

Submodule Lynx updated: bc094b39c7...5f96473b20

159
Makefile
View File

@ -0,0 +1,159 @@
include Makefile.conf
.PHONY: default tools clean
# First rule
default:
$(error Please specify a target)
# Available display devices
# None: -vga none
# Standard: -device VGA
# Bochs: -device bochs-display
# VirtIO VGA: -device virtio-vga
# VirtIO GPU: -device virtio-gpu-pci
# QXL VGA: -device qxl-vga
# QXL: -device qxl
# Cirrus VGA: -device cirrus-vga
# ATI VGA: -device ati-vga
# RAMFB: -device ramfb
# For tap0
# -netdev tap,id=usernet0,ifname=tap0,script=no,downscript=no
QEMU = ./$(QEMU_PATH)$(QEMU_ARCH)
QEMUFLAGS := -display gtk
QEMUHWACCELERATION = -machine q35 -enable-kvm
QEMUMEMORY = -m 4G
ifeq ($(OSARCH), amd64)
QEMUFLAGS += -device bochs-display -M q35 \
-usb \
-usbdevice mouse \
-smp $(shell nproc) \
-net user \
-netdev user,id=usernet0 \
-device e1000,netdev=usernet0,mac=00:69:96:00:42:00 \
-object filter-dump,id=usernet0,netdev=usernet0,file=network.log,maxlen=1024 \
-serial file:serial.log \
-device ahci,id=ahci \
-drive id=bootdsk,file=$(OSNAME).iso,format=raw,if=none \
-device ide-hd,drive=bootdsk,bus=ahci.0 \
-drive id=disk,file=qemu-disk.img,format=raw,if=none \
-device ide-hd,drive=disk,bus=ahci.1 \
-audiodev pa,id=audio0 \
-machine pcspk-audiodev=audio0 \
-device AC97,audiodev=audio0
else ifeq ($(OSARCH), i686)
QEMUFLAGS += -M q35 \
-usb \
-usbdevice mouse \
-smp $(shell nproc) \
-net user \
-netdev user,id=usernet0 \
-device e1000,netdev=usernet0,mac=00:69:96:00:42:00 \
-object filter-dump,id=usernet0,netdev=usernet0,file=network.log,maxlen=1024 \
-serial file:serial.log \
-hda $(OSNAME).iso \
-audiodev pa,id=audio0 \
-machine pcspk-audiodev=audio0 \
-device AC97,audiodev=audio0
else ifeq ($(OSARCH), aarch64)
QEMUFLAGS += -M virt \
-cpu cortex-a57 \
-smp $(shell nproc) \
-serial file:serial.log \
-hda $(OSNAME).iso
endif
doxygen:
mkdir -p doxygen-doc
doxygen Doxyfile
doxygen Kernel/Doxyfile
doxygen Lynx/Doxyfile
doxygen Userspace/Doxyfile
qemu_vdisk:
ifneq (,$(wildcard ./qemu-disk.img))
$(info qemu-disk.img Already exists)
else
dd if=/dev/zero of=qemu-disk.img bs=1024K count=4000
endif
# Install necessary packages, build cross-compiler etc...
tools:
make --quiet -C tools all
make --quiet -C Kernel prepare
make --quiet -C Lynx prepare
make --quiet -C Userspace prepare
build: build_lynx build_kernel build_userspace build_image
rebuild: clean build
# Quickly build the operating system (it won't create the ISO file and doxygen documentation)
build_lynx:
ifeq ($(BOOTLOADER), lynx)
make --quiet -C boot build
endif
build_kernel:
make -j$(shell nproc) --quiet -C Kernel build
build_userspace:
make --quiet -C Userspace build
build_image:
mkdir -p iso_tmp_data
tar cf initrd.tar.gz -C Initrd/ ./ --format=ustar
cp Kernel/kernel.fsys initrd.tar.gz \
iso_tmp_data/
ifeq ($(BOOTLOADER), lynx)
cp tools/lynx.cfg boot/BIOS/loader.bin boot/UEFI/efi-loader.bin iso_tmp_data/
xorriso -as mkisofs -b loader.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot efi-loader.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_tmp_data -o $(OSNAME).iso
endif
ifeq ($(BOOTLOADER), other)
ifeq ($(OSARCH), amd64)
cp tools/limine.cfg $(LIMINE_FOLDER)/limine.sys $(LIMINE_FOLDER)/limine-cd.bin $(LIMINE_FOLDER)/limine-cd-efi.bin iso_tmp_data/
xorriso -as mkisofs -b limine-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--efi-boot limine-cd-efi.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
iso_tmp_data -o $(OSNAME).iso
endif
ifeq ($(OSARCH), i686)
mkdir -p iso_tmp_data/boot
mkdir -p iso_tmp_data/boot/grub
cp tools/grub.cfg iso_tmp_data/boot/grub/
grub-mkrescue -o $(OSNAME).iso iso_tmp_data
endif
endif
QEMU_UEFI_BIOS :=
ifeq ($(OSARCH), amd64)
QEMU_UEFI_BIOS += -bios /usr/share/qemu/OVMF.fd
endif
vscode_debug: build_kernel build_userspace build_image
rm -f serial.log network.log
$(QEMU) -S -gdb tcp::1234 -d int -no-shutdown $(QEMU_UEFI_BIOS) -m 4G $(QEMUFLAGS)
qemu: qemu_vdisk
rm -f serial.log network.log
$(QEMU) $(QEMU_UEFI_BIOS) -cpu host $(QEMUFLAGS) $(QEMUHWACCELERATION) $(QEMUMEMORY)
qemubios: qemu_vdisk
rm -f serial.log network.log
$(QEMU) -cpu host $(QEMUFLAGS) $(QEMUHWACCELERATION) $(QEMUMEMORY)
run: build qemu
clean:
rm -rf doxygen-doc iso_tmp_data initrd.tar.gz $(OSNAME).iso
make --quiet -C Kernel clean
make --quiet -C Lynx clean
make --quiet -C Userspace clean

50
Makefile.conf Normal file
View File

@ -0,0 +1,50 @@
# If the OS we are building should be compiled for debugging purposes.
DEBUG = 1
# Enable testing functions.
TESTING = 0
# Operating system name.
OSNAME = Fennix
# OS architecture: amd64, i686, aarch64
OSARCH = amd64
# Kernel version.
KERNEL_VERSION = pre-alpha-0.0.0.1
# Which bootloader to use.
# Available bootloaders:
# - lynx - Lynx Bootloader (still under development)
# - other - Limine (64-bit) & GRUB Bootloader (32-bit)
BOOTLOADER=other
# The path of the cross-compiler.
COMPILER_PATH = tools/cross/bin
# The path of the Limine bootloader.
LIMINE_FOLDER = tools/limine
# Qemu path. If you want to use the one you have installed in your system,
# change it to /usr/bin/qemu-system- (do not include x86_64 or i386,
# it will be added automatically depending on the OSARCH)
QEMU_PATH = tools/cross/bin/qemu-system-
# Make releated variables
# DO NOT TOUCH!
ifeq ($(OSARCH), amd64)
COMPILER_ARCH = amd64-elf-
QEMU_ARCH = x86_64
else ifeq ($(OSARCH), i686)
COMPILER_ARCH = i686-elf-
QEMU_ARCH = i386
else ifeq ($(OSARCH), aarch64)
COMPILER_ARCH = aarch64-elf-
QEMU_ARCH = aarch64
endif

328
tools/ErrorParser.cpp Normal file
View File

@ -0,0 +1,328 @@
#include <iostream>
#include <cstdint>
using namespace std;
#define clear system("clear")
typedef union CR0
{
struct
{
/** @brief Protection Enable */
uint64_t PE : 1;
/** @brief Monitor Coprocessor */
uint64_t MP : 1;
/** @brief Emulation */
uint64_t EM : 1;
/** @brief Task Switched */
uint64_t TS : 1;
/** @brief Extension Type */
uint64_t ET : 1;
/** @brief Numeric Error */
uint64_t NE : 1;
/** @brief Reserved */
uint64_t _reserved0 : 10;
/** @brief Write Protect */
uint64_t WP : 1;
/** @brief Reserved */
uint64_t _reserved1 : 1;
/** @brief Alignment Mask */
uint64_t AM : 1;
/** @brief Reserved */
uint64_t _reserved2 : 10;
/** @brief Mot Write-through */
uint64_t NW : 1;
/** @brief Cache Disable */
uint64_t CD : 1;
/** @brief Paging */
uint64_t PG : 1;
};
uint64_t raw;
} CR0;
typedef union CR2
{
struct
{
/** @brief Page Fault Linear Address */
uint64_t PFLA;
};
uint64_t raw;
} CR2;
typedef union CR3
{
struct
{
/** @brief Not used if bit 17 of CR4 is 1 */
uint64_t PWT : 1;
/** @brief Not used if bit 17 of CR4 is 1 */
uint64_t PCD : 1;
/** @brief Base of PML4T/PML5T */
uint64_t PDBR;
};
uint64_t raw;
} CR3;
typedef union CR4
{
struct
{
/** @brief Virtual-8086 Mode Extensions */
uint64_t VME : 1;
/** @brief Protected-Mode Virtual Interrupts */
uint64_t PVI : 1;
/** @brief Time Stamp Disable */
uint64_t TSD : 1;
/** @brief Debugging Extensions */
uint64_t DE : 1;
/** @brief Page Size Extensions */
uint64_t PSE : 1;
/** @brief Physical Address Extension */
uint64_t PAE : 1;
/** @brief Machine Check Enable */
uint64_t MCE : 1;
/** @brief Page Global Enable */
uint64_t PGE : 1;
/** @brief Performance Monitoring Counter */
uint64_t PCE : 1;
/** @brief Operating System Support */
uint64_t OSFXSR : 1;
/** @brief Operating System Support */
uint64_t OSXMMEXCPT : 1;
/** @brief User-Mode Instruction Prevention */
uint64_t UMIP : 1;
/** @brief Linear Address 57bit */
uint64_t LA57 : 1;
/** @brief VMX Enable */
uint64_t VMXE : 1;
/** @brief SMX Enable */
uint64_t SMXE : 1;
/** @brief Reserved */
uint64_t _reserved0 : 1;
/** @brief FSGSBASE Enable */
uint64_t FSGSBASE : 1;
/** @brief PCID Enable */
uint64_t PCIDE : 1;
/** @brief XSAVE and Processor Extended States Enable */
uint64_t OSXSAVE : 1;
/** @brief Reserved */
uint64_t _reserved1 : 1;
/** @brief SMEP Enable */
uint64_t SMEP : 1;
/** @brief SMAP Enable */
uint64_t SMAP : 1;
/** @brief Protection-Key Enable */
uint64_t PKE : 1;
/** @brief Reserved */
uint64_t _reserved2 : 9;
};
uint64_t raw;
} CR4;
typedef union
{
struct
{
/** @brief Carry Flag */
uint64_t CF : 1;
/** @brief Reserved */
uint64_t always_one : 1;
/** @brief Parity Flag */
uint64_t PF : 1;
/** @brief Reserved */
uint64_t _reserved0 : 1;
/** @brief Auxiliary Carry Flag */
uint64_t AF : 1;
/** @brief Reserved */
uint64_t _reserved1 : 1;
/** @brief Zero Flag */
uint64_t ZF : 1;
/** @brief Sign Flag */
uint64_t SF : 1;
/** @brief Trap Flag */
uint64_t TF : 1;
/** @brief Interrupt Enable Flag */
uint64_t IF : 1;
/** @brief Direction Flag */
uint64_t DF : 1;
/** @brief Overflow Flag */
uint64_t OF : 1;
/** @brief I/O Privilege Level */
uint64_t IOPL : 2;
/** @brief Nested Task */
uint64_t NT : 1;
/** @brief Reserved */
uint64_t _reserved2 : 1;
/** @brief Resume Flag */
uint64_t RF : 1;
/** @brief Virtual 8086 Mode */
uint64_t VM : 1;
/** @brief Alignment Check */
uint64_t AC : 1;
/** @brief Virtual Interrupt Flag */
uint64_t VIF : 1;
/** @brief Virtual Interrupt Pending */
uint64_t VIP : 1;
/** @brief ID Flag */
uint64_t ID : 1;
/** @brief Reserved */
uint64_t _reserved3 : 10;
};
uint64_t raw;
} Rrfl;
typedef union PageFaultErrorCode
{
struct
{
uint64_t P : 1;
uint64_t W : 1;
uint64_t U : 1;
uint64_t R : 1;
uint64_t I : 1;
uint64_t PK : 1;
uint64_t SS : 1;
uint64_t Reserved0 : 8;
uint64_t SGX : 1;
uint64_t Reserved1 : 16;
};
uint64_t raw;
} PageFaultErrorCode;
static const char *pagefault_message[] = {
"Supervisory process tried to read a non-present page entry",
"Supervisory process tried to read a page and caused a protection fault",
"Supervisory process tried to write to a non-present page entry",
"Supervisory process tried to write a page and caused a protection fault",
"User process tried to read a non-present page entry",
"User process tried to read a page and caused a protection fault",
"User process tried to write to a non-present page entry",
"User process tried to write a page and caused a protection fault"};
// TODO: This code can be improved.
int main(char argc, char *argv[])
{
clear;
char crtype = 0;
cout << "Enter error type [CR-0,2,3,4,f; Error-e; Help-h]: ";
cin >> crtype;
clear;
CR0 cr0;
CR2 cr2;
CR3 cr3;
CR4 cr4;
Rrfl rfl;
if (crtype == '0' || crtype == '2' || crtype == '3' || crtype == '4' || crtype == 'f')
{
cout << "Enter CR data: ";
uint64_t raw;
cin >> hex >> raw;
cr0.raw = raw;
cr2.raw = raw;
cr3.raw = raw;
cr4.raw = raw;
rfl.raw = raw;
clear;
}
switch (crtype)
{
case '0':
printf("CR0: PE:%s MP:%s EM:%s TS:%s\n ET:%s NE:%s WP:%s AM:%s\n NW:%s CD:%s PG:%s\n R0:%#x R1:%#x R2:%#x\n",
cr0.PE ? "True " : "False", cr0.MP ? "True " : "False", cr0.EM ? "True " : "False", cr0.TS ? "True " : "False",
cr0.ET ? "True " : "False", cr0.NE ? "True " : "False", cr0.WP ? "True " : "False", cr0.AM ? "True " : "False",
cr0.NW ? "True " : "False", cr0.CD ? "True " : "False", cr0.PG ? "True " : "False",
cr0._reserved0, cr0._reserved1, cr0._reserved2);
break;
case '2':
{
printf("CR2: PFLA: %#lx\n",
cr2.PFLA);
break;
}
break;
case '3':
printf("CR3: PWT:%s PCD:%s PDBR:%#lx\n",
cr3.PWT ? "True " : "False", cr3.PCD ? "True " : "False", cr3.PDBR);
break;
case '4':
printf("CR4: VME:%s PVI:%s TSD:%s DE:%s\n PSE:%s PAE:%s MCE:%s PGE:%s\n PCE:%s UMIP:%s OSFXSR:%s OSXMMEXCPT:%s\n LA57:%s VMXE:%s SMXE:%s PCIDE:%s\n OSXSAVE:%s SMEP:%s SMAP:%s PKE:%s\n R0:%#x R1:%#x R2:%#x\n",
cr4.VME ? "True " : "False", cr4.PVI ? "True " : "False", cr4.TSD ? "True " : "False", cr4.DE ? "True " : "False",
cr4.PSE ? "True " : "False", cr4.PAE ? "True " : "False", cr4.MCE ? "True " : "False", cr4.PGE ? "True " : "False",
cr4.PCE ? "True " : "False", cr4.UMIP ? "True " : "False", cr4.OSFXSR ? "True " : "False", cr4.OSXMMEXCPT ? "True " : "False",
cr4.LA57 ? "True " : "False", cr4.VMXE ? "True " : "False", cr4.SMXE ? "True " : "False", cr4.PCIDE ? "True " : "False",
cr4.OSXSAVE ? "True " : "False", cr4.SMEP ? "True " : "False", cr4.SMAP ? "True " : "False", cr4.PKE ? "True " : "False",
cr4._reserved0, cr4._reserved1, cr4._reserved2);
break;
case 'f':
printf("RFL: CF:%s PF:%s AF:%s ZF:%s\n SF:%s TF:%s IF:%s DF:%s\n OF:%s IOPL:%s NT:%s RF:%s\n VM:%s AC:%s VIF:%s VIP:%s\n ID:%s AlwaysOne:%d\n R0:%#x R1:%#x R2:%#x R3:%#x\n",
rfl.CF ? "True " : "False", rfl.PF ? "True " : "False", rfl.AF ? "True " : "False", rfl.ZF ? "True " : "False",
rfl.SF ? "True " : "False", rfl.TF ? "True " : "False", rfl.IF ? "True " : "False", rfl.DF ? "True " : "False",
rfl.OF ? "True " : "False", rfl.IOPL ? "True " : "False", rfl.NT ? "True " : "False", rfl.RF ? "True " : "False",
rfl.VM ? "True " : "False", rfl.AC ? "True " : "False", rfl.VIF ? "True " : "False", rfl.VIP ? "True " : "False",
rfl.ID ? "True " : "False", rfl.always_one,
rfl._reserved0, rfl._reserved1, rfl._reserved2, rfl._reserved3);
break;
case 'e':
{
// TODO: support more error types
uint32_t err_code = 0;
cout << "[0xe Page Fault] e=";
cin >> err_code;
clear;
printf("Page Fault e=%04d\n", err_code);
PageFaultErrorCode params = {.raw = (uint32_t)err_code};
printf("Page: %s\n", params.P ? "Present" : "Not Present");
cout << "\033[1;31m When set, the page fault was caused by a page-protection violation. When not set, it was caused by a non-present page.\033[0m\n\n";
printf("Write Operation: %s\n", params.W ? "Read-Only" : "Read-Write");
cout << "\033[1;31m When set, the page fault was caused by a write access. When not set, it was caused by a read access.\033[0m\n\n";
printf("Processor Mode: %s\n", params.U ? "User-Mode" : "Kernel-Mode");
cout << "\033[1;31m When set, the page fault was caused while CPL = 3. This does not necessarily mean that the page fault was a privilege violation.\033[0m\n\n";
printf("CPU Reserved Bits: %s\n", params.R ? "Reserved" : "Unreserved");
cout << "\033[1;31m When set, one or more page directory entries contain reserved bits which are set to 1. This only applies when the PSE or PAE rfl in CR4 are set to 1.\033[0m\n\n";
printf("Caused By An Instruction Fetch: %s\n", params.I ? "Yes" : "No");
cout << "\033[1;31m When set, the page fault was caused by an instruction fetch. This only applies when the No-Execute bit is supported and enabled.\033[0m\n\n";
printf("Caused By A Protection-Key Violation: %s\n", params.PK ? "Yes" : "No");
cout << "\033[1;31m When set, the page fault was caused by a protection-key violation. The PKRU register (for user-mode accesses) or PKRS MSR (for supervisor-mode accesses) specifies the protection key rights.\033[0m\n\n";
printf("Caused By A Shadow Stack Access: %s\n", params.SS ? "Yes" : "No");
cout << "\033[1;31m When set, the page fault was caused by a shadow stack access.\033[0m\n\n";
printf("Caused By An SGX Violation: %s\n", params.SGX ? "Yes" : "No");
cout << "\033[1;31m When set, the fault was due to an SGX violation. The fault is unrelated to ordinary paging.\033[0m\n\n";
printf("Description: %s\n", err_code & 0x00000008 ? "One or more page directory entries contain reserved bits which are set to 1." : pagefault_message[err_code & 0b111]);
cout << "\033[1;31m Detailed exception\033[0m\n\n";
printf("Reserved0: %#lx\n", params.Reserved0);
cout << "\033[1;31m Reserved\033[0m\n\n";
printf("Reserved1: %#lx\n", params.Reserved1);
cout << "\033[1;31m Reserved\033[0m\n\n";
break;
}
case 'h':
{
cout << "Make qemu error code (e=????) or control registers easy to read." << endl;
cout << "----------------------------------------------------------------" << endl;
cout << "0,2,3,4 - CR data" << endl;
cout << "e - Error code from QEMU" << endl;
cout << "h - This text" << endl;
break;
}
default:
cout << "Invalid error type" << endl;
break;
}
return 0;
}

72
tools/Makefile Normal file
View File

@ -0,0 +1,72 @@
WORKING_DIR = $(shell pwd)
CROSS_DIR="$(WORKING_DIR)/cross"
export PATH := $(CROSS_DIR):$(PATH)
QEMU_VERSION = qemu-7.1.0
all: do_rep do_ep do_limine clone_all do_binutils64 do_binutils32 do_binutilsarm64 do_gcc64 do_gcc32 do_gccarm64 do_qemu
clean:
rm -f rep ep
do_rep:
gcc -w ReadEthernetPackets.c -o rep
chmod +x rep
do_ep:
g++ -w e.cpp -o ep
chmod +x ep
do_limine:
git clone https://github.com/limine-bootloader/limine.git --branch=v4.x-branch-binary --depth=1
clone_all:
git clone https://sourceware.org/git/binutils-gdb.git binutils-gdb
git clone https://gcc.gnu.org/git/gcc.git gcc
wget https://download.qemu.org/${QEMU_VERSION}.tar.xz
tar xvJf ${QEMU_VERSION}.tar.xz
rm -f ${QEMU_VERSION}.tar.xz
mv ${QEMU_VERSION} qemu
mkdir -p cross
mkdir -p qemu
mkdir -p build-binutilsamd64
mkdir -p build-binutilsi686
mkdir -p build-binutilsarm64
mkdir -p build-gccamd64
mkdir -p build-gcci686
mkdir -p build-gccarm64
do_qemu:
cd qemu && \
bash ./configure --target-list=x86_64-softmmu,i386-softmmu,aarch64-softmmu --prefix=$(CROSS_DIR) --enable-gtk && \
make -j$(shell nproc) && make install
do_binutils64:
cd build-binutilsamd64 && \
../binutils-gdb/configure --target=amd64-elf --prefix=$(CROSS_DIR) --with-sysroot --disable-werror && \
make all -j$(shell nproc) && make install
do_binutils32:
cd build-binutilsi686 && \
../binutils-gdb/configure --target=i686-elf --prefix=$(CROSS_DIR) --with-sysroot --disable-werror && \
make all -j$(shell nproc) && make install
do_binutilsarm64:
cd build-binutilsarm64 && \
../binutils-gdb/configure --target=aarch64-elf --prefix=$(CROSS_DIR) --with-sysroot --disable-werror && \
make all -j$(shell nproc) && make install
do_gcc64:
cd build-gccamd64 && \
../gcc/configure --target=amd64-elf --prefix=$(CROSS_DIR) --enable-languages=c,c++ --without-headers && \
make all-gcc -j$(shell nproc) && make install-gcc -j$(shell nproc)
do_gcc32:
cd build-gcci686 && \
../gcc/configure --target=i686-elf --prefix=$(CROSS_DIR) --enable-languages=c,c++ --without-headers && \
make all-gcc -j$(shell nproc) && make install-gcc -j$(shell nproc)
do_gccarm64:
cd build-gccarm64 && \
../gcc/configure --target=aarch64-elf --prefix=$(CROSS_DIR) --enable-languages=c,c++ --without-headers && \
make all-gcc -j$(shell nproc) && make install-gcc -j$(shell nproc)

150
tools/ReadEthernetPackets.c Normal file
View File

@ -0,0 +1,150 @@
/* I don't remember where I got this code from, but it seems to work fine for me. */
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/ether.h>
enum FrameType
{
TYPE_IPV4 = 0x0800,
TYPE_ARP = 0x0806,
TYPE_RARP = 0x8035,
TYPE_IPV6 = 0x86DD
};
#define ETHER_TYPE TYPE_ARP
#define DEFAULT_IF "enp7s0"
#define BUF_SIZ 1024
int main(int argc, char *argv[])
{
char sender[INET6_ADDRSTRLEN];
int sockfd, ret, i;
int sockopt;
ssize_t numbytes;
struct ifreq ifopts;
struct ifreq if_ip;
struct sockaddr_storage their_addr;
uint8_t buf[BUF_SIZ];
char ifName[IFNAMSIZ];
int ether_type = TYPE_ARP;
if (argc > 1)
{
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
{
printf("Usage: sudo %s [type] [interface]\nTypes:\n 0 - IPv4 1 - ARP 2 - RARP 3 - IPv6\nExample: sudo %s 1 enp7s0", argv[0], argv[0]);
return 0;
}
if (argv[1] > '9' || argv[1] < '0')
{
switch (atoi(argv[1]))
{
case 0:
ether_type = TYPE_IPV4;
break;
case 1:
ether_type = TYPE_ARP;
break;
case 2:
ether_type = TYPE_RARP;
break;
case 3:
ether_type = TYPE_IPV6;
break;
default:
printf("Invalid type.\n");
return -1;
}
}
else
{
printf("Invalid ethernet type \"%d\".", atoi(argv[1]));
return -1;
}
}
if (argc > 2)
strcpy(ifName, argv[2]);
else
strcpy(ifName, DEFAULT_IF);
printf("Using interface \"%s\" with type %#lx \n", ifName, ether_type);
if (geteuid() != 0)
{
perror("You must be root to run this program.");
return -1;
}
struct ether_header *eh = (struct ether_header *)buf;
struct iphdr *iph = (struct iphdr *)(buf + sizeof(struct ether_header));
struct udphdr *udph = (struct udphdr *)(buf + sizeof(struct iphdr) + sizeof(struct ether_header));
memset(&if_ip, 0, sizeof(struct ifreq));
if ((sockfd = socket(PF_PACKET, SOCK_RAW, htons(ETHER_TYPE))) == -1)
{
perror("Error creating socket");
return -1;
}
strncpy(ifopts.ifr_name, ifName, IFNAMSIZ - 1);
ioctl(sockfd, SIOCGIFFLAGS, &ifopts);
ifopts.ifr_flags |= IFF_PROMISC;
ioctl(sockfd, SIOCSIFFLAGS, &ifopts);
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof sockopt) == -1)
{
perror("setsockopt failed");
close(sockfd);
exit(EXIT_FAILURE);
}
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, ifName, IFNAMSIZ - 1) == -1)
{
perror("Failed to bind socket to device");
close(sockfd);
exit(EXIT_FAILURE);
}
repeat:
printf("Waiting to recvfrom... ");
numbytes = recvfrom(sockfd, buf, BUF_SIZ, 0, NULL, NULL);
printf("got packet %lu bytes\n", numbytes);
if (eh->ether_dhost[0] == 0 && eh->ether_dhost[1] == 0 && eh->ether_dhost[2] == 0 && eh->ether_dhost[3] == 0 && eh->ether_dhost[4] == 0 && eh->ether_dhost[5] == 0)
printf("MAC <: %x:%x:%x:%x:%x:%x\n", eh->ether_dhost[0], eh->ether_dhost[1], eh->ether_dhost[2], eh->ether_dhost[3], eh->ether_dhost[4], eh->ether_dhost[5]);
else
{
printf("MAC X: %x:%x:%x:%x:%x:%x\n", eh->ether_dhost[0], eh->ether_dhost[1], eh->ether_dhost[2], eh->ether_dhost[3], eh->ether_dhost[4], eh->ether_dhost[5]);
ret = -1;
goto done;
}
((struct sockaddr_in *)&their_addr)->sin_addr.s_addr = iph->saddr;
inet_ntop(AF_INET, &((struct sockaddr_in *)&their_addr)->sin_addr, sender, sizeof sender);
strncpy(if_ip.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFADDR, &if_ip) >= 0)
{
printf("Source IP: %s My IP: %s\n", sender, inet_ntoa(((struct sockaddr_in *)&if_ip.ifr_addr)->sin_addr));
if (strcmp(sender, inet_ntoa(((struct sockaddr_in *)&if_ip.ifr_addr)->sin_addr)) == 0)
{
ret = -1;
goto done;
}
}
ret = ntohs(udph->len) - sizeof(struct udphdr);
done:
goto repeat;
close(sockfd);
return ret;
}

7
tools/grub.cfg Normal file
View File

@ -0,0 +1,7 @@
set default=0
set timeout=0
menuentry "Fennix" {
multiboot2 /kernel.fsys
boot
}

11
tools/limine.cfg Normal file
View File

@ -0,0 +1,11 @@
TIMEOUT=0
INTERFACE_BRANDING=Fennix
:Fennix (Limine)
# DO NOT EDIT!
COMMENT=Boot Fennix using Limine protocol
RESOLUTION=1280x720
PROTOCOL=limine
KERNEL_CMDLINE=debug
KERNEL_PATH=boot:///kernel.fsys
MODULE_PATH=boot:///initrd.tar.gz

2
tools/lynx.cfg Normal file
View File

@ -0,0 +1,2 @@
CMDLINE=debug
INITRD=initrd.tar.gz

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

293
tools/website/css/style.css Normal file
View File

@ -0,0 +1,293 @@
html {
scroll-behavior: smooth;
}
body {
background-color: #000;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
font-family: 'Open Sans', sans-serif;
z-index: -1;
margin: 0;
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
background: rgb(40, 40, 40);
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
.on-background-text {
color: #f2f2f2;
}
.move-to-middle {
text-align: center;
}
.move-to-left {
text-align: left;
}
.move-to-right {
text-align: right;
}
.navbar {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(15, 15, 15, 0.8);
position: sticky;
top: 0;
z-index: 101;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.navbar a:hover {
background-color: rgb(80, 0, 100, 0.5);
}
.navbar a.active {
background-color: rgb(100, 0, 180, 0.5);
}
.navbar a.active_f {
background-color: rgb(100, 0, 180, 0.5);
}
.navbar .icon {
display: none;
}
.content-buttons {
background-color: rgb(20, 20, 20);
}
.button {
background-color: rgb(100, 0, 180, 0.5);
/* #964caf; */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
.button:hover {
background-color: rgb(80, 0, 100, 0.5);
/* #872ea5; */
color: white;
}
.header {
background-color: rgb(15, 15, 15, 0.8);
color: #f2f2f2;
text-align: center;
padding: 5px;
font-size: 35px;
position: sticky;
top: 0;
z-index: 100;
backdrop-filter: blur(5px);
}
footer {
text-align: center;
background-color: rgb(15, 15, 15, 0.8);
color: white;
overflow: hidden;
position: fixed;
bottom: 0;
width: 100%;
z-index: 104;
backdrop-filter: blur(5px);
}
.round-border-low {
border-radius: 2px;
}
.round-border-med {
border-radius: 6px;
}
.round-border-high {
border-radius: 16px;
}
.panel {
background: rgb(40, 40, 40, .8);
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.80);
overflow: hidden;
backdrop-filter: blur(5px);
}
#backToTopBtn {
backdrop-filter: blur(5px);
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 105;
border: none;
outline: none;
background-color: rgb(100, 0, 180, 0.5);
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
font-size: 18px;
}
#backToTopBtn:hover {
background-color: rgb(80, 0, 100, 0.5);
}
.stroketext {
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}
.parallax {
min-height: 1000px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.wrapper {
background: rgb(255, 255, 255);
padding: 50px;
text-align: center;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.wrapper .icon {
position: relative;
background-color: #ffffff;
border-radius: 50%;
margin: 40px;
width: 100px;
height: 100px;
line-height: 50px;
font-size: 80px;
display: inline-block;
align-items: center;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
color: #333;
text-decoration: none;
}
.wrapper .tooltip {
position: absolute;
top: 0;
line-height: 1.5;
font-size: 14px;
background-color: #ffffff;
color: #ffffff;
padding: 5px 8px;
border-radius: 5px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
opacity: 0;
pointer-events: none;
transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.wrapper .tooltip::before {
position: absolute;
content: "";
height: 8px;
width: 8px;
background-color: #ffffff;
bottom: -3px;
left: 50%;
transform: translate(-50%) rotate(45deg);
transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.wrapper .icon:hover .tooltip {
top: -45px;
opacity: 1;
visibility: visible;
pointer-events: auto;
}
.wrapper .icon:hover span,
.wrapper .icon:hover .tooltip {
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1);
}
.wrapper .whatsapp:hover,
.wrapper .whatsapp:hover .tooltip,
.wrapper .whatsapp:hover .tooltip::before {
background-color: #25D366;
color: #ffffff;
}
.wrapper .twitter:hover,
.wrapper .twitter:hover .tooltip,
.wrapper .twitter:hover .tooltip::before {
background-color: #46c1f6;
color: #ffffff;
}
.wrapper .instagram:hover,
.wrapper .instagram:hover .tooltip,
.wrapper .instagram:hover .tooltip::before {
background-color: #e1306c;
color: #ffffff;
}
.wrapper .github:hover,
.wrapper .github:hover .tooltip,
.wrapper .github:hover .tooltip::before {
background-color: #333333;
color: #ffffff;
}
.wrapper .youtube:hover,
.wrapper .youtube:hover .tooltip,
.wrapper .youtube:hover .tooltip::before {
background-color: #de463b;
color: #ffffff;
}
.gradienttext {
color: #eee;
text-transform: capitalize;
background: linear-gradient(-45deg, #09f1b8, #00a2ff, #920077, #fed90f);
background-size: 100% 100%;
-webkit-background-clip: text;
-webkit-text-stroke: 10px transparent;
}

150
tools/website/index.html Normal file
View File

@ -0,0 +1,150 @@
<html>
<head>
<title>Fennix Project</title>
<link rel="stylesheet" href="css/style.css">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css'>
<link rel="icon" href="assets/favicon.png">
</head>
<body ondragstart="return false;" ondrop="return false;">
<div class="navbar round-border-low" style="backdrop-filter: blur(5px);">
<li style="float:left"><a class="active_f blur" href="/">Fennix Project</a></li>
<a href="/full_documentations"><i class="fa-solid fa-book-bookmark"></i> Full Documentation</a>
<a href="/headers_documentations"><i class="fa-solid fa-file-code"></i> Kernel API</a>
<a href="https://github.com/EnderIce2/FennixProject"><i class="fa-brands fa-git-alt"></i> Contribute</a>
<a style="float:right" href="https://github.com/EnderIce2/FennixProject/releases/latest"><i class="fa-solid fa-download"></i> Download</a>
</div>
<div class="header" style="background-image: url(assets/Background.png); background-size: cover; background-position: center center;">
<br><br><br><br><br><br>
<h1 class="on-background-text move-to-middle gradienttext">Fennix Project</h1>
<h4 class="on-background-text move-to-middle">Operating System from scratch made in C and C++</h4>
<button class="button round-border-med" style="backdrop-filter: blur(5px); cursor: pointer;" onclick="window.location.href='https://github.com/EnderIce2/FennixProject/releases'">Download Stable Version</button>
<button class="button round-border-med" style="backdrop-filter: blur(5px); cursor: pointer;" onclick="window.location.href='https://github.com/EnderIce2/FennixProject/actions/workflows/makefile.yml'">Download Unstable Version</button>
<br><br><br><br><br><br><br><br><br>
</div>
<div class="header" style="padding-bottom: 250px;">
<div style="padding-top: 40px;">
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/EnderIce2/FennixProject/Build%20OS?style=for-the-badge" onclick="window.location.href='https://github.com/EnderIce2/FennixProject/actions/workflows/makefile.yml'">
<img alt="GitHub" src="https://img.shields.io/github/license/EnderIce2/FennixProject?style=for-the-badge">
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/EnderIce2/FennixProject?style=for-the-badge">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/EnderIce2/FennixProject?label=Repo%20Stars&style=for-the-badge">
</div>
<h1>About</h1>
<table style="float: right;">
<tbody>
<tr>
<th>
<iframe src="https://discord.com/widget?id=887406812612157451&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
</th>
</tr>
</tbody>
</table>
<div>
Hello!<br>
This is my Operating System from scratch, my goal is to make a fully functional Operating System with a GUI and a lot of features.<br>
I'm working on this project alone, but I'm open to any kind of help, if you want to help me, you can contribute to the project on GitHub.<br>
I have a Discord server too &#8594<br>
</div>
</div>
<div class="header" style="padding-top: 5px; padding-bottom: 450px;">
<h1>Compiling Instructions</h1>
<div style="text-align: left; margin-left: 10px; margin-right: 10px;">
<h2>Requirements</h2>
First of all, you need to install the required packages to build the cross-compiler, bootloader, OS, etc.<br>
<hr color="#292929">
<b>&#x2022; Ubuntu 22.04</b><br>
For cross-compiler:<br>
<code class="panel">sudo apt install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libzstd-dev libisl-dev autoconf m4 automake gettext gperf dejagnu guile-3.0 guile-3.0-dev expect tcl autogen tex-common sphinx-common git ssh diffutils patch</code><br>
For bootloader:<br>
<code class="panel">sudo apt-get install make gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 mingw-w64</code><br>
For QEMU you'll have to follow this page <a href="https://wiki.qemu.org/Hosts/Linux" target="_blank">here</a><br>
For OS:<br>
<code class="panel">sudo apt-get install xorriso mtools genisoimage ovmf nasm doxygen</code><br>
</div>
<div style="text-align: left; margin-left: 10px; margin-right: 10px;">
<h2>Building The Cross-Compiler</h2>
The cross-compiler is used to compile the OS, the bootloader and the kernel.<br>
<hr color="#292929">
All you have to do is to write this command in the terminal:<br>
<code class="panel">make tools</code><br>
You'll have to wait a while, but when it's done, you can jump to the next step.<br>
</div>
<div style="text-align: left; margin-left: 10px; margin-right: 10px;">
<h2>Configuring your kernel</h2>
If you want to build different architecture, use other QEMU binary or change kernel name you can find in <code class="panel">Makefile.conf</code> file.<br>
<hr color="#292929">
<code class="panel">DEBUG</code> &#x2022; If it's set to <code class="panel">1</code>, the kernel will be compiled in debug mode.<br>
<code class="panel">OSNAME</code> &#x2022; The name of the kernel. This can be anything.<br>
<code class="panel">OSARCH</code> &#x2022; The architecture of the kernel. Supported values are: <code class="panel">amd64</code> <code class="panel">i686</code> <code class="panel">aarch64</code>.<br>
<code class="panel">KERNEL_VERSION</code> &#x2022; The version of the kernel. This can be anything.<br>
<code class="panel">BOOTLOADER</code> &#x2022; The bootloader to be used. If set to <code class="panel">other</code>, the bootloader will be <a href="https://github.com/limine-bootloader/limine" target="_blank">Limine</a> for 64-bit,
or with <a href="https://www.gnu.org/software/grub/" target="_blank">GRUB</a> if 32-bit. <code class="panel">lynx</code> it's still under development.<br>
<code class="panel">COMPILER_PATH</code> &#x2022; The path of the cross compiler. If you want to use your own cross compiler, change it to the path of the compiler.<br>
<code class="panel">LIMINE_FOLDER</code> &#x2022; The path of the Limine bootloader.<br>
<code class="panel">QEMU_PATH</code> &#x2022; Qemu path. If you want to use the one you have installed in your system, change it to /usr/bin/qemu-system- (do not include x86_64 or i386, it will be added automatically)<br>
<code class="panel">UNIT_TESTS</code> &#x2022; Enable unit testing.<br>
That's all you can change in this file.<br>
</div>
<div style="text-align: left; margin-left: 10px; margin-right: 10px;">
<h2>Building The Operating System</h2>
The fun part!<br>
<hr color="#292929">
Now that you have the cross-compiler, you can build the OS.<br>
There are a few commands that you can use to compile the OS:<br>
<code class="panel">make build</code> &#x2022; Builds the entire OS and creates an ISO image.<br>
<code class="panel">make run</code> &#x2022; Same as <code class="panel">make build</code> but runs the QEMU too.<br>
<code class="panel">make clean</code> &#x2022; Clean all files (object files, ISO, etc...).<br>
<code class="panel">make doxygen</code> &#x2022; Generate the documentation in directory <code class="panel">doxygen-doc</code>.<br>
</div>
<h1 style="padding-top: 50px;">Running With Other Virtual Machines</h1>
<hr color="#292929">
<div style="text-align: left; margin-left: 10px; margin-right: 10px;">
&#x2022; On VirtualBox and VMware, you can use the ISO image to run the OS.<br>
&#x2022; HDD/SSD are not required.<br>
&#x2022; The minimum RAM required is 4G. You can run with lower memory, but sometimes can cause issues (I don't know why).<br>
&#x2022; UEFI required. BIOS sometimes doesn't work properly.<br>
&#x2022; Serial Port (COM1) is recommended.<br>
</div>
<h1 style="padding-top: 50px;">Reporting Issues</h1>
<hr color="#292929">
<div style="text-align: left; margin-left: 10px; margin-right: 10px;">
You can report bugs or crash issues to <a href="https://github.com/EnderIce2/FennixProject/issues/new?assignees=&labels=bug&template=bug_report.md&title=">Issues tab</a>.<br>
</div>
</div>
<button onclick="topScript()" id="backToTopBtn">Up</button>
<footer class="blur round-border-low">
<p>© EnderIce2 <span id="year"></span></p>
<script src="js/script.js"></script>
<script>
document.getElementById("year").innerHTML = new Date().getFullYear();
topButton = document.getElementById("backToTopBtn");
window.onscroll = function () { scrollToTop() };
function scrollToTop() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
topButton.style.display = "block";
} else {
topButton.style.display = "none";
}
}
function topScript() {
window.scroll({
top: 0,
behavior: 'smooth'
});
}
</script>
</footer>
</body>
</html>

View File

@ -0,0 +1,9 @@
if (document.addEventListener) {
document.addEventListener('contextmenu', function (e) {
e.preventDefault();
}, false);
} else {
document.attachEvent('oncontextmenu', function () {
window.event.returnValue = false;
});
}