Added lots of stuff
Added stuff to vfs + Dockerized the compilation & added some vscode cfg.
This commit is contained in:
parent
1dca0d18e2
commit
bd9fbd2da6
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name":"Run",
|
||||
"request": "launch",
|
||||
"type": "coreclr",
|
||||
"preLaunchTask": "Build",
|
||||
"program": "VBoxSDL",
|
||||
"args": [
|
||||
"--comment",
|
||||
"Asuro",
|
||||
"--startvm",
|
||||
"7d395c96-891c-4139-b77d-9b6b144b0b93"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole",
|
||||
"internalConsoleOptions": "neverOpen"
|
||||
}
|
||||
]
|
||||
}
|
31
.vscode/tasks.json
vendored
Normal file
31
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build",
|
||||
"command": "docker-compose",
|
||||
"args": [
|
||||
"run",
|
||||
"builder"
|
||||
],
|
||||
"type": "shell",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Build (Builder)",
|
||||
"command": "docker-compose",
|
||||
"args": [
|
||||
"build",
|
||||
"builder"
|
||||
],
|
||||
"type": "shell"
|
||||
}
|
||||
]
|
||||
}
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM ubuntu:latest
|
||||
|
||||
VOLUME ["/code"]
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update
|
||||
RUN apt-get install nasm curl make:i386 binutils:i386 xorriso grub-pc-bin -y
|
||||
RUN apt-get clean
|
||||
RUN curl https://sourceforge.net/projects/freepascal/files/Linux/2.6.4/fpc-2.6.4.i386-linux.tar/download --output fpc.tar -L && \
|
||||
tar -xf fpc.tar
|
||||
|
||||
WORKDIR ./fpc-2.6.4.i386-linux
|
||||
RUN ./install.sh
|
||||
|
||||
COPY compile.sh /compile.sh
|
||||
RUN mkdir /code
|
||||
WORKDIR /code
|
||||
ENTRYPOINT ["/compile.sh"]
|
@ -101,7 +101,7 @@ echo " "
|
||||
echo "======================="
|
||||
echo " "
|
||||
|
||||
cp Asuro.iso ~/host/Asuro.iso
|
||||
#cp Asuro.iso ~/host/Asuro.iso
|
||||
cp Asuro.iso release/Asuro.iso
|
||||
|
||||
checksum=$(md5sum release/Asuro.iso | awk '{print $1}')
|
||||
|
6
docker-compose.yml
Normal file
6
docker-compose.yml
Normal file
@ -0,0 +1,6 @@
|
||||
version: "3.9"
|
||||
services:
|
||||
builder:
|
||||
build: .
|
||||
volumes:
|
||||
- .:/code
|
@ -11,6 +11,7 @@ type
|
||||
TError = (eNone, eUnknown, eFileInUse, eWriteOnly, eReadOnly, eFileDoesNotExist, eDirectoryDoesNotExist, eDirectoryAlreadyExists, eNotADirectory, eDiskFull, eFilenameTooLong, eDirectoryFull);
|
||||
PError = ^TError;
|
||||
TIsPathValid = (pvInvalid, pvFile, pvDirectory);
|
||||
TRegError = (pvUnknown, pvNotRegistered, pvRegistered, pvUnregistered);
|
||||
|
||||
TFileHandle = uint32;
|
||||
|
||||
@ -71,6 +72,7 @@ type
|
||||
var
|
||||
Root : PVFSObject;
|
||||
CurrentDirectory : pchar = nil;
|
||||
PushPopDirectory : PLinkedListBase;
|
||||
|
||||
procedure init();
|
||||
Function OpenFile(Filename : pchar; OpenMode : TOpenMode; WriteMode : TWriteMode; Lock : Boolean; Error : PError) : TFileHandle;
|
||||
@ -87,6 +89,10 @@ function getWorkingDirectory : pchar;
|
||||
//VFS Functions
|
||||
function newVirtualDirectory(Path : pchar) : TError;
|
||||
|
||||
//Driver Functions
|
||||
function registerDrive(DriveHandle : uint32; DriveName : PChar; CBMakeDirectory : TMakeDirectory; CBGetDirectories : TGetDirectories; CBOpenFile : TOpenFile; CBCloseFile : TCloseFile; CBReadFile : TReadFile; CBWriteFile : TWriteFile; CBFileSize : TFileSize; CBPathValid : TPathValid) : TRegError;
|
||||
function registerDevice(DeviceHandle : uint32; DeviceName : PChar; CBMakeDirectory : TMakeDirectory; CBGetDirectories : TGetDirectories; CBOpenFile : TOpenFile; CBCloseFile : TCloseFile; CBReadFile : TReadFile; CBWriteFile : TWriteFile; CBFileSize : TFileSize; CBPathValid : TPathValid) : TRegError;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -182,6 +188,9 @@ begin
|
||||
STRLL_Delete(List, i);
|
||||
if (i > 0) then STRLL_Delete(List, i-1);
|
||||
end;
|
||||
if StringEquals(elm,'.') then begin
|
||||
STRLL_Delete(List, i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -329,6 +338,72 @@ begin
|
||||
tracer.push_trace('vfs.GetDirectoryListing.exit');
|
||||
end;
|
||||
|
||||
{ Driver Functions }
|
||||
|
||||
function registerDrive(DriveHandle : uint32; DriveName : PChar; CBMakeDirectory : TMakeDirectory; CBGetDirectories : TGetDirectories; CBOpenFile : TOpenFile; CBCloseFile : TCloseFile; CBReadFile : TReadFile; CBWriteFile : TWriteFile; CBFileSize : TFileSize; CBPathValid : TPathValid) : TRegError;
|
||||
var
|
||||
Drive : PVFSObject;
|
||||
ht : PHashMap;
|
||||
NewObj : PVFSObject;
|
||||
NewDrive : PVFSDrive;
|
||||
|
||||
begin
|
||||
Drive:= GetObjectFromPath('/disk');
|
||||
ht:= PHashMap(Drive^.Reference);
|
||||
|
||||
NewObj:= PVFSObject(kalloc(sizeof(TVFSObject)));
|
||||
NewObj^.Parent:= Drive;
|
||||
NewObj^.ObjectName:= stringCopy(DriveName);
|
||||
NewObj^.ObjectType:= otDRIVE;
|
||||
|
||||
NewDrive:= PVFSDrive(kalloc(sizeof(TVFSDrive)));
|
||||
NewDrive^.DriveHandle:= DriveHandle;
|
||||
NewDrive^.MakeDirectory:= CBMakeDirectory;
|
||||
NewDrive^.GetDirectories:= CBGetDirectories;
|
||||
NewDrive^.OpenFile:= CBOpenFile;
|
||||
NewDrive^.CloseFile:= CBCloseFile;
|
||||
NewDrive^.ReadFile:= CBReadFile;
|
||||
NewDrive^.WriteFile:= CBWriteFile;
|
||||
NewDrive^.FileSize:= CBFileSize;
|
||||
NewDrive^.PathValid:= CBPathValid;
|
||||
|
||||
NewObj^.Reference:= void(NewDrive);
|
||||
|
||||
hashmap.add(ht, stringCopy(DriveName), void(NewObj));
|
||||
end;
|
||||
|
||||
function registerDevice(DeviceHandle : uint32; DeviceName : PChar; CBMakeDirectory : TMakeDirectory; CBGetDirectories : TGetDirectories; CBOpenFile : TOpenFile; CBCloseFile : TCloseFile; CBReadFile : TReadFile; CBWriteFile : TWriteFile; CBFileSize : TFileSize; CBPathValid : TPathValid) : TRegError;
|
||||
var
|
||||
Dev : PVFSObject;
|
||||
ht : PHashMap;
|
||||
NewObj : PVFSObject;
|
||||
NewDev : PVFSDevice;
|
||||
|
||||
begin
|
||||
Dev:= GetObjectFromPath('/dev');
|
||||
ht:= PHashMap(Dev^.Reference);
|
||||
|
||||
NewObj:= PVFSObject(kalloc(sizeof(TVFSObject)));
|
||||
NewObj^.Parent:= Dev;
|
||||
NewObj^.ObjectName:= stringCopy(DeviceName);
|
||||
NewObj^.ObjectType:= otDEVICE;
|
||||
|
||||
NewDev:= PVFSDevice(kalloc(sizeof(TVFSDevice)));
|
||||
NewDev^.DeviceHandle:= DeviceHandle;
|
||||
NewDev^.MakeDirectory:= CBMakeDirectory;
|
||||
NewDev^.GetDirectories:= CBGetDirectories;
|
||||
NewDev^.OpenFile:= CBOpenFile;
|
||||
NewDev^.CloseFile:= CBCloseFile;
|
||||
NewDev^.ReadFile:= CBReadFile;
|
||||
NewDev^.WriteFile:= CBWriteFile;
|
||||
NewDev^.FileSize:= CBFileSize;
|
||||
NewDev^.PathValid:= CBPathValid;
|
||||
|
||||
NewObj^.Reference:= void(NewDev);
|
||||
|
||||
hashmap.add(ht, stringCopy(DeviceName), void(NewDev));
|
||||
end;
|
||||
|
||||
{ Filesystem Functions }
|
||||
|
||||
Function OpenFile(Filename : pchar; OpenMode : TOpenMode; WriteMode : TWriteMode; Lock : Boolean; Error : PError) : TFileHandle;
|
||||
@ -516,6 +591,42 @@ end;
|
||||
|
||||
{ Terminal Commands }
|
||||
|
||||
procedure VFS_COMMAND_PUSHD(params : PParamList);
|
||||
var
|
||||
Output : pchar;
|
||||
WD : pchar;
|
||||
|
||||
begin
|
||||
WD:= StringCopy(CurrentDirectory);
|
||||
STRLL_Add(PushPopDirectory, WD);
|
||||
Output:= StringConcat(WD, ' saved to stack.');
|
||||
WritestringlnWND(Output, getTerminalHWND);
|
||||
kfree(void(Output));
|
||||
end;
|
||||
|
||||
procedure VFS_COMMAND_POPD(params : PParamList);
|
||||
var
|
||||
Output : pchar;
|
||||
WD : pchar;
|
||||
|
||||
begin
|
||||
if STRLL_Size(PushPopDirectory) > 0 then begin
|
||||
WD:= STRLL_Get(PushPopDirectory, STRLL_Size(PushPopDirectory)-1);
|
||||
if changeDirectory(WD) = pvDirectory then begin
|
||||
Output:= StringConcat(WD, ' popped from the stack.');
|
||||
WritestringlnWND(Output, getTerminalHWND);
|
||||
kfree(void(Output));
|
||||
end else begin
|
||||
Output:= StringConcat(WD, ' popped, but was invalid!');
|
||||
WritestringlnWND(Output, getTerminalHWND);
|
||||
kfree(void(Output));
|
||||
end;
|
||||
STRLL_Delete(PushPopDirectory, STRLL_Size(PushPopDirectory)-1);
|
||||
end else begin
|
||||
WritestringlnWND('No working directory in the stack!', getTerminalHWND);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure VFS_COMMAND_LS(params : PParamList);
|
||||
var
|
||||
Map : PHashMap;
|
||||
@ -596,6 +707,11 @@ end;
|
||||
|
||||
{ Init }
|
||||
|
||||
function fake_drive_path_valid(Handle : uint32; Path : pchar) : TIsPathValid;
|
||||
begin
|
||||
fake_drive_path_valid:= pvDirectory;
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
var
|
||||
ht : PHashMap;
|
||||
@ -609,14 +725,12 @@ begin
|
||||
Root^.Parent:= nil;
|
||||
Root^.ObjectName:= stringCopy('/');
|
||||
|
||||
PushPopDirectory:= STRLL_New;
|
||||
|
||||
ChangeCurrentDirectoryValue('/');
|
||||
|
||||
newVirtualDirectory('/dev');
|
||||
newVirtualDirectory('/home');
|
||||
newVirtualDirectory('/disk');
|
||||
newVirtualDirectory('/disk/test');
|
||||
newVirtualDirectory('/disk/test/myfolder');
|
||||
newVirtualDirectory('/disk/test/mytest');
|
||||
|
||||
// rel:= makeRelative('/disk/SDA/mydirectory/myfile', '/disk/SDA');
|
||||
// if rel <> nil then outputln('VFS', rel) else outputln('VFS', 'REL IS NULL!');
|
||||
@ -625,17 +739,22 @@ begin
|
||||
//while true do begin end;
|
||||
|
||||
terminal.registerCommand('LS', @VFS_COMMAND_LS, 'List directory contents.');
|
||||
terminal.registerCommand('CD', @VFS_COMMAND_CD, 'Set working directory');
|
||||
terminal.registerCommand('CD', @VFS_COMMAND_CD, 'Set working directory.');
|
||||
terminal.registerCommand('PUSHD', @VFS_COMMAND_PUSHD, 'Push the working directory.');
|
||||
terminal.registerCommand('POPD', @VFS_COMMAND_POPD, 'Pop the working directory.');
|
||||
|
||||
ht:= PHashMap(Root^.Reference);
|
||||
//ht:= PHashMap(Root^.Reference);
|
||||
//hashmap.add(ht, 'VDirectory', void(newDummyObject(otVDIRECTORY)));
|
||||
//hashmap.add(ht, 'Drive', void(newDummyObject(otDRIVE)));
|
||||
//hashmap.add(ht, 'Device', void(newDummyObject(otDEVICE)));
|
||||
hashmap.add(ht, 'virtualFile', void(createDummyObject(otVFILE)));
|
||||
//hashmap.add(ht, 'virtualFile', void(createDummyObject(otVFILE)));
|
||||
//hashmap.add(ht, 'Mount', void(newDummyObject(otMOUNT)));
|
||||
//hashmap.add(ht, 'Directory', void(newDummyObject(otDIRECTORY)));
|
||||
//hashmap.add(ht, 'File', void(newDummyObject(otFILE)));}
|
||||
//otVDIRECTORY, otDRIVE, otDEVICE, otVFILE, otMOUNT, otDIRECTORY, otFILE)
|
||||
|
||||
registerDrive(1337, 'TestDrive', nil, nil, nil, nil, nil, nil, nil, @fake_drive_path_valid);
|
||||
|
||||
tracer.push_trace('vfs.init.exit');
|
||||
end;
|
||||
|
||||
|
24
src/include/asuro.pas
Normal file
24
src/include/asuro.pas
Normal file
@ -0,0 +1,24 @@
|
||||
unit asuro;
|
||||
|
||||
interface
|
||||
|
||||
const
|
||||
VERSION = '1.1.0-a';
|
||||
VERSION_MAJOR = '1';
|
||||
VERSION_MINOR = '1';
|
||||
VERSION_SUB = '0';
|
||||
REVISION = '';
|
||||
RELEASE = 'a';
|
||||
LINE_COUNT = 33270;
|
||||
FILE_COUNT = 106;
|
||||
DRIVER_COUNT = 34;
|
||||
FPC_VERSION = '2.6.4';
|
||||
NASM_VERSION = '2.14.02';
|
||||
MAKE_VERSION = '4.2.1';
|
||||
COMPILE_DATE = '20/06/21';
|
||||
COMPILE_TIME = '01:26:22';
|
||||
CHECKSUM = '7f99140bf11cfd367c86bca3e44db0d9';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
Loading…
x
Reference in New Issue
Block a user