summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-04-29 15:01:06 +0000
committerAmlal <amlalelmahrouss@icloud.com>2024-04-29 15:01:06 +0000
commita06c8a375f0c5f5e3613e9fe8228cebf442731ba (patch)
tree84b30c251e1b444873f4723ecab047689526e9f0 /Private/NewBoot/Source
parent14f10cc0b35155ddb19ec9069ebb884246e61dcf (diff)
parenta21859d722597e4eb1216a4a48d08d8f2659b514 (diff)
Merged in MHR-18 (pull request #9)
MHR-18
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootMain.cxx52
-rw-r--r--Private/NewBoot/Source/makefile2
2 files changed, 6 insertions, 48 deletions
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
index 2939c182..96999df8 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
@@ -168,61 +168,19 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
if (!diskFormatter.IsPartitionValid()) {
BDiskFormatFactory<BootDeviceATA>::BFileDescriptor rootDesc{0};
- memcpy(rootDesc.fFileName, "/", strlen("/"));
- memcpy(rootDesc.fForkName, kNewFSResourceFork, strlen(kNewFSResourceFork));
+ CopyMem(rootDesc.fFileName, "/", StrLen("/"));
+ CopyMem(rootDesc.fForkName, kNewFSResourceFork, StrLen(kNewFSResourceFork));
rootDesc.fBlobSz = BootDeviceATA::kSectorSize;
rootDesc.fBlob = new Char[rootDesc.fBlobSz];
- rootDesc.fParent = &rootDesc;
- memset(rootDesc.fBlob, 0, rootDesc.fBlobSz);
-
- memcpy(rootDesc.fBlob, kMachineModel " startup disk.",
+ SetMem(rootDesc.fBlob, 0, rootDesc.fBlobSz);
+ CopyMem(rootDesc.fBlob, kMachineModel " startup disk.",
strlen(kMachineModel " startup disk."));
rootDesc.fKind = kNewFSCatalogKindDir;
- BDiskFormatFactory<BootDeviceATA>::BFileDescriptor bootDesc{0};
-
- bootDesc.fKind = kNewFSCatalogKindDir;
-
- memcpy(bootDesc.fFileName, "/Boot", strlen("/Boot"));
- memcpy(bootDesc.fForkName, kNewFSResourceFork, strlen(kNewFSResourceFork));
-
- bootDesc.fBlobSz = BootDeviceATA::kSectorSize;
- bootDesc.fBlob = new Char[bootDesc.fBlobSz];
- bootDesc.fParent = &rootDesc;
-
- memset(bootDesc.fBlob, 0, bootDesc.fBlobSz);
-
- memcpy(bootDesc.fBlob, kMachineModel " startup folder.",
- strlen(kMachineModel " startup folder."));
-
- rootDesc.fNext = &bootDesc;
- rootDesc.fNext->fPrev = nullptr;
-
- BDiskFormatFactory<BootDeviceATA>::BFileDescriptor appDesc{0};
-
- appDesc.fKind = kNewFSCatalogKindDir;
-
- memcpy(appDesc.fFileName, "/Applications", strlen("/Applications"));
- memcpy(appDesc.fForkName, kNewFSResourceFork, strlen(kNewFSResourceFork));
-
- appDesc.fBlobSz = BootDeviceATA::kSectorSize;
- appDesc.fBlob = new Char[appDesc.fBlobSz];
- appDesc.fParent = &rootDesc;
-
- memset(appDesc.fBlob, 0, appDesc.fBlobSz);
-
- memcpy(appDesc.fBlob, kMachineModel " applications folder.",
- strlen(kMachineModel " applications folder."));
-
- appDesc.fNext = nullptr;
- appDesc.fNext->fPrev = &bootDesc;
-
- bootDesc.fNext = &appDesc;
-
- diskFormatter.Format(kMachineModel, &rootDesc, 3);
+ diskFormatter.Format(kMachineModel, &rootDesc, 1);
}
EFI::ExitBootServices(*MapKey, ImageHandle);
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 9f70d903..9018623f 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -75,7 +75,7 @@ run-efi-amd64:
.PHONY: epm-img
epm-img:
- qemu-img create -f raw $(IMG) 512M
+ qemu-img create -f raw $(IMG) 1G
qemu-img create -f raw $(IMG_2) 512M
.PHONY: download-edk