Skip to content

Commit 4611113

Browse files
committed
Updated graphics API
Signed-off-by: Manjeet Singh <itsmanjeet1998@gmail.com>
1 parent 43fb2ae commit 4611113

File tree

5,017 files changed

+86934
-55606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,017 files changed

+86934
-55606
lines changed

.github/.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"go.toolsEnvVars": {
3+
"GOOS": "linux"
4+
}
5+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
base_ref="${1:-}"
5+
head_ref="${2:-HEAD}"
6+
7+
if [[ -z "${base_ref}" ]]; then
8+
echo "usage: $0 <base-ref> [head-ref]" >&2
9+
exit 2
10+
fi
11+
12+
if [[ "${base_ref}" =~ ^0+$ ]] || ! git rev-parse --verify --quiet "${base_ref}^{commit}" >/dev/null; then
13+
changed="$(git ls-files meta/)"
14+
else
15+
changed="$(git diff --name-only "${base_ref}" "${head_ref}" -- meta/ || true)"
16+
fi
17+
18+
scope="none"
19+
reason="no meta changes"
20+
targets=""
21+
22+
if [[ -n "${changed}" ]]; then
23+
scope="meta"
24+
reason="meta changes detected"
25+
fi
26+
27+
while IFS= read -r path; do
28+
[[ -z "${path}" ]] && continue
29+
30+
case "${path}" in
31+
meta/base/*)
32+
scope="stage"
33+
reason="gentoo repo or base metadata changed"
34+
targets="@system @world"
35+
;;
36+
meta/config/make.profile|meta/config/repos.conf/*)
37+
scope="stage"
38+
reason="profile or repository configuration changed"
39+
targets="@system @world"
40+
;;
41+
meta/config/make.conf|meta/config/package.*|meta/config/env/*)
42+
if [[ "${scope}" != "stage" ]]; then
43+
scope="world"
44+
reason="global portage configuration changed"
45+
targets="@world"
46+
fi
47+
;;
48+
meta/overlay/*)
49+
if [[ "${scope}" != "stage" ]]; then
50+
scope="world"
51+
reason="overlay content changed"
52+
targets="@world"
53+
fi
54+
;;
55+
meta/config/*)
56+
if [[ "${scope}" == "meta" || "${scope}" == "none" ]]; then
57+
scope="world"
58+
reason="portage policy changed"
59+
targets="@world"
60+
fi
61+
;;
62+
esac
63+
done <<< "${changed}"
64+
65+
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
66+
{
67+
echo "changed<<EOF"
68+
printf "%s\n" "${changed}"
69+
echo "EOF"
70+
echo "scope=${scope}"
71+
echo "reason=${reason}"
72+
echo "targets=${targets}"
73+
} >> "${GITHUB_OUTPUT}"
74+
fi
75+
76+
cat <<EOF
77+
scope=${scope}
78+
reason=${reason}
79+
targets=${targets}
80+
EOF
Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
1-
name: Build And Release
1+
name: Build
22
on:
33
push:
44
branches:
5-
- main
5+
- next
66
tags:
7-
- '*'
7+
- "*"
88
pull_request:
99

1010
env:
1111
SOURCE_DATE_EPOCH: 1700000000
1212
RELEASE: 1
13+
CACHE_PATH: /cache
1314

1415
jobs:
1516
build:
1617
if: github.event_name != 'pull_request'
17-
runs-on: ubuntu-latest
18+
runs-on: self-hosted
1819
strategy:
1920
matrix:
20-
arch: [amd64, arm64]
21+
arch: [amd64]
2122
steps:
2223
- uses: actions/checkout@v5
23-
- name: Install requirements
24-
run: sudo apt-get update -y && sudo apt-get install -y parted zip
25-
- name: Cleanup cache
26-
run: rm -rf _cache
24+
25+
- name: Fetch Sources
26+
run: make GOARCH=${{matrix.arch}} fetch-sources
2727

2828
- name: Build
29-
run: |
30-
PATH=$PATH:/usr/sbin make GOARCH=${{matrix.arch}} -j$(nproc)
29+
run: make GOARCH=${{matrix.arch}} -j$(nproc)
3130

32-
- name: Compress Image
33-
run: |
34-
rm -rf _cache/${{matrix.arch}}/bundle
35-
mkdir -p _cache/${{matrix.arch}}/bundle
36-
cp -a _cache/${{matrix.arch}}/disk.img external/${{matrix.arch}}/firmware external/${{matrix.arch}}/variables _cache/${{matrix.arch}}/bundle/
37-
cd _cache/${{matrix.arch}}/bundle
38-
zip ../avyos-${{github.ref_name}}-${{matrix.arch}}.zip disk.img firmware variables
31+
# - name: Compress Image
32+
# run: |
33+
# rm -rf _cache/${{matrix.arch}}/bundle
34+
# mkdir -p _cache/${{matrix.arch}}/bundle
35+
# cp -a _cache/${{matrix.arch}}/disk.img external/${{matrix.arch}}/firmware external/${{matrix.arch}}/variables _cache/${{matrix.arch}}/bundle/
36+
# cd _cache/${{matrix.arch}}/bundle
37+
# zip ../avyos-${{github.ref_name}}-${{matrix.arch}}.zip disk.img firmware variables
3938

40-
- name: Create / Update Release and Upload Artifact
41-
uses: softprops/action-gh-release@v2
42-
with:
43-
name: ${{ github.ref_name }}
44-
tag_name: ${{ github.ref_name }}
45-
prerelease: ${{ github.ref_type != 'tag' }}
46-
allowUpdates: true
47-
files: |
48-
_cache/${{matrix.arch}}/avyos-${{github.ref_name}}-${{matrix.arch}}.zip
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
# - name: Create / Update Release and Upload Artifact
40+
# uses: softprops/action-gh-release@v2
41+
# with:
42+
# name: ${{ github.ref_name }}
43+
# tag_name: ${{ github.ref_name }}
44+
# prerelease: ${{ github.ref_type != 'tag' }}
45+
# allowUpdates: true
46+
# files: |
47+
# _cache/${{matrix.arch}}/avyos-${{github.ref_name}}-${{matrix.arch}}.zip
48+
# env:
49+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Meta Rebuild Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'meta/**'
9+
- '.github/workflows/meta-rebuild-check.yml'
10+
- '.github/scripts/meta-rebuild-plan.sh'
11+
pull_request:
12+
paths:
13+
- 'meta/**'
14+
- '.github/workflows/meta-rebuild-check.yml'
15+
- '.github/scripts/meta-rebuild-plan.sh'
16+
17+
jobs:
18+
plan:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
pull-requests: read
23+
steps:
24+
- uses: actions/checkout@v5
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Choose diff base
29+
id: base
30+
run: |
31+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
32+
echo "ref=${{ github.event.pull_request.base.sha }}" >> "${GITHUB_OUTPUT}"
33+
else
34+
echo "ref=${{ github.event.before }}" >> "${GITHUB_OUTPUT}"
35+
fi
36+
37+
- name: Compute rebuild scope
38+
id: plan
39+
run: ./.github/scripts/meta-rebuild-plan.sh "${{ steps.base.outputs.ref }}" "${{ github.sha }}"
40+
41+
- name: Summary
42+
run: |
43+
targets="${{ steps.plan.outputs.targets }}"
44+
if [[ -z "${targets}" ]]; then
45+
targets="none"
46+
fi
47+
{
48+
echo "## Meta Rebuild Plan"
49+
echo
50+
echo "- Scope: \`${{ steps.plan.outputs.scope }}\`"
51+
echo "- Reason: ${{ steps.plan.outputs.reason }}"
52+
echo "- Suggested targets: \`${targets}\`"
53+
echo
54+
echo "### Changed files"
55+
echo '```'
56+
printf '%s\n' "${{ steps.plan.outputs.changed }}"
57+
echo '```'
58+
} >> "${GITHUB_STEP_SUMMARY}"

.gitmodules

Whitespace-only changes.

.zed/tasks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"label": "Build",
4+
"command": "make -j12",
5+
},
6+
{
7+
"label": "Run",
8+
"command": "make run -j12 ",
9+
},
10+
{
11+
"label": "Clean",
12+
"command": "make clean",
13+
},
14+
]

Makefile

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DEBUG ?= 0
55

66
KERNEL ?= linux
77

8+
PROJECT_PATH := ${CURDIR}
89
CACHE_PATH ?= ${CURDIR}/_cache
910
DOCGEN_OUT ?= ${CACHE_PATH}/docs
1011

@@ -18,20 +19,22 @@ SYSTEM_IMAGE ?= ${SYSTEM_PATH}.img
1819
INITRAMFS_PATH ?= ${DEVICE_CACHE_PATH}/initramfs
1920
INITRAMFS_IMAGE ?= ${INITRAMFS_PATH}.img
2021

21-
ifeq (${KERNEL},linux)
22-
KERNEL_IMAGE ?= ${CURDIR}/external/${GOARCH}/kernel.img
23-
else
24-
KERNEL_IMAGE ?= ${DEVICE_CACHE_PATH}/kernel.img
25-
endif
22+
KERNEL_IMAGE := ${CURDIR}/external/${GOARCH}/kernel.img
23+
KERNEL_DRIVERS_PATH ?= ${DEVICE_CACHE_PATH}/drivers
24+
25+
LINUX_KERNEL_VERSION ?= 7.0-rc6
26+
KERNEL_MAKE_ARGS += LLVM=1
2627

2728
DISK_IMAGE ?= ${DEVICE_CACHE_PATH}/disk.img
2829
QEMU_DEBUG_LOG ?= ${DEVICE_CACHE_PATH}/qemu-debug.log
2930

3031
ifeq (${GOARCH},amd64)
3132
QEMU ?= qemu-system-x86_64
33+
KERNEL_MAKE_ARGS += ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-
3234
else ifeq (${GOARCH},arm64)
3335
QEMU ?= qemu-system-aarch64
3436
QEMU_ARCH_ARGS ?= -M virt -cpu cortex-a57
37+
KERNEL_MAKE_ARGS += ARCH=aarch64 CROSS_COMPILE=aarch64-linux-gnu-
3538
else
3639
QEMU ?= qemu-system-${GOARCH}
3740
endif
@@ -45,8 +48,10 @@ endif
4548

4649
ifeq ($(shell go env GOOS),linux)
4750
QEMU_ACCEL ?= -accel kvm
51+
QEMU_DISPLAY ?= -display sdl,show-cursor=on
4852
else ifeq ($(shell go env GOOS),darwin)
4953
QEMU_ACCEL ?= -accel hvf
54+
QEMU_DISPLAY ?= -display cocoa
5055
endif
5156

5257
ifeq (${QEMU_VNC},1)
@@ -58,11 +63,11 @@ QEMU_NET_ARGS ?= -nic user,model=virtio-net-pci,hostfwd=tcp:127.0.0.1:${DBG_PORT
5863

5964
QEMU_COMMON_ARGS ?= -smp 2 -m 2G \
6065
-serial mon:stdio \
61-
${QEMU_NET_ARGS} \
66+
${QEMU_NET_ARGS} ${QEMU_DISPLAY} \
6267
-vga none ${QEMU_ACCEL} ${QEMU_VNC_OPTIONS} \
6368
-device virtio-gpu-pci \
6469
-device virtio-keyboard-pci \
65-
-device virtio-mouse-pci
70+
-usb -device usb-tablet
6671

6772
QEMU_FW_ARGS ?= -drive if=pflash,file=${CURDIR}/external/${GOARCH}/firmware,readonly=on,format=raw \
6873
-drive if=pflash,file=${DEVICE_CACHE_PATH}/variables,format=raw
@@ -73,21 +78,15 @@ QEMU_DEBUG_ARGS ?= -d int,guest_errors,cpu_reset -D ${QEMU_DEBUG_LOG} \
7378
GENIMAGE_DEPS := ./tools/genimage/main.go ./tools/genimage/assets/btrfs-512m.img.gz
7479
DOCGEN_DEPS := ./tools/docgen/main.go
7580
RUN_EXTRA_ARGS = $(if $(filter 1,$(DEBUG)),$(QEMU_DEBUG_ARGS),)
76-
KERNEL_BUILD_FLAGS = $(if $(filter 1,$(DEBUG)),$(KERNEL_DEBUG_GCFLAGS) $(KERNEL_DEBUG_LDFLAGS),$(KERNEL_RELEASE_LDFLAGS))
7781

78-
KERNEL_COMMON_FLAGS = GOOS=linux GOARCH=${GOARCH} CGO_ENABLED=0 ${GO} build
79-
KERNEL_RELEASE_LDFLAGS = -ldflags="-E main._entry -T -2147479552"
80-
KERNEL_DEBUG_GCFLAGS = -gcflags="all=-N -l"
81-
KERNEL_DEBUG_LDFLAGS = -ldflags="-E main._entry -T -2147479552 -compressdwarf=false"
82-
83-
COMMANDS = dltest distro copy delete driver filter find identity info init link list mkdir mount move net open power process read request service session shell showoff system tree uevent write
84-
APPS = background demo dock files gallery launcher notepad oobe power settings tasks terminal waylayer
85-
SERVICES = distro display login uevent dbg
82+
COMMANDS = asciify copy coredump crash delete distro driver filter find identity icon info init link list mkdir mount move notify net power process read request resolution service session shell system tree uevent write
83+
APPS = demo files notepad terminal
84+
SERVICES = dbg desktop distro http login service settings uevent
8685
GO_TARGETS = $(addprefix cmd/,${COMMANDS}) $(addsuffix /exec,$(addprefix apps/,${APPS})) $(addprefix services/,${SERVICES})
8786
CONFIG_TARGETS = $(shell find config/ -type f)
8887
DATA_TARGETS = $(shell find data/ -type f)
89-
EXTERNAL_TARGETS = cmd/dlv
90-
SYSTEM_TARGETS = $(GO_TARGETS) ${EXTERNAL_TARGETS} ${CONFIG_TARGETS} ${DATA_TARGETS} $(addsuffix /manifest.json,$(addprefix apps/,${APPS})) $(addsuffix /icon.png,$(addprefix apps/,${APPS}))
88+
EXTERNAL_TARGETS =
89+
SYSTEM_TARGETS = $(GO_TARGETS) ${EXTERNAL_TARGETS} ${CONFIG_TARGETS} ${DATA_TARGETS} $(addsuffix /manifest.json,$(addprefix apps/,${APPS})) $(addsuffix /icon.svg,$(addprefix apps/,${APPS}))
9190

9291
INITRAMFS_TARGETS = init
9392

@@ -121,7 +120,29 @@ compile_db:
121120
done
122121

123122
docs: ${DOCGEN_DEPS}
124-
${GO} run ./tools/docgen -out ${DOCGEN_OUT}
123+
${GO} run avyos.dev/tools/docgen -out ${DOCGEN_OUT}
124+
125+
${CACHE_PATH}/linux-${LINUX_KERNEL_VERSION}.tar.xz:
126+
wget -nc https://git.kernel.org/torvalds/t/linux-${LINUX_KERNEL_VERSION}.tar.gz -O $@
127+
128+
${DEVICE_CACHE_PATH}/kernel/Makefile: ${CACHE_PATH}/linux-${LINUX_KERNEL_VERSION}.tar.xz
129+
@mkdir -p $(dir $@)
130+
tar -xmf $< -C ${DEVICE_CACHE_PATH}/kernel --strip-components=1
131+
132+
update-kernel: ${DEVICE_CACHE_PATH}/kernel/Makefile
133+
cd ${DEVICE_CACHE_PATH}/kernel && \
134+
${MAKE} ${KERNEL_MAKE_ARGS} defconfig && \
135+
./scripts/kconfig/merge_config.sh -m .config \
136+
${PROJECT_PATH}/external/kernel.config \
137+
${PROJECT_PATH}/external/${GOARCH}/kernel.config && \
138+
${MAKE} ${KERNEL_MAKE_ARGS} olddefconfig && \
139+
${MAKE} ${KERNEL_MAKE_ARGS} all
140+
141+
cd ${DEVICE_CACHE_PATH}/kernel && \
142+
cp $$(${MAKE} ${KERNEL_MAKE_ARGS} -s image_name) ${PROJECT_PATH}/external/${GOARCH}/kernel.img
143+
144+
cd ${DEVICE_CACHE_PATH} && \
145+
${MAKE} ${KERNEL_MAKE_ARGS} INSTALL_MOD_PATH=${KERNEL_DRIVERS_PATH}/ INSTALL_MOD_STRIP=1 modules_install
125146

126147
${DEVICE_CACHE_PATH}/variables: ${CURDIR}/external/${GOARCH}/variables
127148
@mkdir -p $(dir $@)
@@ -135,7 +156,6 @@ ${DISK_IMAGE}: ${GENIMAGE_DEPS} ${KERNEL_IMAGE} ${INITRAMFS_IMAGE} ${SYSTEM_IMAG
135156
-kernel ${KERNEL_IMAGE} \
136157
-initrd ${INITRAMFS_IMAGE} \
137158
-rootfs ${SYSTEM_IMAGE} \
138-
-protocol ${KERNEL} \
139159
-kargs "${KARGS}" \
140160
-limine-path ${CURDIR}/external/${GOARCH} \
141161
-out $@
@@ -147,7 +167,7 @@ ${SYSTEM_PATH}/apps/%/manifest.json:
147167
@mkdir -p $(dir $@)
148168
cp $(@:${SYSTEM_PATH}/%=${CURDIR}/%) $@
149169

150-
${SYSTEM_PATH}/apps/%/icon.png:
170+
${SYSTEM_PATH}/apps/%/icon.svg:
151171
@mkdir -p $(dir $@)
152172
cp $(@:${SYSTEM_PATH}/%=${CURDIR}/%) $@
153173

@@ -166,6 +186,8 @@ ${SYSTEM_PATH}/cmd/dlv:
166186
GOOS=linux GOARCH=${GOARCH} CGO_ENABLED=0 ${GO} build ${GOFLAGS} -o $@ github.com/go-delve/delve/cmd/dlv
167187

168188
${SYSTEM_IMAGE}: $(addprefix ${SYSTEM_PATH}/,${SYSTEM_TARGETS})
189+
@rm -rf ${SYSTEM_PATH}/drivers
190+
[ -d ${KERNEL_DRIVERS_PATH} ] && cp ${KERNEL_DRIVERS_PATH} ${SYSTEM_PATH}/drivers || true
169191
mksquashfs ${SYSTEM_PATH} ${SYSTEM_IMAGE} -noappend -all-root -quiet
170192

171193
${INITRAMFS_PATH}/%: ${SYSTEM_PATH}/%

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<p align="center">
2-
<img src="data/icons/logo/logo.png" width="180" alt="AvyOS Logo"/>
2+
<img src="data/icons/logo/logo.png" width="180" alt="Avyos Logo"/>
33
</p>
44

5-
<h1 align="center">AvyOS</h1>
5+
<h1 align="center">Avyos</h1>
66

77
<p align="center">
88
A Linux-based operating system written entirely in pure Go —<br/>

0 commit comments

Comments
 (0)