Skip to content

Commit 1f12b9d

Browse files
authored
Merge branch 'master' into TweetNaCL
2 parents 50a9310 + e225704 commit 1f12b9d

35 files changed

+566
-170
lines changed

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build ZealOS ISOs
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
paths-ignore:
8+
- '**.md'
9+
- 'screenshots/**'
10+
- '**/LICENSE'
11+
pull_request:
12+
branches:
13+
- 'master'
14+
paths-ignore:
15+
- '**.md'
16+
- 'screenshots/**'
17+
- '**/LICENSE'
18+
workflow_dispatch:
19+
20+
jobs:
21+
build:
22+
name: Build
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
with:
29+
submodules: 'true'
30+
31+
- name: Install Dependencies
32+
run: |
33+
sudo apt-get -y update
34+
sudo apt-get -y install build-essential git xorriso qemu-system-x86
35+
36+
- name: Enable KVM Group Perms
37+
run: |
38+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
39+
sudo udevadm control --reload-rules
40+
sudo udevadm trigger --name-match=kvm
41+
42+
- name: Run ISOs Build Script
43+
timeout-minutes: 10
44+
if: ${{ success() }}
45+
run: |
46+
cd build
47+
./build-iso.sh --headless
48+
cd ..
49+
50+
- name: ISO Check
51+
if: ${{ success() && hashFiles('./build/*.iso') == '' }}
52+
run: |
53+
echo "ISOs not built!"
54+
exit 1
55+
56+
- name: Releasing Latest ISOs
57+
if: ${{ success() && github.event_name == 'push'}}
58+
uses: "GutPuncher/action-automatic-releases@latest"
59+
with:
60+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
61+
automatic_release_tag: "latest"
62+
prerelease: false
63+
title: "Pre-Built ISOs [${{ github.sha }}]"
64+
files: ./build/*.iso
65+
66+
- name: OK
67+
if: ${{ success() }}
68+
run: |
69+
echo "Build OK"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ZealOS
22

3-
[![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://zeal-operating-system.github.io/ZealOS-wiki/)
3+
[![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://zeal-operating-system.github.io/ZealOS-wiki/) [![Build ZealOS ISOs](https://github.com/Zeal-Operating-System/ZealOS/actions/workflows/build.yml/badge.svg)](https://github.com/Zeal-Operating-System/ZealOS/actions/workflows/build.yml)
44

55
The Zeal Operating System is a modernized fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations.
66

@@ -14,7 +14,7 @@ Features in development include:
1414
- [32-bit color VBE graphics](https://github.com/TempleProgramming/HolyGL)
1515
- Fully-functional AHCI support
1616
- Network card drivers and a networking stack
17-
- UEFI booting via [BSD2-licensed Limine bootloader](https://github.com/limine-bootloader/limine) and [Public Domain ZealBooter prekernel](/zealbooter/zealbooter.c)
17+
- UEFI booting via [BSD2-licensed Limine bootloader](https://github.com/limine-bootloader/limine) and [Public Domain ZealBooter prekernel](/zealbooter/src/zealbooter.c)
1818

1919
[Changes include](https://zeal-operating-system.github.io/Doc/ChangeLog.DD.html):
2020
- 60 FPS

build/AUTO.ISO

32 KB
Binary file not shown.

build/build-iso.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ then
1313
exit
1414
fi
1515

16-
# Uncomment if you use doas instead of sudo
17-
#alias sudo=doas
16+
[ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
17+
18+
KVM=''
19+
(lsmod | grep -q kvm) && KVM=' -accel kvm'
1820

1921
# Set this true if you want to test ISOs in QEMU after building.
2022
TESTING=false
@@ -50,7 +52,7 @@ set +e
5052

5153
echo "Making temp vdisk, running auto-install ..."
5254
$QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M
53-
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit
55+
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS
5456

5557
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
5658
rm ../src/Home/Registry.ZC 2> /dev/null
@@ -62,9 +64,9 @@ sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
6264
umount_tempdisk
6365

6466
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
65-
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit
67+
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS
6668

67-
LIMINE_BINARY_BRANCH="v6.x-branch-binary"
69+
LIMINE_BINARY_BRANCH="v8.x-binary"
6870

6971
if [ -d "limine" ]
7072
then
@@ -73,6 +75,8 @@ then
7375
git fetch
7476
git remote set-head origin $LIMINE_BINARY_BRANCH
7577
git switch $LIMINE_BINARY_BRANCH
78+
git config --local pull.ff true
79+
git config --local pull.rebase true
7680
git pull
7781
rm limine
7882

@@ -106,7 +110,7 @@ sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN
106110
sudo cp limine/limine-bios-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN
107111
sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
108112
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
109-
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
113+
sudo cp ../zealbooter/limine.conf $TMPISODIR/Boot/Limine.CONF
110114
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
111115
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
112116
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
@@ -130,11 +134,11 @@ if [ "$TESTING" = true ]; then
130134
cd ..
131135
fi
132136
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
133-
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso
137+
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
134138
echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..."
135-
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso
139+
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
136140
echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..."
137-
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso
141+
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS
138142
fi
139143

140144
# comment these 2 lines if you want lingering old Distro ISOs

build/git-pr-switch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ read -p "Enter fork branch name: " FORK_BRANCH
1515
echo $FORK_BRANCH
1616
FORK_LOCAL=$FORK_BRANCH"-testing"
1717
echo "Creating new local branch for testing: "$FORK_LOCAL" ..."
18-
git checkout -b $FORK_LOCAL
18+
git checkout -B $FORK_LOCAL
1919
echo "Pulling changes from user's branch into new local branch..."
2020
git pull https://github.com/$FORK_USERNAME/ZealOS.git $FORK_BRANCH
2121

build/sync.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ DOCS_DIR=
4444
TMPMOUNT=/tmp/zealtmp
4545

4646
print_usage() {
47-
echo "Usage: $0 ( repo | vm ) [OPTION]"
47+
echo "Usage: $0 ( repo | vm | diff ) [OPTION]"
4848
echo " repo Overwrites src/ with virtual disk contents."
4949
echo " vm Overwrites virtual disk with src/ contents."
50+
echo " diff Runs a 'diff' between src/ and virtual disk."
5051
echo "Options:"
5152
echo " --ignore-dots Ignore dotfiles/dotfolders during synchronize."
5253
}
@@ -73,6 +74,18 @@ else
7374
sudo modprobe nbd
7475
[ ! -d $TMPMOUNT ] && mkdir $TMPMOUNT
7576
case $1 in
77+
flush)
78+
mount_vdisk
79+
sudo blockdev --flushbufs /dev/nbd0
80+
sudo dosfsck -w -r -l -v -t /dev/nbd0
81+
umount_vdisk
82+
;;
83+
diff)
84+
mount_vdisk
85+
diff -x *.MAP --color=always -r ../src/ $TMPMOUNT/ | less -R -p "diff -x.*|Only in.*"
86+
umount_vdisk
87+
echo "Finished."
88+
;;
7689
repo)
7790
echo "Emptying src..."
7891
rm -rf ../src/*
@@ -90,6 +103,7 @@ else
90103
umount_vdisk
91104
[ -f ../src/Tmp/AUTO.ISO.C ] && mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO
92105
echo "Finished."
106+
cd ../
93107
git status
94108
;;
95109
vm)

src/Demo/Games/Chess.ZC

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ Bool MoveDo(GameState *state, I64 piece_num, I64 x2, I64 y2, Bool final)
584584
game_over = TRUE;
585585
}
586586
GameSnapShot;
587-
}
587+
}
588588

589-
return ToBool(score_adjust);
589+
return ToBool(score_adjust);
590590
}
591591

592592
I64 MoveFind(I64 x, I64 y, Move *mvs, I64 mv_cnt)
@@ -664,18 +664,25 @@ I64 MoveCnt(GameState *state)
664664
{
665665
I64 i, res = 0, mv_cnt;
666666
Move mvs[32];
667+
Bool king_stalemate = TRUE;
667668

668669
for (i = 0; i < 32; i++)
670+
{
669671
if (state->pieces[i].player == state->cur_player)
670672
{
671673
mv_cnt = PieceMoves(state, i, mvs);
672674
mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt);
673675
res += mv_cnt;
674676
}
675-
return res;
677+
if (state->pieces[i].type != P_KING && state->pieces[i].player >= 0)
678+
king_stalemate = FALSE;
679+
}
680+
if (king_stalemate)
681+
return 0;
682+
else
683+
return res;
676684
}
677685

678-
679686
U0 DrawIt(CTask *task, CDC *dc)
680687
{
681688
I64 i, x, y, z, k0, k1;

src/Demo/Graphics/32BitColor.ZC

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
I0 DrawPixel(I64 x, I64 y, CBGR24 color)
66
{
7-
text.fb_alias[x + y * GR_WIDTH] = color;
7+
text.fb_alias[x + y * sys_framebuffer_width] = color;
88
}
99

1010
I0 Color32Demo()

src/Demo/Graphics/32BitPaint.ZC

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ U0 PaintGlobalsInit()
3232

3333
I0 DrawImagePixel(I64 x, I64 y, CBGR24 color)
3434
{
35-
paint.fb[x + y * GR_WIDTH] = color;
35+
paint.fb[x + y * sys_framebuffer_width] = color;
3636
}
3737

3838
I0 DrawScreenPixel(I64 x, I64 y, CBGR24 color)
3939
{
40-
text.fb_alias[x + y * GR_WIDTH] = color;
40+
text.fb_alias[x + y * sys_framebuffer_width] = color;
4141
}
4242

4343
I0 DrawScreenChar(I64 x, I64 y, I64 char)
@@ -136,7 +136,7 @@ U0 PaintLoadImage()
136136

137137
U32 PaintImagePeek(I64 x, I64 y)
138138
{
139-
return paint.fb[x + y * GR_WIDTH];
139+
return paint.fb[x + y * sys_framebuffer_width];
140140
}
141141

142142
I0 Paint32()
@@ -176,7 +176,7 @@ I0 Paint32()
176176
// draw the image where the brush was last covering it
177177
for (i = paint.last_x; i < paint.last_x + paint.last_thick; i++)
178178
for (j = paint.last_y; j < paint.last_y + paint.last_thick; j++)
179-
DrawScreenPixel(i, j, paint.fb[i + j * GR_WIDTH]);
179+
DrawScreenPixel(i, j, paint.fb[i + j * sys_framebuffer_width]);
180180

181181
// draw the brush on the screen
182182
DrawScreenBrush(mouse.pos.x, mouse.pos.y, paint.color, paint.thick);
@@ -193,7 +193,7 @@ I0 Paint32()
193193
// draw the image where the color strings where covering it
194194
for (i = 0; i < 3 * FONT_HEIGHT; i++)
195195
for (j = 0; j < 12 * FONT_WIDTH; j++)
196-
DrawScreenPixel(j, i, paint.fb[j + i * GR_WIDTH]);
196+
DrawScreenPixel(j, i, paint.fb[j + i * sys_framebuffer_width]);
197197

198198
// draw the color strings on screen
199199
DrawScreenStr(0, 0 * FONT_HEIGHT, str_r);

0 commit comments

Comments
 (0)