From 4d192e629a07ae457134cb0063e0136e54b01008 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 9 Dec 2025 02:50:07 +0100 Subject: chore: Codebase improvements and tweaks. Signed-off-by: Amlal El Mahrouss --- src/boot/BootKit/BootKit.h | 7 ++- src/boot/BootKit/Config.h | 16 +++++++ src/boot/BootKit/Device.h | 20 ++++---- src/boot/BootKit/EPM.h | 5 +- src/boot/BootKit/HW/ATA.h | 4 +- src/boot/BootKit/HW/SATA.h | 4 +- src/boot/src/docs/KERN_VER.md | 18 ------- src/boot/src/docs/MKFS_HEFS.md | 106 ----------------------------------------- 8 files changed, 43 insertions(+), 137 deletions(-) create mode 100644 src/boot/BootKit/Config.h delete mode 100644 src/boot/src/docs/KERN_VER.md delete mode 100644 src/boot/src/docs/MKFS_HEFS.md (limited to 'src/boot') diff --git a/src/boot/BootKit/BootKit.h b/src/boot/BootKit/BootKit.h index fb8941e0..b00fd112 100644 --- a/src/boot/BootKit/BootKit.h +++ b/src/boot/BootKit/BootKit.h @@ -9,7 +9,10 @@ /// @brief Bootloader Application Programming Interface. /***********************************************************************************/ -#pragma once +#ifndef __BOOTKIT_H__ +#define __BOOTKIT_H__ + +#include #include #include @@ -333,3 +336,5 @@ inline Boolean BDiskFormatFactory::Format(const Char* part_name) { return YES; } } // namespace Boot + +#endif // __BOOTKIT_H__ \ No newline at end of file diff --git a/src/boot/BootKit/Config.h b/src/boot/BootKit/Config.h new file mode 100644 index 00000000..b2641b24 --- /dev/null +++ b/src/boot/BootKit/Config.h @@ -0,0 +1,16 @@ +/* ======================================== + + Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. + +======================================== */ + +#ifndef __BOOTKIT_CONFIG_H__ +#define __BOOTKIT_CONFIG_H__ + +#include + +namespace Boot { + using namespace Kernel; +} + +#endif // ! __BOOTKIT_CONFIG_H__ \ No newline at end of file diff --git a/src/boot/BootKit/Device.h b/src/boot/BootKit/Device.h index 36e2b3d4..efe27659 100644 --- a/src/boot/BootKit/Device.h +++ b/src/boot/BootKit/Device.h @@ -4,13 +4,15 @@ ======================================== */ -#pragma once +#ifndef __BOOTKIT_DEVICE_H__ +#define __BOOTKIT_DEVICE_H__ +#include #include #include -namespace Kernel { -/// @brief Device type. +namespace Boot { +/// @brief Physical/Virtual device type. class Device { public: explicit Device() = default; @@ -19,7 +21,7 @@ class Device { NE_MOVE_DEFAULT(Device) struct Trait { - SizeT mBase{0}; + Lba mBase{0}; SizeT mSize{0}; }; @@ -29,7 +31,9 @@ class Device { virtual Device& Write(Char* Buf, SizeT SecCount) = 0; }; -typedef Device BootDevice; -typedef Device NetworkDevice; -typedef Device DiskDevice; -} // namespace Kernel \ No newline at end of file +using BootDevice = Device; +using NetworkDevice = Device; +using DiskDevice = Device; +} // namespace Boot + +#endif \ No newline at end of file diff --git a/src/boot/BootKit/EPM.h b/src/boot/BootKit/EPM.h index cc82dd41..5657337a 100644 --- a/src/boot/BootKit/EPM.h +++ b/src/boot/BootKit/EPM.h @@ -4,6 +4,9 @@ ======================================== */ -#pragma once +#ifndef __BOOTKIT_EPM_H__ +#define __BOOTKIT_EPM_H__ #include + +#endif \ No newline at end of file diff --git a/src/boot/BootKit/HW/ATA.h b/src/boot/BootKit/HW/ATA.h index 7ebf296d..1842300b 100644 --- a/src/boot/BootKit/HW/ATA.h +++ b/src/boot/BootKit/HW/ATA.h @@ -9,8 +9,7 @@ #include #include -using namespace Kernel; - +namespace Boot { class BootDeviceATA final : public Device { public: enum { @@ -45,3 +44,4 @@ class BootDeviceATA final : public Device { private: ATATrait mTrait; }; +} // namespace Boot \ No newline at end of file diff --git a/src/boot/BootKit/HW/SATA.h b/src/boot/BootKit/HW/SATA.h index 68ed30c8..442ea399 100644 --- a/src/boot/BootKit/HW/SATA.h +++ b/src/boot/BootKit/HW/SATA.h @@ -12,6 +12,7 @@ #define kAHCISectorSz (512) +namespace Boot { class BootDeviceSATA final { public: explicit BootDeviceSATA(); @@ -23,7 +24,7 @@ class BootDeviceSATA final { Kernel::Boolean mErr{false}; Kernel::Boolean mDetected{false}; - operator bool() { return !this->mErr; } + explicit operator bool() { return !this->mErr; } }; operator bool() { return this->Leak().mDetected; } @@ -40,3 +41,4 @@ class BootDeviceSATA final { private: SATATrait mTrait; }; +} // namespace Boot \ No newline at end of file diff --git a/src/boot/src/docs/KERN_VER.md b/src/boot/src/docs/KERN_VER.md deleted file mode 100644 index c47c3d5b..00000000 --- a/src/boot/src/docs/KERN_VER.md +++ /dev/null @@ -1,18 +0,0 @@ -# `/props/kern_ver` โ€” NVRAM EFI Variable - -The `/props/kern_ver` variable is used to track NeKernel's current version in a BCD format. - -## ๐Ÿ›  Reason - -- It is also used for: - - Bug tracking and system patching. - - Version and compatibility checking. - -## ๐Ÿงช Usage - -N/A - -## ยฉ License - - Copyright (C) 2025, - Amlal El Mahrouss โ€“ Licensed under the Apache 2.0 license. \ No newline at end of file diff --git a/src/boot/src/docs/MKFS_HEFS.md b/src/boot/src/docs/MKFS_HEFS.md deleted file mode 100644 index b42ad9c2..00000000 --- a/src/boot/src/docs/MKFS_HEFS.md +++ /dev/null @@ -1,106 +0,0 @@ -# `mkfs.hefs` โ€“ OpenHeFS Filesystem Formatter - -`mkfs.hefs` is a command-line utility used to format a block device or disk image with the **High-throughput Extended File System (OpenHeFS)** used by NeKernel. This tool initializes a OpenHeFS volume by writing a boot node and configuring directory and inode index regions, block ranges, and volume metadata. - ---- - -## ๐Ÿ›  Features - -- Writes a valid `BootNode` to the specified output device or file. -- Sets disk size, sector size, and volume label. -- Supports user-defined ranges for: - - Index Node Directory (IND) - - Inodes (IN) - - Data blocks -- UTF-8 encoded volume label support. -- Fully compatible with NeKernel's VFS subsystem. - ---- - -## ๐Ÿงช Usage - - mkfs.hefs -L