summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-29 10:12:36 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-29 10:12:36 +0200
commit461fe537aa1f9533bfa5c2504cb84843b9eac501 (patch)
tree271395a293f788775c09abffdc0861dbf24af4ca /Private/NewBoot/Source
parent346558208d39a036effe3a4ec232fa5df5a3c8e7 (diff)
MHR-18: Filesystem fixes and improvements see ticket.
- Implement CreateCatalog for file creation, an implementation of RemoveCatalog is also needed. - Boot Kit only takes a single root file now. Must be ending with '/'. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootMain.cxx52
1 files changed, 5 insertions, 47 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);