summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-18 09:18:55 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-18 09:18:55 +0200
commit95f1448a371f563071a755b9ed507cd64d70ed5b (patch)
treee728a7c260e3daa02eaf82c89ec384183be170d4
parent7bfa36c2215e13097bb5ddcb15d2a8a476102b55 (diff)
kernel, boot: improvements and tweaks on the kernel's filesystems.
- HeFS requires a 4gb disk at minimum now. - make_app fully supports STEPS. - Errata of NeFS.tex, add HeFS.tex. - Better boot flow. - New filesystems for FileMgr. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--dev/boot/modules/BootNet/BootNet.cc2
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc2
-rw-r--r--dev/boot/src/HEL/ARM64/BootEFI.cc2
-rw-r--r--dev/kernel/FSKit/Ext2.h40
-rw-r--r--dev/kernel/FSKit/HeFS.h7
-rw-r--r--dev/kernel/FirmwareKit/EFI/EFI.h30
-rw-r--r--dev/kernel/FirmwareKit/GPT.h4
-rw-r--r--dev/kernel/FirmwareKit/Handover.h16
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc13
-rw-r--r--dev/kernel/HALKit/AMD64/Processor.h14
-rw-r--r--dev/kernel/HALKit/ARM64/Processor.h2
-rw-r--r--dev/kernel/KernelKit/FileMgr.h10
-rw-r--r--dev/kernel/src/FS/Ext2+FileMgr.cc14
-rw-r--r--dev/kernel/src/FS/HeFS+FileMgr.cc14
-rw-r--r--dev/kernel/src/FS/NeFS+FileMgr.cc6
-rw-r--r--dev/user/SystemCalls.h4
-rw-r--r--docs/tex/hefs.tex32
-rw-r--r--docs/tex/nefs.tex2
-rw-r--r--public/tools/diutil/src/CommandLine.cc8
-rw-r--r--public/tools/make_app/Steps.h20
-rw-r--r--public/tools/make_app/src/CommandLine.cc48
21 files changed, 197 insertions, 93 deletions
diff --git a/dev/boot/modules/BootNet/BootNet.cc b/dev/boot/modules/BootNet/BootNet.cc
index 050148c4..92f7aa7a 100644
--- a/dev/boot/modules/BootNet/BootNet.cc
+++ b/dev/boot/modules/BootNet/BootNet.cc
@@ -12,7 +12,7 @@
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
-STATIC EfiGUID kEfiSimpleProtoGUID = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
+STATIC EfiGUID kEfiSimpleProtoGUID = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
STATIC EFI_SIMPLE_NETWORK_PROTOCOL* kEfiProtocol = nullptr;
STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER);
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 58f04491..b55cd3ef 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -226,7 +226,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle,
handover_hdr->f_Magic = kHandoverMagic;
handover_hdr->f_Version = kHandoverVersion;
- handover_hdr->f_HardwareTables.f_ImageKey = map_key;
+ handover_hdr->f_HardwareTables.f_ImageKey = map_key;
handover_hdr->f_HardwareTables.f_ImageHandle = image_handle;
// Provide fimware vendor name.
diff --git a/dev/boot/src/HEL/ARM64/BootEFI.cc b/dev/boot/src/HEL/ARM64/BootEFI.cc
index 8008d846..e071def1 100644
--- a/dev/boot/src/HEL/ARM64/BootEFI.cc
+++ b/dev/boot/src/HEL/ARM64/BootEFI.cc
@@ -81,7 +81,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle,
HEL::BootInfoHeader* handover_hdr =
new HEL::BootInfoHeader();
- UInt32 map_key = 0;
+ UInt32 map_key = 0;
#ifdef ZBA_USE_FB
if (!boot_init_fb())
diff --git a/dev/kernel/FSKit/Ext2.h b/dev/kernel/FSKit/Ext2.h
index 81b6853e..856654d6 100644
--- a/dev/kernel/FSKit/Ext2.h
+++ b/dev/kernel/FSKit/Ext2.h
@@ -6,31 +6,35 @@
#pragma once
+#include <CompilerKit/CompilerKit.h>
+#include <hint/CompilerHint.h>
+#include <KernelKit/DriveMgr.h>
#include <NewKit/Defines.h>
+#include <NewKit/KString.h>
/// @file Ext2.h
/// @brief EXT2 filesystem structures and constants.
-#define kExt2FSMagic (0xEF53)
-#define kExt2FSMaxFileNameLen (255U)
-#define kExt2FSSuperblockOffset (1024)
-#define kExt2FSRootInodeNumber (2)
+#define kExt2FSMagic (0xEF53)
+#define kExt2FSMaxFileNameLen (255U)
+#define kExt2FSSuperblockOffset (1024)
+#define kExt2FSRootInodeNumber (2)
-#define kExt2FSInodeSize (128U)
-#define kExt2FSBlockSizeBase (1024U)
+#define kExt2FSInodeSize (128U)
+#define kExt2FSBlockSizeBase (1024U)
-#define kExt2FSRev0 (0)
-#define kExt2FSRev1 (1)
+#define kExt2FSRev0 (0)
+#define kExt2FSRev1 (1)
enum
{
- kExt2FileTypeUnknown = 0,
- kExt2FileTypeRegular = 1,
- kExt2FileTypeDirectory = 2,
- kExt2FileTypeCharDevice = 3,
- kExt2FileTypeBlockDevice = 4,
- kExt2FileTypeFIFO = 5,
- kExt2FileTypeSocket = 6,
+ kExt2FileTypeUnknown = 0,
+ kExt2FileTypeRegular = 1,
+ kExt2FileTypeDirectory = 2,
+ kExt2FileTypeCharDevice = 3,
+ kExt2FileTypeBlockDevice = 4,
+ kExt2FileTypeFIFO = 5,
+ kExt2FileTypeSocket = 6,
kExt2FileTypeSymbolicLink = 7
};
@@ -91,7 +95,7 @@ struct PACKED EXT2_SUPER_BLOCK final
Kernel::UInt32 fDefaultMountOpts;
Kernel::UInt32 fFirstMetaBlockGroup;
- Kernel::UInt8 fReserved[760]; // Padding to make 1024 bytes
+ Kernel::UInt8 fReserved[760]; // Padding to make 1024 bytes
};
struct PACKED EXT2_INODE final
@@ -113,10 +117,10 @@ struct PACKED EXT2_INODE final
Kernel::UInt32 fGeneration;
Kernel::UInt32 fFileACL;
- Kernel::UInt32 fDirACL; // Only for revision 1+
+ Kernel::UInt32 fDirACL; // Only for revision 1+
Kernel::UInt32 fFragmentAddr;
- Kernel::UInt8 fOSD2[12];
+ Kernel::UInt8 fOSD2[12];
};
struct PACKED EXT2_DIR_ENTRY final
diff --git a/dev/kernel/FSKit/HeFS.h b/dev/kernel/FSKit/HeFS.h
index cf1bebfc..92f396e9 100644
--- a/dev/kernel/FSKit/HeFS.h
+++ b/dev/kernel/FSKit/HeFS.h
@@ -6,7 +6,11 @@
#pragma once
+#include <CompilerKit/CompilerKit.h>
+#include <hint/CompilerHint.h>
+#include <KernelKit/DriveMgr.h>
#include <NewKit/Defines.h>
+#include <NewKit/KString.h>
/// @file HeFS.h
/// @brief HeFS filesystem support.
@@ -18,9 +22,10 @@
#define kHeFSFileNameLen (256U)
#define kHeFSPartNameLen (256U)
-#define kHeFSMinimumDiskSize (mib_cast(256))
+#define kHeFSMinimumDiskSize (gib_cast(4))
struct HeFS_BOOT_NODE;
+struct HeFS_INDEX_NODE;
enum
{
diff --git a/dev/kernel/FirmwareKit/EFI/EFI.h b/dev/kernel/FirmwareKit/EFI/EFI.h
index 24f474d1..2772582b 100644
--- a/dev/kernel/FirmwareKit/EFI/EFI.h
+++ b/dev/kernel/FirmwareKit/EFI/EFI.h
@@ -380,25 +380,25 @@ typedef UInt8 EfiMacAddress[32];
typedef struct
{
- UInt32 State;
- UInt32 HwAddressSize;
- UInt32 MediaHeaderSize;
- UInt32 MaxPacketSize;
- UInt32 NvRamSize;
- UInt32 NvRamAccessSize;
- UInt32 ReceiveFilterMask;
- UInt32 ReceiveFilterSetting;
- UInt32 MaxMCastFilterCount;
- UInt32 MCastFilterCount;
+ UInt32 State;
+ UInt32 HwAddressSize;
+ UInt32 MediaHeaderSize;
+ UInt32 MaxPacketSize;
+ UInt32 NvRamSize;
+ UInt32 NvRamAccessSize;
+ UInt32 ReceiveFilterMask;
+ UInt32 ReceiveFilterSetting;
+ UInt32 MaxMCastFilterCount;
+ UInt32 MCastFilterCount;
EfiMacAddress MCastFilter[MAX_MCAST_FILTER_CNT];
EfiMacAddress CurrentAddress;
EfiMacAddress BroadcastAddress;
EfiMacAddress PermanentAddress;
- UInt8 IfType;
- BOOL MacAddressChangeable;
- BOOL MultipleTxSupported;
- BOOL MediaPresentSupported;
- BOOL MediaPresent;
+ UInt8 IfType;
+ BOOL MacAddressChangeable;
+ BOOL MultipleTxSupported;
+ BOOL MediaPresentSupported;
+ BOOL MediaPresent;
} EFI_SIMPLE_NETWORK_MODE;
typedef EFI_STATUS(EFIAPI* EFI_SIMPLE_NETWORK_TRANSMIT)(
diff --git a/dev/kernel/FirmwareKit/GPT.h b/dev/kernel/FirmwareKit/GPT.h
index 0515af8a..7ee5d10e 100644
--- a/dev/kernel/FirmwareKit/GPT.h
+++ b/dev/kernel/FirmwareKit/GPT.h
@@ -9,9 +9,9 @@
#include <NewKit/Defines.h>
#include <FirmwareKit/EFI/EFI.h>
-#define kSectorAlignGPT_PartTbl (420U)
+#define kSectorAlignGPT_PartTbl (420U)
#define kSectorAlignGPT_PartEntry (72U)
-#define kPartNameGPT (8U)
+#define kPartNameGPT (8U)
namespace Kernel
{
diff --git a/dev/kernel/FirmwareKit/Handover.h b/dev/kernel/FirmwareKit/Handover.h
index 4ff04e6d..3a5e9e19 100644
--- a/dev/kernel/FirmwareKit/Handover.h
+++ b/dev/kernel/FirmwareKit/Handover.h
@@ -75,11 +75,11 @@ namespace Kernel::HEL
struct
{
- VoidPtr f_SmBios;
- VoidPtr f_VendorPtr;
- VoidPtr f_MpPtr;
- Bool f_MultiProcessingEnabled;
- UInt32 f_ImageKey;
+ VoidPtr f_SmBios;
+ VoidPtr f_VendorPtr;
+ VoidPtr f_MpPtr;
+ Bool f_MultiProcessingEnabled;
+ UInt32 f_ImageKey;
EfiHandlePtr f_ImageHandle;
} f_HardwareTables;
@@ -98,9 +98,9 @@ namespace Kernel::HEL
enum
{
- kHandoverSpecificKind,
- kHandoverSpecificAttrib,
- kHandoverSpecificMemoryEfi,
+ kHandoverTableBS,
+ kHandoverTableST,
+ kHandoverTableCount,
};
/// @brief Alias of bootloader main type.
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index b716279d..1d2689eb 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -4,7 +4,6 @@
------------------------------------------- */
-#include "modules/CoreGfx/CoreGfx.h"
#include <StorageKit/AHCI.h>
#include <ArchKit/ArchKit.h>
#include <KernelKit/ProcessScheduler.h>
@@ -19,12 +18,11 @@
#include <FirmwareKit/EFI/API.h>
#include <FirmwareKit/EFI/EFI.h>
-
EXTERN_C Kernel::VoidPtr kInterruptVectorTable[];
EXTERN_C Kernel::VoidPtr mp_user_switch_proc;
EXTERN_C Kernel::Char mp_user_switch_proc_stack_begin[];
-STATIC Kernel::Void hal_init_scheduler_team()
+STATIC Kernel::Void hal_pre_init_scheduler()
{
for (Kernel::SizeT i = 0U; i < Kernel::UserProcessScheduler::The().CurrentTeam().AsArray().Count(); ++i)
{
@@ -52,8 +50,6 @@ EXTERN_C Int32 hal_init_platform(
fw_init_efi((EfiSystemTable*)handover_hdr->f_FirmwareCustomTables[1]);
Boot::ExitBootServices(handover_hdr->f_HardwareTables.f_ImageKey, handover_hdr->f_HardwareTables.f_ImageHandle);
- hal_init_scheduler_team();
-
/************************************** */
/* INITIALIZE BIT MAP. */
/************************************** */
@@ -92,6 +88,8 @@ EXTERN_C Int32 hal_init_platform(
EXTERN_C Kernel::Void hal_real_init(Kernel::Void) noexcept
{
+ hal_pre_init_scheduler();
+
Kernel::NeFS::fs_init_nefs();
Kernel::HAL::mp_init_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
@@ -103,5 +101,8 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) noexcept
idt_loader.Load(idt_reg);
- dbg_break_point();
+ while (YES)
+ {
+ ;
+ }
}
diff --git a/dev/kernel/HALKit/AMD64/Processor.h b/dev/kernel/HALKit/AMD64/Processor.h
index b813e1d9..f2e9c2ea 100644
--- a/dev/kernel/HALKit/AMD64/Processor.h
+++ b/dev/kernel/HALKit/AMD64/Processor.h
@@ -68,13 +68,13 @@ namespace Kernel::HAL
/// @brief Memory Manager mapping flags.
enum
{
- kMMFlagsInvalid = 1 << 0,
- kMMFlagsPresent = 1 << 1,
- kMMFlagsWr = 1 << 2,
- kMMFlagsUser = 1 << 3,
- kMMFlagsNX = 1 << 4,
- kMMFlagsPCD = 1 << 5,
- kMMFlagsCount = 4,
+ kMMFlagsInvalid = 1 << 0,
+ kMMFlagsPresent = 1 << 1,
+ kMMFlagsWr = 1 << 2,
+ kMMFlagsUser = 1 << 3,
+ kMMFlagsNX = 1 << 4,
+ kMMFlagsPCD = 1 << 5,
+ kMMFlagsCount = 4,
};
struct PACKED Register64 final
diff --git a/dev/kernel/HALKit/ARM64/Processor.h b/dev/kernel/HALKit/ARM64/Processor.h
index 4cead7ea..3a04bed1 100644
--- a/dev/kernel/HALKit/ARM64/Processor.h
+++ b/dev/kernel/HALKit/ARM64/Processor.h
@@ -28,7 +28,7 @@ namespace Kernel::HAL
kMMFlagsWr = 1 << 1,
kMMFlagsUser = 1 << 2,
kMMFlagsNX = 1 << 3,
- kMMFlagsPCD = 1 << 4,
+ kMMFlagsPCD = 1 << 4,
kMMFlagsCount = 4,
};
diff --git a/dev/kernel/KernelKit/FileMgr.h b/dev/kernel/KernelKit/FileMgr.h
index 03e74ee8..e5f67080 100644
--- a/dev/kernel/KernelKit/FileMgr.h
+++ b/dev/kernel/KernelKit/FileMgr.h
@@ -21,13 +21,9 @@
#ifndef INC_FILEMGR_H
#define INC_FILEMGR_H
-#ifdef __FSKIT_INCLUDES_NEFS__
-#include <FSKit/NeFS.h>
-#endif // __FSKIT_INCLUDES_NEFS__
-
-#ifdef __FSKIT_INCLUDES_HeFS__
+#include <FSKit/Ext2.h>
#include <FSKit/HeFS.h>
-#endif // __FSKIT_INCLUDES_HeFS__
+#include <FSKit/NeFS.h>
#include <CompilerKit/CompilerKit.h>
#include <hint/CompilerHint.h>
@@ -55,7 +51,7 @@
@note Refer to first enum.
*/
#define kFileOpsCount (4U)
-#define kFileMimeGeneric "n-application-kind/all"
+#define kFileMimeGeneric "ne-application-kind/all"
/** @brief invalid position. (n-pos) */
#define kNPos (SizeT)(-1);
diff --git a/dev/kernel/src/FS/Ext2+FileMgr.cc b/dev/kernel/src/FS/Ext2+FileMgr.cc
new file mode 100644
index 00000000..cb17b587
--- /dev/null
+++ b/dev/kernel/src/FS/Ext2+FileMgr.cc
@@ -0,0 +1,14 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#ifndef __NE_MINIMAL_OS__
+#ifdef __FSKIT_INCLUDES_EXT2__
+
+#include <KernelKit/FileMgr.h>
+#include <KernelKit/MemoryMgr.h>
+
+#endif // ifdef __FSKIT_INCLUDES_EXT2__
+#endif // ifndef __NE_MINIMAL_OS__
diff --git a/dev/kernel/src/FS/HeFS+FileMgr.cc b/dev/kernel/src/FS/HeFS+FileMgr.cc
new file mode 100644
index 00000000..e6719e1b
--- /dev/null
+++ b/dev/kernel/src/FS/HeFS+FileMgr.cc
@@ -0,0 +1,14 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#ifndef __NE_MINIMAL_OS__
+#ifdef __FSKIT_INCLUDES_HEFS__
+
+#include <KernelKit/FileMgr.h>
+#include <KernelKit/MemoryMgr.h>
+
+#endif // ifdef __FSKIT_INCLUDES_HEFS__
+#endif // ifndef __NE_MINIMAL_OS__
diff --git a/dev/kernel/src/FS/NeFS+FileMgr.cc b/dev/kernel/src/FS/NeFS+FileMgr.cc
index 0107bd9e..348ae61b 100644
--- a/dev/kernel/src/FS/NeFS+FileMgr.cc
+++ b/dev/kernel/src/FS/NeFS+FileMgr.cc
@@ -4,12 +4,12 @@
------------------------------------------- */
-#include <KernelKit/FileMgr.h>
-#include <KernelKit/MemoryMgr.h>
-
#ifndef __NE_MINIMAL_OS__
#ifdef __FSKIT_INCLUDES_NEFS__
+#include <KernelKit/FileMgr.h>
+#include <KernelKit/MemoryMgr.h>
+
/// @brief NeFS File manager.
/// BUGS: 0
diff --git a/dev/user/SystemCalls.h b/dev/user/SystemCalls.h
index df91bc1e..cfbd99a8 100644
--- a/dev/user/SystemCalls.h
+++ b/dev/user/SystemCalls.h
@@ -60,6 +60,10 @@ IMPORT_C Ref IoOpenFile(const Char* fs_path, const Char* drive_letter);
/// @return Function doesn't return a type.
IMPORT_C Void IoCloseFile(_Input Ref file_desc);
+/// @brief Gets the file mime (if any)
+/// @param file_desc the file descriptor.
+IMPORT_C const Char* IoMimeFile(_Input Ref file_desc);
+
/// @brief Write data to a file.
/// @param file_desc the file descriptor.
/// @param out_data the data to write.
diff --git a/docs/tex/hefs.tex b/docs/tex/hefs.tex
new file mode 100644
index 00000000..9fc9aecd
--- /dev/null
+++ b/docs/tex/hefs.tex
@@ -0,0 +1,32 @@
+\documentclass{article}
+\usepackage[a4paper,margin=1in]{geometry}
+\usepackage{listings}
+\usepackage{xcolor}
+\usepackage{amsmath}
+\usepackage{hyperref}
+\usepackage{longtable}
+\usepackage{titlesec}
+\usepackage{fancyhdr}
+\usepackage{caption}
+\usepackage{graphicx}
+
+\definecolor{codegray}{gray}{0.95}
+\lstset{
+ backgroundcolor=\color{codegray},
+ basicstyle=\ttfamily\small,
+ breaklines=true,
+ frame=single,
+ tabsize=4,
+ language=C++,
+ showstringspaces=false
+}
+
+\title{NeFS: High-Throughput Extended File System Specification}
+\author{Amlal El Mahrouss}
+\date{2025}
+
+\begin{document}
+
+\maketitle
+
+\end{document}
diff --git a/docs/tex/nefs.tex b/docs/tex/nefs.tex
index 5b81bb09..37e43d13 100644
--- a/docs/tex/nefs.tex
+++ b/docs/tex/nefs.tex
@@ -30,7 +30,7 @@
\maketitle
\section{Overview}
-NeFS (New Extended File System) is a B-tree-based embedded file system designed to operate over low-level block storage (AHCI/ATA) with a modular architecture. It supports catalogs (like files or directories), forks (similar to macOS data/resource forks), and a formatting mechanism using EPM (Embedded Partition Manager).
+NeFS (New Extended File System) is am embedded file system designed to operate over low-level block storage (AHCI/ATA) with a modular architecture. It supports catalogs (like files or directories), forks (similar to macOS data/resource forks), and a formatting mechanism using EPM (Extended Partition Map).
\section{Key Components}
diff --git a/public/tools/diutil/src/CommandLine.cc b/public/tools/diutil/src/CommandLine.cc
index 9f11e778..604520a9 100644
--- a/public/tools/diutil/src/CommandLine.cc
+++ b/public/tools/diutil/src/CommandLine.cc
@@ -9,10 +9,10 @@
#include <DiskImage.fwrk/headers/DiskImage.h>
-static const Char kDiskName[kDIDiskNameLen] = "Disk";
-static SInt32 kDiskSectorSz = 512;
-static SizeT kDiskSz = gib_cast(4);
-static const Char kOutDisk[kDIOutNameLen] = "disk.eimg";
+static const Char kDiskName[kDIDiskNameLen] = "Disk";
+static SInt32 kDiskSectorSz = 512;
+static SizeT kDiskSz = gib_cast(4);
+static const Char kOutDisk[kDIOutNameLen] = "disk.eimg";
/// @brief Filesystem tool entrypoint.
int main(int argc, char** argv)
diff --git a/public/tools/make_app/Steps.h b/public/tools/make_app/Steps.h
index 76976dd3..51927def 100644
--- a/public/tools/make_app/Steps.h
+++ b/public/tools/make_app/Steps.h
@@ -12,15 +12,21 @@
#define kStepsExtension ".stp"
#define kStepsStrLen (256U)
+#define kStepsMagic " pls"
+#define kStepsMagicLen (4U)
+#define kStepsVersion (0x0100)
+
+#define kStepsMime "ne-application-kind/steps"
+
struct STEPS_COMMON_RECORD final
{
- SInt32 setup_magic;
- Char setup_name[kStepsStrLen];
- Char setup_company[kStepsStrLen];
- Char setup_author[kStepsStrLen];
- SInt32 setup_version;
- SInt32 setup_pages;
- SInt32 setup_check_page, setup_eula_page;
+ Char magic[kStepsMagicLen];
+ Char name[kStepsStrLen];
+ Char company[kStepsStrLen];
+ Char author[kStepsStrLen];
+ SInt32 version;
+ SInt32 pages;
+ SInt32 check_page, eula_page;
};
#endif // ifndef APPS_STEPS_H \ No newline at end of file
diff --git a/public/tools/make_app/src/CommandLine.cc b/public/tools/make_app/src/CommandLine.cc
index a00e0ec0..c30e02a0 100644
--- a/public/tools/make_app/src/CommandLine.cc
+++ b/public/tools/make_app/src/CommandLine.cc
@@ -7,9 +7,15 @@
#include <Framework.h>
#include <Steps.h>
+#include <user/ProcessCodes.h>
+
#include <CoreFoundation.fwrk/headers/Array.h>
-/// @brief This program makes a framework directory for NeKernel OS.
+/// @brief This program makes a framework/app/steps directory for NeKernel OS.
+
+static Char* kStepsName = "Steps";
+static Char* kStepsAuthor = "John Doe";
+static Char* kStepsCompany = "Company, Inc";
int main(int argc, char* argv[])
{
@@ -28,7 +34,25 @@ int main(int argc, char* argv[])
PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) format.\n");
PrintOut(nullptr, "%s", "make_app: -f: Framework format.\n");
- return EXIT_SUCCESS;
+ return kErrorSuccess;
+ }
+
+ if (MmStrCmp(argv[i], "--author") == 0)
+ {
+ MmCopyMemory(kStepsAuthor, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
+ continue;
+ }
+
+ if (MmStrCmp(argv[i], "--company") == 0)
+ {
+ MmCopyMemory(kStepsCompany, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
+ continue;
+ }
+
+ if (MmStrCmp(argv[i], "--name") == 0)
+ {
+ MmCopyMemory(kStepsName, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
+ continue;
}
if (MmStrCmp(argv[i], "-a") == 0)
@@ -63,13 +87,17 @@ int main(int argc, char* argv[])
auto handle = IoOpenFile(StrFmt("{}{}{}{}", path, kRootDirectory, "_setup", kStepsExtension), nullptr);
- struct STEPS_COMMON_RECORD record
- {
- 0
- };
+ struct STEPS_COMMON_RECORD record;
+
+ MmFillMemory(&record, sizeof(STEPS_COMMON_RECORD), 0);
+
+ MmCopyMemory(record.name, const_cast<Char*>(kStepsName), kStepsStrLen);
+ MmCopyMemory(record.author, const_cast<Char*>(kStepsAuthor), kStepsStrLen);
+ MmCopyMemory(record.company, const_cast<Char*>(kStepsCompany), kStepsStrLen);
+
+ MmCopyMemory(record.magic, const_cast<Char*>(kStepsMagic), kStepsMagicLen);
- record.setup_magic = 0xAABB;
- record.setup_version = 1;
+ record.version = kStepsVersion;
IoWriteFile(handle, (void*)&record, sizeof(STEPS_COMMON_RECORD));
IoCloseFile(handle);
@@ -84,8 +112,8 @@ int main(int argc, char* argv[])
FsCopy(path, StrFmt("{}{}", path, file));
}
- return EXIT_SUCCESS;
+ return kErrorSuccess;
}
- return EXIT_FAILURE;
+ return kErrorInternal;
}