diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/tools/diutil/.keep (renamed from public/tools/make_fs/.keep) | 0 | ||||
| -rw-r--r-- | public/tools/diutil/CommandLine.cc (renamed from public/tools/make_fs/CommandLine.cc) | 20 | ||||
| -rw-r--r-- | public/tools/diutil/dist/.keep (renamed from public/tools/make_fs/dist/.keep) | 0 | ||||
| -rw-r--r-- | public/tools/diutil/diutil.json (renamed from public/tools/make_fs/make_fs.json) | 2 |
4 files changed, 14 insertions, 8 deletions
diff --git a/public/tools/make_fs/.keep b/public/tools/diutil/.keep index e69de29b..e69de29b 100644 --- a/public/tools/make_fs/.keep +++ b/public/tools/diutil/.keep diff --git a/public/tools/make_fs/CommandLine.cc b/public/tools/diutil/CommandLine.cc index f3ea3f18..973a1fc5 100644 --- a/public/tools/make_fs/CommandLine.cc +++ b/public/tools/diutil/CommandLine.cc @@ -7,6 +7,7 @@ ------------------------------------------- */ +#include "NewKit/Defines.h" #include <string> #include <iostream> #include <fstream> @@ -35,7 +36,7 @@ int main(int argc, char** argv) kOutDisk = argv[arg + 1]; } } - else if (arg_s == "--disk-size") + else if (arg_s == "--disk-output-size") { if ((arg + 1) < argc) { @@ -49,7 +50,7 @@ int main(int argc, char** argv) kDiskSectorSz = strtol(argv[arg + 1], nullptr, 10); } } - else if (arg_s == "--disk-name") + else if (arg_s == "--disk-part-name") { if ((arg + 1) < argc) { @@ -58,7 +59,7 @@ int main(int argc, char** argv) } } - std::cout << "make_fs: EPM Image Creator.\n"; + std::cout << "diutil: EPM Disk Tool.\n"; struct ::EPM_PART_BLOCK block { @@ -69,7 +70,7 @@ int main(int argc, char** argv) block.SectorSz = kDiskSectorSz; block.Version = kEPMRevisionBcd; block.LbaStart = sizeof(struct ::EPM_PART_BLOCK); - block.LbaEnd = 0; + block.LbaEnd = kDiskSz - sizeof(struct ::EPM_PART_BLOCK); block.FsVersion = kNeFSVersionInteger; ::memcpy(block.Name, kDiskName.c_str(), strlen(kDiskName.c_str())); @@ -77,11 +78,18 @@ int main(int argc, char** argv) ::uuid_generate_random((NeOS::UInt8*)&block.Guid); + uuid_string_t str; + + ::uuid_unparse((NeOS::UInt8*)&block.Guid, str); + + std::cout << "diutil: Partition UUID: " << str << std::endl; + std::ofstream output_epm(kOutDisk); output_epm.write((NeOS::Char*)&block, sizeof(struct ::EPM_PART_BLOCK)); struct ::NEFS_ROOT_PARTITION_BLOCK rpb { + 0 }; ::memcpy(rpb.PartitionName, kDiskName.c_str(), strlen(kDiskName.c_str())); @@ -104,14 +112,12 @@ int main(int argc, char** argv) 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"; + std::cout << "diutil: EPM Disk 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/diutil/dist/.keep index e69de29b..e69de29b 100644 --- a/public/tools/make_fs/dist/.keep +++ b/public/tools/diutil/dist/.keep diff --git a/public/tools/make_fs/make_fs.json b/public/tools/diutil/diutil.json index 584cf3c3..6c917bd2 100644 --- a/public/tools/make_fs/make_fs.json +++ b/public/tools/diutil/diutil.json @@ -3,7 +3,7 @@ "compiler_std": "c++20", "headers_path": ["./", "../../../dev/Kernel", "../../../dev/"], "sources_path": ["CommandLine.cc"], - "output_name": "./dist/make_fs", + "output_name": "./dist/diutil", "cpp_macros": [ "kMKFSVersion=0x0100", "kMKFSVersionHighest=0x0100", |
