summaryrefslogtreecommitdiffhomepage
path: root/public/tools/make_fs
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-09 05:09:31 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-09 05:09:31 +0100
commit5bf5213bc1f2adf5e3a9e707fb4026ded95fcc14 (patch)
treed231f32e6935f68087ca826ae1773914d925ed30 /public/tools/make_fs
parent0cb3926833080ff4933d5c625224e5527f067321 (diff)
ADD: Replace make_fs with diutil.
Diffstat (limited to 'public/tools/make_fs')
-rw-r--r--public/tools/make_fs/.keep0
-rw-r--r--public/tools/make_fs/CommandLine.cc117
-rw-r--r--public/tools/make_fs/dist/.keep0
-rw-r--r--public/tools/make_fs/make_fs.json13
4 files changed, 0 insertions, 130 deletions
diff --git a/public/tools/make_fs/.keep b/public/tools/make_fs/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/public/tools/make_fs/.keep
+++ /dev/null
diff --git a/public/tools/make_fs/CommandLine.cc b/public/tools/make_fs/CommandLine.cc
deleted file mode 100644
index f3ea3f18..00000000
--- a/public/tools/make_fs/CommandLine.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved.
-
- FILE: NeFS.h
- PURPOSE: NeFS (New extended File System) support.
-
- ------------------------------------------- */
-
-#include <string>
-#include <iostream>
-#include <fstream>
-
-#include <FirmwareKit/EPM.h>
-#include <FSKit/NeFS.h>
-#include <uuid/uuid.h>
-
-static std::string kDiskName = "Disk";
-static int kDiskSectorSz = 512;
-static const int kDiskBlockCnt = 1;
-static size_t kDiskSz = gib_cast(4);
-static std::string kOutDisk = "disk.eimg";
-
-/// @brief Filesystem tool entrypoint.
-int main(int argc, char** argv)
-{
- for (size_t arg = 0; arg < argc; ++arg)
- {
- std::string arg_s = argv[arg];
-
- if (arg_s == "--disk-output-name")
- {
- if ((arg + 1) < argc)
- {
- kOutDisk = argv[arg + 1];
- }
- }
- else if (arg_s == "--disk-size")
- {
- if ((arg + 1) < argc)
- {
- kDiskSz = strtol(argv[arg + 1], nullptr, 10);
- }
- }
- else if (arg_s == "--disk-sector-size")
- {
- if ((arg + 1) < argc)
- {
- kDiskSectorSz = strtol(argv[arg + 1], nullptr, 10);
- }
- }
- else if (arg_s == "--disk-name")
- {
- if ((arg + 1) < argc)
- {
- kDiskName = argv[arg + 1];
- }
- }
- }
-
- std::cout << "make_fs: EPM Image Creator.\n";
-
- struct ::EPM_PART_BLOCK block
- {
- 0
- };
-
- block.NumBlocks = kDiskBlockCnt;
- block.SectorSz = kDiskSectorSz;
- block.Version = kEPMRevisionBcd;
- block.LbaStart = sizeof(struct ::EPM_PART_BLOCK);
- block.LbaEnd = 0;
- block.FsVersion = kNeFSVersionInteger;
-
- ::memcpy(block.Name, kDiskName.c_str(), strlen(kDiskName.c_str()));
- ::memcpy(block.Magic, kEPMMagic86, strlen(kEPMMagic86));
-
- ::uuid_generate_random((NeOS::UInt8*)&block.Guid);
-
- std::ofstream output_epm(kOutDisk);
- output_epm.write((NeOS::Char*)&block, sizeof(struct ::EPM_PART_BLOCK));
-
- struct ::NEFS_ROOT_PARTITION_BLOCK rpb
- {
- };
-
- ::memcpy(rpb.PartitionName, kDiskName.c_str(), strlen(kDiskName.c_str()));
- ::memcpy(rpb.Ident, kNeFSIdent, strlen(kNeFSIdent));
-
- rpb.Version = kNeFSVersionInteger;
- rpb.EpmBlock = kEPMBootBlockLba;
-
- rpb.StartCatalog = kNeFSCatalogStartAddress;
- rpb.CatalogCount = 0;
-
- rpb.DiskSize = kDiskSz;
-
- rpb.SectorSize = kDiskSectorSz;
- rpb.SectorCount = rpb.DiskSize / rpb.SectorSize;
-
- rpb.FreeSectors = rpb.SectorCount;
- rpb.FreeCatalog = rpb.DiskSize / sizeof(NEFS_CATALOG_STRUCT);
-
- auto p_prev = output_epm.tellp();
-
- output_epm.seekp(kNeFSRootCatalogStartAddress);
-
- output_epm.write((NeOS::Char*)&rpb, sizeof(struct ::NEFS_ROOT_PARTITION_BLOCK));
-
- output_epm.seekp(p_prev);
-
- output_epm.close();
-
- std::cout << "make_fs: EPM Image has been written to: " << kOutDisk << "\n";
-
- return 0;
-} \ No newline at end of file
diff --git a/public/tools/make_fs/dist/.keep b/public/tools/make_fs/dist/.keep
deleted file mode 100644
index e69de29b..00000000
--- a/public/tools/make_fs/dist/.keep
+++ /dev/null
diff --git a/public/tools/make_fs/make_fs.json b/public/tools/make_fs/make_fs.json
deleted file mode 100644
index 584cf3c3..00000000
--- a/public/tools/make_fs/make_fs.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "compiler_path": "g++",
- "compiler_std": "c++20",
- "headers_path": ["./", "../../../dev/Kernel", "../../../dev/"],
- "sources_path": ["CommandLine.cc"],
- "output_name": "./dist/make_fs",
- "cpp_macros": [
- "kMKFSVersion=0x0100",
- "kMKFSVersionHighest=0x0100",
- "kMKFSVersionLowest=0x0100",
- "__NE_SDK__"
- ]
-}