summaryrefslogtreecommitdiffhomepage
path: root/dev/Boot/Mod/NetBoot/NetBoot.cc
blob: 2d924333fb16446117ad4016627993bf723a765c (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
/*
 *	========================================================
 *
 *	NetBoot
 * 	Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved., all rights reserved.
 *
 * 	========================================================
 */

#include <Mod/NetBoot/NetBoot.h>
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>

EXTERN_C Int32 ModuleMain(NeOS::HEL::BootInfoHeader* handover)
{
	NetBootInternetHeader inet{};

	/// TODO: Read Packet from localhost

	if (inet.PatchLength < 0)
	{
		Boot::BTextWriter writer;
		writer.Write("NetBootLauncher: No Patch attached to packet.\r");

		return kEfiFail;
	}
	else if (inet.Preflight)
	{
		Boot::BTextWriter writer;
		writer.Write("NetBootLauncher: Preflight over preflight response.\r");

		return kEfiFail;
	}
	else if (inet.EEPROM)
	{
		Boot::BTextWriter writer;
		writer.Write("NetBootLauncher: EEPROM flash not available for now.\r");

		return kEfiFail;
	}

	Boot::BootThread thread(inet.Data);

	if (thread.IsValid())
		return thread.Start(handover, YES);

	return kEfiFail;
}