diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-28 05:17:08 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-28 05:17:08 +0100 |
| commit | 9034d32c7b60dedbdbdb66f42d9b147cb2aa9a60 (patch) | |
| tree | fda5dfa8ab557954c16ce052f867679ee3dc38f4 /dev/boot/modules/BootNet | |
| parent | 4966ca284132e4e52a9bee6f582527aa7f784ef6 (diff) | |
bootz: rename NetBoot module to BootNet
Rename the NetBoot module to BootNet to avoid confusion with Apple's
NetBoot and better reflect the module's role within BootZ.
Updates include:
- Renamed module directory: NetBoot/ → BootNet/
- Renamed files and headers: NetBoot.cc → BootNet.cc, etc.
- Updated build output: netboot.sys → bootnet.sys
- Replaced all references in build scripts, source includes, and user-visible strings
- Fixed typo in SysChk.cc copyright
This unifies naming across modules and reinforces BootZ's modular identity.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/boot/modules/BootNet')
| -rw-r--r-- | dev/boot/modules/BootNet/.hgkeep | 0 | ||||
| -rw-r--r-- | dev/boot/modules/BootNet/Boot.S | 22 | ||||
| -rw-r--r-- | dev/boot/modules/BootNet/BootNet.cc | 50 | ||||
| -rw-r--r-- | dev/boot/modules/BootNet/BootNet.h | 33 | ||||
| -rw-r--r-- | dev/boot/modules/BootNet/amd64.json | 24 |
5 files changed, 129 insertions, 0 deletions
diff --git a/dev/boot/modules/BootNet/.hgkeep b/dev/boot/modules/BootNet/.hgkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/dev/boot/modules/BootNet/.hgkeep diff --git a/dev/boot/modules/BootNet/Boot.S b/dev/boot/modules/BootNet/Boot.S new file mode 100644 index 00000000..8ebfb352 --- /dev/null +++ b/dev/boot/modules/BootNet/Boot.S @@ -0,0 +1,22 @@ +;; /* +;; * ======================================================== +;; * +;; * BootZ +;; * Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. +;; * +;; * ======================================================== +;; */ + +#ifdef __NE_AMD64__ +.code64 +.intel_syntax noprefix +#endif + +#define kTypeDriver 101 +#define kArchAmd64 122 +#define kHandoverMagic 0xBADCC + +.section .ldr + +.quad kHandoverMagic +.word kTypeDriver diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc new file mode 100644 index 00000000..b4c1408f --- /dev/null +++ b/dev/boot/modules/BootNet/BootNet.cc @@ -0,0 +1,50 @@ +/* + * ======================================================== + * + * BootNet + * Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + * + * ======================================================== + */ + +#include <modules/BootNet/BootNet.h> +#include <BootKit/BootKit.h> +#include <BootKit/BootThread.h> + +EXTERN_C Int32 ModuleMain(NeOS::HEL::BootInfoHeader* handover) +{ + NETBOOT_INTERNET_HEADER inet{}; + + memset(&inet, 0, sizeof(NETBOOT_INTERNET_HEADER)); + + /// TODO: Read packet from JSON file 'bootnet.json' + + if (inet.PatchLength < 1) + { + Boot::BootTextWriter writer; + writer.Write("NetBootLauncher: No executable attached to the packet, aborting.\r"); + + return kEfiFail; + } + + if (!inet.EEPROM) + { + Boot::BootThread thread(inet.PatchData); + + if (thread.IsValid()) + return thread.Start(handover, YES); + + return kEfiFail; + } + else + { + Boot::BootTextWriter writer; + writer.Write("NetBootLauncher: EEPROM flash is not available as of right now.\r"); + + /// TODO: Program new firmware to EEPROM (if crc and size matches) + + return kEfiFail; // TODO: Add support for EEPROM firmware update. + } + + return kEfiFail; +} diff --git a/dev/boot/modules/BootNet/BootNet.h b/dev/boot/modules/BootNet/BootNet.h new file mode 100644 index 00000000..cde30658 --- /dev/null +++ b/dev/boot/modules/BootNet/BootNet.h @@ -0,0 +1,33 @@ +/* + * ======================================================== + * + * BootNet + * Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include <NewKit/Defines.h> + +#define kNetBootINetMagic "NETB" +#define kNetBootINetMagicLength (4) + +#define kNetBootNameLen (256U) + +/// @brief the internet header is used to download updates OTA. +typedef struct NETBOOT_INTERNET_HEADER +{ + NeOS::Char NB1; /// magic char 1 'N' + NeOS::Char NB2; /// magic char 2 'E' + NeOS::Char NB3; /// magic char 3 'T' + NeOS::Char NB4; /// magic char 4 'B' + + NeOS::Char PatchName[kNetBootNameLen]; /// example: Modjo + NeOS::Int32 PatchLength; /// the patch length. + NeOS::Char PatchTarget[kNetBootNameLen]; /// the target file. + NeOS::Boolean EEPROM : 1; /// does it imply an EEPROM reprogram? + NeOS::Boolean Preflight : 1; /// is it a preflight packet. + NeOS::Char PatchData[]; /// non preflight packet has a patch blob for a **PatchTarget** +} ATTRIBUTE(packed) NETBOOT_INTERNET_HEADER; diff --git a/dev/boot/modules/BootNet/amd64.json b/dev/boot/modules/BootNet/amd64.json new file mode 100644 index 00000000..95124574 --- /dev/null +++ b/dev/boot/modules/BootNet/amd64.json @@ -0,0 +1,24 @@ +{ + "compiler_path": "x86_64-w64-mingw32-g++", + "compiler_std": "c++20", + "headers_path": ["../", "../../", "../../../kernel", "../../../", "./"], + "sources_path": ["*.cc", "*.S", "../../src/HEL/AMD64/*.cc", "../../src/HEL/AMD64/*.S", "../../src/*.cc"], + "output_name": "bootnet.sys", + "compiler_flags": [ + "-nostdlib", + "-std=c++20", + "-fPIC", + "-fno-rtti", + "-fno-exceptions", + "-Wl,--subsystem=17,--image-base,0x1000000,-e,ModuleMain" + ], + "cpp_macros": [ + "__NEOSKRNL__", + "__BOOTZ__", + "__BOOTZ_STANDALONE__", + "__NE_AMD64__", + "kNetBootVersionHighest=0x0100", + "kNetBootVersionLowest=0x0100", + "kNetBootVersion=0x0100" + ] +} |
