Merge branch 'develop' into 'master'

Develop

See merge request spexeah/asuro!5
This commit is contained in:
Kieron 2021-06-20 21:18:01 +00:00
commit 6d0fa06d74
2 changed files with 92 additions and 10 deletions

81
readme.md Normal file
View File

@ -0,0 +1,81 @@
# Asuro
We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel free to follow the steps below and mess with Asuro for fun or profit.
## Setting up your build environment
### Prerequisites
* [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
WSL2 is used in conjunction with Docker to predefine a build environment for Asuro.
* [Docker for Windows](https://docs.docker.com/docker-for-windows/install/)
Docker is used to ensure a predefined environment with the correct versions of; Freepascal, Binutils, NASM, Make, xorriso & grub-mk-rescue installed is used for compilation. An ISO will be generated at the end of the build process.
* [Git (Obviously)](https://git-scm.com/)
I don't think this needs an explaination.
* [VSCode (Optional, but highly recommended)](https://code.visualstudio.com/)
Visual Studio code is our IDE of choice, and we have a number of recommended plugins.
* [C# Plugin by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
This plugin gives you the ability to use the 'coreclr' task type, allowing the automatic launching of virtualbox with the resulting image generated during compilation of Asuro.
* [VirtualBox](https://www.virtualbox.org/)
Virtualbox is our Virtualisation environment of choice, don't ask why, it just is.
### Installation (correct as of 2021/06/20)
1. Install WSL2 as described in the article linked above & ensure Virtualization is enabled in the BIOS.
2. Ensure WSL2 is used by default with the following command:
```powershell
wsl --set-default-version 2
```
3. Install Docker for Windows.
4. Install Git for Windows.
5. Install VSCode & the listed plugins.
6. Install VirtualBox.
7. Clone this repository.
8. Run the following command in the root of the repo to build the docker image:
```powershell
docker-compose build builder
```
9. Run the following command to compile Asuro:
```powershell
docker-compose run builder
```
10. Create a new virtual machine in Virtualbox and mount the `Asuro.iso` generated in step 9 as a boot image.
11. Add the virtualbox installation directory to your `%PATH%` environment variable, usually:
```
%PROGRAMFILES%\Oracle\VirtualBox
```
12. Naviage to your virtualbox machines folder, this is usually the following
```
%userprofile%\VirtualBox VMs\<VM Name>
```
Open the Virtual Machine Definition file (.vbox) in your text editor of choice and find the following line:
```xml
<Machine uuid="{7d395c96-891c-4139-b77d-9b6b144b0b93}" name="Asuro" OSType="Linux" snapshotFolder="Snapshots" lastStateChange="2021-06-20T20:33:07Z">
```
Copy the uuid, in our case `7d395c96-891c-4139-b77d-9b6b144b0b93` and replace the uuid found in `.vscode\launch.json` under `args`, so that it looks something like this:
```json
{
"configurations": [
{
"name":"Run",
"request": "launch",
"type": "coreclr",
"preLaunchTask": "Build",
"program": "VBoxSDL",
"args": [
"--comment",
"Asuro",
"--startvm",
"<YOUR UUID HERE>"
],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"internalConsoleOptions": "neverOpen"
}
]
}
```
This will allow VSCode to automatically launch VirtualBox once Asuro has been compiled.
13. Open your project folder in VSCode, use CTRL+SHIFT+B to build & F5 to build + run in VBox.
14. Congratulations! You can now play with Asuro!
### Gotchas
- It was noted that Windows builds above `20H2` seem to have issues installing WSL2. We may have to wait for a patch from Microsoft to fix this. Our devs are currently using build `20H2`.

View File

@ -707,11 +707,6 @@ end;
{ Init } { Init }
function fake_drive_path_valid(Handle : uint32; Path : pchar) : TIsPathValid;
begin
fake_drive_path_valid:= pvDirectory;
end;
procedure init(); procedure init();
var var
ht : PHashMap; ht : PHashMap;
@ -721,16 +716,21 @@ var
begin begin
tracer.push_trace('vfs.init.enter'); tracer.push_trace('vfs.init.enter');
{ VFS Root Creation }
Root:= createVirtualDirectory(); Root:= createVirtualDirectory();
Root^.Parent:= nil; Root^.Parent:= nil;
Root^.ObjectName:= stringCopy('/'); Root^.ObjectName:= stringCopy('/');
{ Init Push/Pop Stack for PUSHD & POPD }
PushPopDirectory:= STRLL_New; PushPopDirectory:= STRLL_New;
{ Move to root of VFS }
ChangeCurrentDirectoryValue('/'); ChangeCurrentDirectoryValue('/');
{ Create the Default VFS Directories }
newVirtualDirectory('/dev'); newVirtualDirectory('/dev');
newVirtualDirectory('/disk'); newVirtualDirectory('/disk');
newVirtualDirectory('/cfg');
// rel:= makeRelative('/disk/SDA/mydirectory/myfile', '/disk/SDA'); // rel:= makeRelative('/disk/SDA/mydirectory/myfile', '/disk/SDA');
// if rel <> nil then outputln('VFS', rel) else outputln('VFS', 'REL IS NULL!'); // if rel <> nil then outputln('VFS', rel) else outputln('VFS', 'REL IS NULL!');
@ -738,6 +738,7 @@ begin
//outputln('VFS', makeRelative('/test/mydisk/mything', '/test/mydisk')); //outputln('VFS', makeRelative('/test/mydisk/mything', '/test/mydisk'));
//while true do begin end; //while true do begin end;
{ Register Terminal Commands }
terminal.registerCommand('LS', @VFS_COMMAND_LS, 'List directory contents.'); 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('PUSHD', @VFS_COMMAND_PUSHD, 'Push the working directory.');
@ -753,7 +754,7 @@ begin
//hashmap.add(ht, 'File', void(newDummyObject(otFILE)));} //hashmap.add(ht, 'File', void(newDummyObject(otFILE)));}
//otVDIRECTORY, otDRIVE, otDEVICE, otVFILE, otMOUNT, otDIRECTORY, otFILE) //otVDIRECTORY, otDRIVE, otDEVICE, otVFILE, otMOUNT, otDIRECTORY, otFILE)
registerDrive(1337, 'TestDrive', nil, nil, nil, nil, nil, nil, nil, @fake_drive_path_valid); //registerDrive(1337, 'TestDrive', nil, nil, nil, nil, nil, nil, nil, @fake_drive_path_valid);
tracer.push_trace('vfs.init.exit'); tracer.push_trace('vfs.init.exit');
end; end;