diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-11 09:56:32 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-11 09:57:30 +0200 |
| commit | 5c0193ded6fee59fc37987515d58c8111c5af4f5 (patch) | |
| tree | 24123dc5c72ecb8503be9cd9429faaebd82585e5 | |
| parent | 6c99ee6e9c0b64ad9b9c5e3bc039800b1631a315 (diff) | |
refactor!: Refactor the `ONet` protocol to include a version field.
and a updated magic string.
feat: Add validation for `Version` field inside `net.efi`.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | dev/boot/modules/BootNet/BootNet.cc | 5 | ||||
| -rw-r--r-- | dev/kernel/FirmwareKit/CoreBoot/BootNet.h | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc index c91460cb..d4f8c1fc 100644 --- a/dev/boot/modules/BootNet/BootNet.cc +++ b/dev/boot/modules/BootNet/BootNet.cc @@ -44,6 +44,11 @@ EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) { return kEfiFail; } + if (inet_out->Version != kBootNetVersion) { + writer.Write("BootNet: The version clashes, not good.\r"); + return kEfiFail; + } + if (!inet_out->ImpliesProgram) { Boot::BootThread thread(inet_out->Data); diff --git a/dev/kernel/FirmwareKit/CoreBoot/BootNet.h b/dev/kernel/FirmwareKit/CoreBoot/BootNet.h index b05f382e..c42c98db 100644 --- a/dev/kernel/FirmwareKit/CoreBoot/BootNet.h +++ b/dev/kernel/FirmwareKit/CoreBoot/BootNet.h @@ -8,9 +8,9 @@ #include <NeKit/Defines.h> -#define kBootNetINetMagic "NETB" +#define kBootNetINetMagic "ONET" #define kBootNetINetMagicLength (4) - +#define kBootNetVersion (0x001) #define kBootNetNameLen (256U) /// @brief Netboot Internet Header @@ -18,11 +18,11 @@ /// sent (if m_preflight = 0) /// @note Can be used to patch ROMs too (if ImpliesProgram = 1) typedef struct BOOTNET_INTERNET_HEADER { - Kernel::Char NB1; /// magic char 1 'N' - Kernel::Char NB2; /// magic char 2 'E' - Kernel::Char NB3; /// magic char 3 'T' - Kernel::Char NB4; /// magic char 4 'B' - + Kernel::Char NB1; /// magic char 1 'O' + Kernel::Char NB2; /// magic char 2 'N' + Kernel::Char NB3; /// magic char 3 'E' + Kernel::Char NB4; /// magic char 4 'T' + Kernel::UInt16 Version; Kernel::Char Name[kBootNetNameLen]; /// example: Modjo Kernel::Int32 Length; /// the patch length. Kernel::Char Target[kBootNetNameLen]; /// the target file. |
