blob: 8ee0892991c9b07e27305041141d85c2c47abace (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* ========================================================
*
* BootNet
* Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
*
* ========================================================
*/
#include <modules/BootNet/BootNet.h>
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
STATIC EfiGUID kEfiIP4ProtoGUID = {};
STATIC Void bootnet_read_udp_packet(BOOTNET_INTERNET_HEADER&);
EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover)
{
BOOTNET_INTERNET_HEADER inet{};
memset(&inet, 0, sizeof(BOOTNET_INTERNET_HEADER));
bootnet_read_udp_packet(inet);
/// TODO: Read address from JSON file 'bootnet.json'
if (inet.Length < 1)
{
Boot::BootTextWriter writer;
writer.Write("BootNet: No executable attached to the packet, aborting.\r");
return kEfiFail;
}
if (!inet.ImpliesProgram)
{
Boot::BootThread thread(inet.Data);
if (thread.IsValid())
return thread.Start(handover, YES);
return kEfiFail;
}
else
{
Boot::BootTextWriter writer;
writer.Write("BootNetLauncher: 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;
}
STATIC Void bootnet_read_udp_packet(BOOTNET_INTERNET_HEADER&)
{
}
|