From fd288fed29eff48503abf842676085701e04c38d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 31 Mar 2025 22:02:54 +0200 Subject: firmware/netboot: final refactors regarding netboot. Signed-off-by: Amlal El Mahrouss --- dev/boot/modules/BootNet/BootNet.cc | 4 ++-- dev/boot/modules/BootNet/BootNet.h | 10 +++++----- dev/boot/modules/BootNet/amd64.json | 6 +++--- dev/kernel/FirmwareKit/CoreBoot/BootNet.h | 30 ++++++++++++++++++++++++++++++ dev/kernel/FirmwareKit/CoreBoot/NetBoot.h | 25 ------------------------- 5 files changed, 40 insertions(+), 35 deletions(-) create mode 100644 dev/kernel/FirmwareKit/CoreBoot/BootNet.h delete mode 100644 dev/kernel/FirmwareKit/CoreBoot/NetBoot.h (limited to 'dev') diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc index e6c3d3e4..1129ef30 100644 --- a/dev/boot/modules/BootNet/BootNet.cc +++ b/dev/boot/modules/BootNet/BootNet.cc @@ -22,7 +22,7 @@ EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover) if (inet.Length < 1) { Boot::BootTextWriter writer; - writer.Write("NetBootLauncher: No executable attached to the packet, aborting.\r"); + writer.Write("BootNetLauncher: No executable attached to the packet, aborting.\r"); return kEfiFail; } @@ -39,7 +39,7 @@ EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover) else { Boot::BootTextWriter writer; - writer.Write("NetBootLauncher: EEPROM flash is not available as of right now.\r"); + writer.Write("BootNetLauncher: EEPROM flash is not available as of right now.\r"); /// TODO: Program new firmware to EEPROM (if crc and size matches) diff --git a/dev/boot/modules/BootNet/BootNet.h b/dev/boot/modules/BootNet/BootNet.h index 992cc7c3..2bf330df 100644 --- a/dev/boot/modules/BootNet/BootNet.h +++ b/dev/boot/modules/BootNet/BootNet.h @@ -11,10 +11,10 @@ #include -#define kNetBootINetMagic "NETB" -#define kNetBootINetMagicLength (4) +#define kBootNetINetMagic "NETB" +#define kBootNetINetMagicLength (4) -#define kNetBootNameLen (256U) +#define kBootNetNameLen (256U) /// @brief the internet header is used to download updates OTA. typedef struct BOOTNET_INTERNET_HEADER @@ -24,9 +24,9 @@ typedef struct BOOTNET_INTERNET_HEADER Kernel::Char NB3; /// magic char 3 'T' Kernel::Char NB4; /// magic char 4 'B' - Kernel::Char Name[kNetBootNameLen]; /// example: Modjo + Kernel::Char Name[kBootNetNameLen]; /// example: Modjo Kernel::Int32 Length; /// the patch length. - Kernel::Char Target[kNetBootNameLen]; /// the target file. + Kernel::Char Target[kBootNetNameLen]; /// the target file. Kernel::Boolean ImpliesEEPROM : 1; /// does it imply an EEPROM reprogram? Kernel::Boolean Preflight : 1; /// is it a preflight packet. Kernel::Char Data[]; /// non preflight packet has a patch blob for a **PatchTarget** diff --git a/dev/boot/modules/BootNet/amd64.json b/dev/boot/modules/BootNet/amd64.json index 664c617f..112cf9f1 100644 --- a/dev/boot/modules/BootNet/amd64.json +++ b/dev/boot/modules/BootNet/amd64.json @@ -17,8 +17,8 @@ "__BOOTZ__", "__BOOTZ_STANDALONE__", "__NE_AMD64__", - "kNetBootVersionHighest=0x0100", - "kNetBootVersionLowest=0x0100", - "kNetBootVersion=0x0100" + "kBootNetVersionHighest=0x0100", + "kBootNetVersionLowest=0x0100", + "kBootNetVersion=0x0100" ] } diff --git a/dev/kernel/FirmwareKit/CoreBoot/BootNet.h b/dev/kernel/FirmwareKit/CoreBoot/BootNet.h new file mode 100644 index 00000000..a86ea81a --- /dev/null +++ b/dev/kernel/FirmwareKit/CoreBoot/BootNet.h @@ -0,0 +1,30 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include + +#define kBootNetINetMagic "NETB" +#define kBootNetINetMagicLength (4) + +#define kBootNetNameLen (256U) + +/// @brief the internet header is used to download updates OTA. +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 Name[kBootNetNameLen]; /// example: Modjo + Kernel::Int32 Length; /// the patch length. + Kernel::Char Target[kBootNetNameLen]; /// the target file. + Kernel::Boolean ImpliesEEPROM : 1; /// does it imply an EEPROM reprogram? + Kernel::Boolean Preflight : 1; /// is it a preflight packet. + Kernel::Char Data[]; /// non preflight packet has a patch blob for a **PatchTarget** +} ATTRIBUTE(packed) BOOTNET_INTERNET_HEADER; diff --git a/dev/kernel/FirmwareKit/CoreBoot/NetBoot.h b/dev/kernel/FirmwareKit/CoreBoot/NetBoot.h deleted file mode 100644 index b1e9313c..00000000 --- a/dev/kernel/FirmwareKit/CoreBoot/NetBoot.h +++ /dev/null @@ -1,25 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. - -------------------------------------------- */ - -#pragma once - -#include - -/// @brief the internet header is used to download updates OTA. -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 PatchName[256U]; /// example: ColdChoco - Kernel::Int32 PatchLength; /// the patch length. - Kernel::Char PatchTarget[256U]; /// the target file. - Kernel::Boolean ImpliesROM; /// does it imply an EEPROM reprogram? - Kernel::Boolean Preflight; /// is it a preflight packet. - Kernel::Char Patch[]; /// non preflight packet has a patch blob for a **PatchTarget** -} BOOTNET_INTERNET_HEADER; -- cgit v1.2.3