Skip to content

Commit

Permalink
BareMetal template, bug fixes and more! (#1135)
Browse files Browse the repository at this point in the history
Signed-off-by: AnErrupTion <anerruption@disroot.org>
  • Loading branch information
AnErrupTion committed Sep 3, 2023
1 parent 26c9b2d commit 680ca16
Show file tree
Hide file tree
Showing 36 changed files with 208 additions and 650 deletions.
104 changes: 47 additions & 57 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,20 @@ jobs:
with:
name: windows-build-artifact
path: bin
- name: Build Project - Mosa.Templates
run: dotnet build Source\Mosa.Templates\Mosa.Templates.csproj
- name: Create Package - Mosa.Templates
run: nuget pack Source\Mosa.Templates\Mosa.Templates.csproj -Tool -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Tools.Package
run: nuget pack Source\Mosa.Packages\Mosa.Tools.Package.nuspec -Tool -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Korlib
run: nuget pack Source\Mosa.Packages\Mosa.Korlib.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.DeviceSystem
run: nuget pack Source\Mosa.Packages\Mosa.DeviceSystem.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Runtime
run: nuget pack Source\Mosa.Packages\Mosa.Runtime.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Kernel.x86
run: nuget pack Source\Mosa.Packages\Mosa.Kernel.x86.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Tools.Package.Qemu
run: nuget pack Source\Mosa.Packages\Mosa.Tools.Package.Qemu.nuspec -Tool -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Platform
run: nuget pack Source\Mosa.Packages\Mosa.Platform.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.Platform.x86
run: nuget pack Source\Mosa.Packages\Mosa.Platform.x86.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Create Package - Mosa.DeviceSystem
run: nuget pack Source\Mosa.Packages\Mosa.DeviceSystem.nuspec -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Build Project - Mosa.Templates
run: dotnet build Source\Mosa.Templates\Mosa.Templates.csproj
- name: Create Package - Mosa.Templates
run: nuget pack Source\Mosa.Templates\Mosa.Templates.csproj -Tool -OutputDirectory bin\nupkg -Version ${{ env.BUILD_VERSION }}
- name: Store Nuget Packages Artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -72,7 +70,7 @@ jobs:

windows-build-packaging:
name: Windows Build Packaging
needs: [windows-build, linux-build, generate-docs, windows-unit-testing, linux-unit-testing, windows-demo-testing, linux-demo-testing, macos-build, macos-unit-testing]
needs: [windows-build, linux-build, macos-build, generate-docs, windows-unit-testing, linux-unit-testing, macos-unit-testing, windows-demo-testing, linux-demo-testing, macos-demo-testing]
runs-on: windows-latest
timeout-minutes: 15
if: github.event_name == 'push' && github.repository == 'mosa/MOSA-Project' && github.ref == 'refs/heads/master'
Expand All @@ -96,20 +94,18 @@ jobs:
with:
name: Nuget Packages
path: bin\nupkg
- name: Publish Package - Mosa.Templates
run: dotnet nuget push bin\nupkg\Mosa.Templates.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Tools.Package
run: dotnet nuget push bin\nupkg\Mosa.Tools.Package.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Korlib
run: dotnet nuget push bin\nupkg\Mosa.Korlib.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.DeviceSystem
run: dotnet nuget push bin\nupkg\Mosa.DeviceSystem.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Runtime
run: dotnet nuget push bin\nupkg\Mosa.Runtime.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Kernel.x86
run: dotnet nuget push bin\nupkg\Mosa.Kernel.x86.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Tools.Package.Qemu
run: dotnet nuget push bin\nupkg\Mosa.Tools.Package.Qemu.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Platform
run: dotnet nuget push bin\nupkg\Mosa.Platform.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Platform.x86
run: dotnet nuget push bin\nupkg\Mosa.Platform.x86.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.DeviceSystem
run: dotnet nuget push bin\nupkg\Mosa.DeviceSystem.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json
- name: Publish Package - Mosa.Templates
run: dotnet nuget push bin\nupkg\Mosa.Templates.${{ env.BUILD_VERSION }}.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json

linux-build:
name: Linux Build
Expand Down Expand Up @@ -262,15 +258,11 @@ jobs:
runs-on: macos-latest
timeout-minutes: 15
needs: macos-build
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
steps:
- name: Set net7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
#- name: Install Qemu
# run: brew install qemu
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -338,33 +330,31 @@ jobs:
run: dotnet bin/Mosa.Tool.Launcher.Console.dll bin/Mosa.BareMetal.HelloWorld.x86.dll -o${{ matrix.optimization }} -check -test
- name: Demo Test - BareMetal GraphicalWorld
run: dotnet bin/Mosa.Tool.Launcher.Console.dll bin/Mosa.BareMetal.GraphicalWorld.x86.dll -o${{ matrix.optimization }} -check -test -vmware-svga -include bin/Include

#macos-demo-testing:
# strategy:
# matrix:
# optimization: [0,1,2,3,4,5,6,7,8,9]
# fail-fast: false
# name: MacOS - Demo Test -o${{ matrix.optimization }}
# runs-on: macos-latest
# timeout-minutes: 15
# needs: macos-build
# steps:
# - name: Set net7.0
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: '7.0.x'
# - name: Checkout
# uses: actions/checkout@v3
# with:
# submodules: recursive
# - name: Download Build Artifact
# uses: actions/download-artifact@v3
# with:
# name: macos-build-artifact
# path: bin
# #- name: Install Qemu
# # run: brew install qemu
# - name: Demo Test - BareMetal HelloWorld
# run: dotnet bin/Mosa.Tool.Launcher.Console.dll bin/Mosa.BareMetal.HelloWorld.x86.dll -o${{ matrix.optimization }} -check -test
# - name: Demo Test - BareMetal GraphicalWorld
# run: dotnet bin/Mosa.Tool.Launcher.Console.dll bin/Mosa.BareMetal.GraphicalWorld.x86.dll -o${{ matrix.optimization }} -check -test

macos-demo-testing:
strategy:
matrix:
optimization: [0,1,2,3,4,5,6,7,8,9]
fail-fast: false
name: MacOS - Demo Test -o${{ matrix.optimization }}
runs-on: macos-latest
timeout-minutes: 15
needs: macos-build
steps:
- name: Set net7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: macos-build-artifact
path: bin
- name: Demo Test - BareMetal HelloWorld
run: dotnet bin/Mosa.Tool.Launcher.Console.dll bin/Mosa.BareMetal.HelloWorld.x86.dll -o${{ matrix.optimization }} -check -test
- name: Demo Test - BareMetal GraphicalWorld
run: dotnet bin/Mosa.Tool.Launcher.Console.dll bin/Mosa.BareMetal.GraphicalWorld.x86.dll -o${{ matrix.optimization }} -check -test -vmware-svga -include bin/Include
3 changes: 0 additions & 3 deletions Demos/Run-BareBones.TestWorld.x86.sh

This file was deleted.

12 changes: 0 additions & 12 deletions Source/Docs/baremetal.rst

This file was deleted.

3 changes: 1 addition & 2 deletions Source/Docs/contents.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@

unit-tests
usb-flash-drive-installation
baremetal


.. toctree::
:caption: Runtime
:hidden:
Expand Down
4 changes: 3 additions & 1 deletion Source/Docs/create-operating-system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Introduction

Now that you've learned to either launch a pre-existing demo project or make your own, we'll teach you the basics of the MOSA framework, and how to make your OS more interesting! Let's get started!

.. tip:: You don't need to follow this guide if you're using the BareMetal kernel (which the template is using). This guide is only for those who wish to learn more about the internals of MOSA.

Theory
======

Expand Down Expand Up @@ -130,4 +132,4 @@ Finally, you can initialize specific services here. For example, you could call

Well, we can't write the code for you, but you get it now. After all these steps, you can finally build the OS you've always wanted to create!

If you have any more questions, don't hesitate to ask on our `Discord <https://discord.gg/tRNMn3npsv>` server! We'll happily answer them all :D
If you have any more questions, don't hesitate to ask on our `Discord <https://discord.gg/tRNMn3npsv>` server! We'll happily answer them all :D
5 changes: 0 additions & 5 deletions Source/Docs/demos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,3 @@ HelloWorld
The **HelloWorld** demo is the classic rendition of `"Hello, World!" <https://en.wikipedia.org/wiki/%22Hello,_World!%22_program>`__, except it does not actually display those words. Instead it implements a basic shell with a few basic commands, like boot information, memory usage, and device information.

.. image:: images/mosa-demo-helloworld.png

TestWorld
=========

The **TestWorld** demo is a barebones demo meant to show how you can create a barebones kernel using MOSA.
Binary file removed Source/Docs/images/mosa-demo-coolworld.png
Binary file not shown.
Binary file removed Source/Docs/images/mosa-demo-svgaworld.webp
Binary file not shown.
Binary file removed Source/Docs/images/mosa-demo-testworld.png
Binary file not shown.
8 changes: 1 addition & 7 deletions Source/Docs/mosa-project-structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Those are the demo projects using the **Mosa.Kernel.BareMetal** kernel.
Mosa.Compiler.*
***************

Those projects make the MOSA compiler. You can learn more about it :doc:`here<compiler-design>`.
Those projects make up the MOSA compiler. They include the CIL, IR transformations and native code generation stages. You can learn more about it :doc:`here<compiler-design>`.

*****************
Mosa.DeviceDriver
Expand Down Expand Up @@ -54,12 +54,6 @@ Mosa.Korlib

This project is the MOSA implementation of the .NET standard library. While it is currently missing a lot of features, it is highly portable and can be used in any project requiring a custom core library.

***************
Mosa.Platform.*
***************

Those projects host the code generation stages of their respective platform for the MOSA compiler.

****************
Mosa.Plug.Korlib
****************
Expand Down
53 changes: 1 addition & 52 deletions Source/Mosa.BareMetal.HelloWorld.x86/Boot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,7 @@ public static void Main()
Debug.WriteLine("Boot::Main()");
Debug.WriteLine("MOSA x86 Kernel");

var result = ArrayLayoutTests.C_4();

if (result)
{
Debug.WriteLine("ArrayLayoutTests.C_4() -> Pass");
}
else
{
Debug.WriteLine("ArrayLayoutTests.C_4() -> Fail");
}

var result2 = ArrayLayoutTests.C_4a();

if (result2)
{
Debug.WriteLine("ArrayLayoutTests.C_4a() -> Pass");
}
else
{
Debug.WriteLine("ArrayLayoutTests.C_4a() -> Fail");
}

var result3 = ArrayLayoutTests.C_4z();

if (result3)
{
Debug.WriteLine("ArrayLayoutTests.C_4z() -> Pass");
}
else
{
Debug.WriteLine("ArrayLayoutTests.C_4z() -> Fail");
}

//var result4 = ArrayLayoutTests.C_4ab();
//Debug.WriteLine("ArrayLayoutTests.C_4ab() = ", result4);

//var result = CheckedTests.AddU8U8(18446744073709551615, 1);

//if (result == 95272687)
//{
// Debug.WriteLine("CheckedTests::AddU8U8() -> Pass");
//}
//else
//{
// Debug.WriteLine("CheckedTests::AddU8U8() -> Fail");
//}

Debug.WriteLine("##PASS##");

while (true)
{
}
Program.EntryPoint();
}

public static void Include()
Expand Down
2 changes: 0 additions & 2 deletions Source/Mosa.BareMetal.HelloWorld/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public static void EntryPoint()
Console.ForegroundColor = ConsoleColor.White;
Console.Clear();

Debug.WriteLine("##PASS##");

AppManager.Execute("ShowISA");
AppManager.Execute("ShowPCI");
AppManager.Execute("ShowDisks");
Expand Down
8 changes: 6 additions & 2 deletions Source/Mosa.Kernel.BareMetal.x86/PlatformPlug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public static void EntryPoint()
Multiboot.Setup(new Pointer(ebx), eax);

SSE.Setup();
SerialDebug.Setup();
PIC.Setup();
RTC.Setup();

if (BootSettings.EnableDebugOutput) Serial.Setup(Serial.COM1);
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetBootReservedRegion")]
Expand All @@ -39,7 +40,10 @@ public static void EntryPoint()
public static void ConsoleWrite(byte c) => VGAConsole.Write(c);

[Plug("Mosa.Kernel.BareMetal.Platform::DebugWrite")]
public static void DebugWrite(byte c) => SerialDebug.Write(c);
public static void DebugWrite(byte c)
{
if (BootSettings.EnableDebugOutput) Serial.Write(Serial.COM1, c);
}

[Plug("Mosa.Kernel.BareMetal.Platform::GetTime")]
public static Time GetTime() => new(
Expand Down
64 changes: 0 additions & 64 deletions Source/Mosa.Kernel.BareMetal.x86/SerialDebug.cs

This file was deleted.

0 comments on commit 680ca16

Please sign in to comment.