Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 134 additions & 41 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,157 @@ name: CI
on: [push, pull_request]

jobs:
download_tools:
name: Download tools
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
runs-on: ${{ matrix.os }}
build_tools_linux:
name: Build tools for Linux
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cache tools
id: cache
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-tools
with:
path: tools
key: ${{ runner.os }}-${{ env.cache-name }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('download_tools.sh', 'DOWNLOAD_TOOLS.BAT') }}
- name: Download tools (Linux)
if: runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true'
run: ./download_tools.sh
key: linux-${{ env.cache-name }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('tools/src') }}
- name: Install build requirements
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt install wget build-essential file
- name: Build i686-elf-tools
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/build-i686-elf-tools.sh
shell: sh
- name: Download tools (Windows)
if: runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true'
run: DOWNLOAD_TOOLS.BAT
shell: cmd
build:
name: Build
needs: [download_tools]
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
type: ["floppy", "hd", "hd --mbr"]
debug: ["", "--debug"]
test: ["", "--test"]
efi: ["", "--efi"]
runs-on: ${{ matrix.os }}
- name: Cleanup after i686-elf-tools build
if: steps.cache.outputs.cache-hit != 'true'
run: rm -rf tools/src/binutils-* tools/src/gcc-*
- name: Build GenFw
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/GenFw/build.sh
shell: sh
- name: Build imgtools
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/imgtools/build.sh
shell: sh
- name: Build mkdosfs
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/mkdosfs/build.sh
shell: sh
- name: Tar tools
run: tar -cf chaostools-linux.tar --exclude='src' -C tools .
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: chaostools-linux.tar
path: chaostools-linux.tar
build_tools_windows:
name: Build tools for Windows
needs: [build_tools_linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cache tools
id: cache
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-tools
with:
path: tools
key: ${{ runner.os }}-${{ env.cache-name }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('download_tools.sh', 'DOWNLOAD_TOOLS.BAT') }}
- name: Download tools (Linux)
if: runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true'
run: ./download_tools.sh
key: windows-${{ env.cache-name }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('tools/src') }}
- name: Install build requirements
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt install wget build-essential file git automake autopoint bison flex libgdk-pixbuf2.0-dev gperf intltool libtool libltdl-dev python3-mako ruby unzip p7zip-full lzip libtool-bin python-is-python3 gcc-mingw-w64-x86-64
- name: Download linux tools artifact
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/download-artifact@v3
with:
name: chaostools-linux.tar
- name: Untar tools
if: steps.cache.outputs.cache-hit != 'true'
run: tar -xvf chaostools-linux.tar -C tools
- name: Build i686-elf-tools
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/build-i686-elf-tools-win.sh
shell: sh
- name: Download tools (Windows)
if: runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true'
run: DOWNLOAD_TOOLS.BAT
shell: cmd
- name: Run the build script (Linux)
if: runner.os == 'Linux'
- name: Cleanup after i686-elf-tools build
if: steps.cache.outputs.cache-hit != 'true'
run: rm -rf tools/src/mxe tools/src/binutils-* tools/src/gcc-*
- name: Build GenFw
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/GenFw/build-win.sh
shell: sh
- name: Build imgtools
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/imgtools/build-win.sh
shell: sh
- name: Build mkdosfs
if: steps.cache.outputs.cache-hit != 'true'
run: tools/src/mkdosfs/build-win.sh
shell: sh
- name: Remove linux tools
if: steps.cache.outputs.cache-hit != 'true'
run: tar -tf chaostools-linux.tar | tail -n +2 | sed -e 's!^!tools/!' | xargs rm -rf
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: chaostools-windows
path: |
tools
!tools/src
build_linux:
name: Build on Linux
needs: [build_tools_linux]
strategy:
matrix:
type: ["floppy", "hd", "hd --mbr"]
debug: ["", "--debug"]
test: ["", "--test"]
efi: ["", "--efi"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install tools
run: sudo apt install nasm make qemu-utils python3
- name: Download additional tools artifact
uses: actions/download-artifact@v3
with:
name: chaostools-linux.tar
- name: Untar tools
if: steps.cache.outputs.cache-hit != 'true'
run: tar -xvf chaostools-linux.tar -C tools
- name: Run the build script
run: ./build_image.sh ${{ matrix.type }} ${{ matrix.debug }} ${{ matrix.test }} ${{ matrix.efi }} --user-programs-all
shell: sh
- name: Run the build script (Windows)
if: runner.os == 'Windows'
build_windows:
name: Build on Windows
needs: [build_tools_windows]
strategy:
matrix:
type: ["floppy", "hd", "hd --mbr"]
debug: ["", "--debug"]
test: ["", "--test"]
efi: ["", "--efi"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install nasm
uses: ilammy/setup-nasm@v1
- name: Install Python3
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install winget
uses: Cyberboss/install-winget@v1
- name: Install QEMU
run: winget install --accept-source-agreements --accept-package-agreements --id=SoftwareFreedomConservancy.QEMU -e
- name: Add QEMU to the PATH
shell: pwsh
run: |
"C:\Program Files\qemu" >> $env:GITHUB_PATH
- name: Download tools artifact
uses: actions/download-artifact@v3
with:
name: chaostools-windows
path: tools
- name: Run the build script
run: BUILD_IMAGE.BAT ${{ matrix.type }} ${{ matrix.debug }} ${{ matrix.test }} ${{ matrix.efi }} --user-programs-all
shell: cmd
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/tools
*.o
*.map
*.elf
Expand All @@ -20,3 +19,12 @@
*.i
*.iii
*.lst
*.pyc
/tools
!/tools
/tools/*
!/tools/src
!/tools/python
!/tools/Trim
!/tools/Trim.bat
!/tools/bios32.bin
16 changes: 8 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"launchCompleteCommand": "exec-run",
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.bat"
"miDebuggerPath": "gdb"
},
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.sh"
"miDebuggerPath": "gdb"
},
"preLaunchTask": "QEMU Boot Floppy & Run GDB Server",
"internalConsoleOptions": "openOnSessionStart"
Expand All @@ -38,11 +38,11 @@
"launchCompleteCommand": "exec-run",
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.bat"
"miDebuggerPath": "gdb"
},
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.sh"
"miDebuggerPath": "gdb"
},
"preLaunchTask": "QEMU Boot Floppy EFI & Run GDB Server",
"internalConsoleOptions": "openOnSessionStart"
Expand All @@ -61,11 +61,11 @@
"launchCompleteCommand": "exec-run",
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.bat"
"miDebuggerPath": "gdb"
},
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.sh"
"miDebuggerPath": "gdb"
},
"preLaunchTask": "QEMU Boot HD & Run GDB Server",
"internalConsoleOptions": "openOnSessionStart"
Expand All @@ -84,11 +84,11 @@
"launchCompleteCommand": "exec-run",
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.bat"
"miDebuggerPath": "gdb"
},
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "${workspaceRoot}/tools/gdb-multiarch.sh"
"miDebuggerPath": "gdb"
},
"preLaunchTask": "QEMU Boot HD EFI & Run GDB Server",
"internalConsoleOptions": "openOnSessionStart"
Expand Down
16 changes: 8 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"label": "QEMU Boot Floppy & Run GDB Server",
"type": "shell",
"windows": {
"command": "echo a & \"${workspaceRoot}/tools/qemu-windows/qemu-system-i386\" -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s"
"command": "echo a & call \"${workspaceRoot}/SET_ENV_VARS.BAT\" & qemu-system-i386 -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s"
},
"linux": {
"command": "cd \"${workspaceRoot}/tools/qemu-linux\" && export LD_LIBRARY_PATH=\"${workspaceRoot}/tools/qemu-linux/lib\" && echo a && ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=../../FloppyImage.bin,index=0,if=floppy -boot a -S -s || ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=../../FloppyImage.bin,index=0,if=floppy -boot a -S -s"
"command": "echo a && qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s || qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s"
},
"group": "none",
"presentation": {
Expand Down Expand Up @@ -64,10 +64,10 @@
"label": "QEMU Boot Floppy EFI & Run GDB Server",
"type": "shell",
"windows": {
"command": "echo a & \"${workspaceRoot}/tools/qemu-windows/qemu-system-i386\" -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s"
"command": "echo a & call \"${workspaceRoot}/SET_ENV_VARS.BAT\" & qemu-system-i386 -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s"
},
"linux": {
"command": "cd \"${workspaceRoot}/tools/qemu-linux\" && export LD_LIBRARY_PATH=\"${workspaceRoot}/tools/qemu-linux/lib\" && echo a && ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios ../bios32.bin -drive format=raw,file=../../FloppyImage.bin,index=0,if=floppy -boot a -S -s || ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios ../bios32.bin -drive format=raw,file=../../FloppyImage.bin,index=0,if=floppy -boot a -S -s"
"command": "echo a && qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s || qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=FloppyImage.bin,index=0,if=floppy -boot a -S -s"
},
"group": "none",
"presentation": {
Expand Down Expand Up @@ -101,10 +101,10 @@
"label": "QEMU Boot HD & Run GDB Server",
"type": "shell",
"windows": {
"command": "echo a & \"${workspaceRoot}/tools/qemu-windows/qemu-system-i386.exe\" -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s"
"command": "echo a & call \"${workspaceRoot}/SET_ENV_VARS.BAT\" & qemu-system-i386 -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s"
},
"linux": {
"command": "cd \"${workspaceRoot}/tools/qemu-linux\" && export LD_LIBRARY_PATH=\"${workspaceRoot}/tools/qemu-linux/lib\" && echo a && ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=../../HDImage.bin,index=0,if=ide -boot c -S -s || ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=../../HDImage.bin,index=0,if=ide -boot c -S -s"
"command": "echo a && qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s || qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s"
},
"group": "none",
"presentation": {
Expand Down Expand Up @@ -138,10 +138,10 @@
"label": "QEMU Boot HD EFI & Run GDB Server",
"type": "shell",
"windows": {
"command": "echo a & \"${workspaceRoot}/tools/qemu-windows/qemu-system-i386\" -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s"
"command": "echo a & call \"${workspaceRoot}/SET_ENV_VARS.BAT\" & qemu-system-i386 -audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s"
},
"linux": {
"command": "cd \"${workspaceRoot}/tools/qemu-linux\" && export LD_LIBRARY_PATH=\"${workspaceRoot}/tools/qemu-linux/lib\" && echo a && ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios ../bios32.bin -drive format=raw,file=../../HDImage.bin,index=0,if=ide -boot c -S -s || ${workspaceRoot}/tools/qemu-linux/qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios ../bios32.bin -drive format=raw,file=../../HDImage.bin,index=0,if=ide -boot c -S -s"
"command": "echo a && qemu-system-i386 -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s || qemu-system-i386 -curses -audiodev pa,id=stdsound -machine pcspk-audiodev=stdsound -bios tools/bios32.bin -drive format=raw,file=HDImage.bin,index=0,if=ide -boot c -S -s"
},
"group": "none",
"presentation": {
Expand Down
3 changes: 2 additions & 1 deletion BUILD_IMAGE.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ for %%a in ("%user_programs_paths: =" "%") do (
:imageBuilt
if "%IMAGE_TYPE%"=="HD" (
del HDImage.vdi >nul 2>&1
VBoxManage convertfromraw --uuid d32a4d71-7ccb-4864-a684-c9d7c7a425f5 -format VDI HDImage.bin HDImage.vdi || echo Failed building VDI HD image&&goto ERROR
qemu-img convert -f raw -O vdi HDImage.bin HDImage.vdi || echo Failed building VDI HD image&&goto ERROR
python3 -c "f = open('HDImage.vdi', 'r+b'); f.seek(0x188); f.write(b'\x71\x4d\x2a\xd3\xcb\x7c\x64\x48\xa6\x84\xc9\xd7\xc7\xa4\x25\xf5'); f.close();"
)
echo %IMAGE_TYPE% Image was built
goto eof
Expand Down
9 changes: 0 additions & 9 deletions DOWNLOAD_TOOLS.BAT

This file was deleted.

8 changes: 4 additions & 4 deletions QEMU_BOOT.BAT
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@echo off
cd %~d0%~p0
call SET_ENV_VARS.BAT

set IMAGE_TYPE=
set DEBUG=0
set EFI=0
set SECONDARY_HD_IMAGE=
set QEMU_CMD=tools\qemu-windows\qemu-system-i386.exe
set QEMU_CMD=qemu-system-i386
set QEMU_ARGS=-audiodev dsound,id=stdsound -machine pcspk-audiodev=stdsound

:argLoop
Expand All @@ -22,7 +23,7 @@ if "%1" neq "" (
) else if "%1"=="--efi" (
set EFI=1
) else if "%1"=="--x64" (
set QEMU_CMD=tools\qemu-windows\qemu-system-x86_64.exe
set QEMU_CMD=qemu-system-x86_64
) else if "%1"=="--secondary-hd-image" (
set SECONDARY_HD_IMAGE=%2
set SECONDARY_HD_IMAGE=!SECONDARY_HD_IMAGE:"=!
Expand All @@ -48,10 +49,9 @@ if "%IMAGE_TYPE%"=="HD" (
)

if "%DEBUG%"=="1" (
call SET_ENV_VARS.BAT
if not exist kernel\CHAOSKRN.SYS_debug echo WARNING^^! CHAOSKRN.SYS_debug does not exist
start /b cmd /c %QEMU_CMD% %QEMU_ARGS% -S -s
tools\gdb-multiarch.bat -x kernel_debug.gdb
gdb -x kernel_debug.gdb
) else (
%QEMU_CMD% %QEMU_ARGS%
)
Expand Down
Loading