From 461fe537aa1f9533bfa5c2504cb84843b9eac501 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 29 Apr 2024 10:12:36 +0200 Subject: 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 --- Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 52 +++------------------------ 1 file changed, 5 insertions(+), 47 deletions(-) (limited to 'Private/NewBoot/Source') 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::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::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::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); -- cgit v1.2.3