Skip to content

Commit 46d617d

Browse files
committed
feat(kernel): updated support for real hardware
Signed-off-by: Manjeet Singh <itsmanjeet1998@gmail.com>
1 parent 2ee6dab commit 46d617d

File tree

12 files changed

+8805
-1844
lines changed

12 files changed

+8805
-1844
lines changed

.github/.vscode/settings.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/build-and-release.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,43 @@ on:
33
push:
44
branches:
55
- main
6+
- next
67
tags:
7-
- '*'
8+
- "*"
89
pull_request:
910

1011
env:
1112
SOURCE_DATE_EPOCH: 1700000000
1213
RELEASE: 1
14+
CACHE_PATH: ${{secrets.CACHE_PATH}}
1315

1416
jobs:
1517
build:
1618
if: github.event_name != 'pull_request'
17-
runs-on: ubuntu-latest
19+
runs-on: self-hosted
1820
strategy:
1921
matrix:
20-
arch: [amd64, arm64]
22+
device: [qemu]
23+
arch: [amd64]
2124
steps:
2225
- uses: actions/checkout@v5
2326

24-
- name: Install requirements
25-
run: sudo apt-get update -y && sudo apt-get install -y parted zip
26-
27-
- name: Cleanup cache
28-
run: rm -rf _cache
27+
- name: Update Compile Database
28+
run: make GOARCH=${{matrix.arch}} compile_db
2929

3030
- name: update-kernel
3131
run: make GOARCH=${{matrix.arch}} update-kernel -j$(nproc)
3232

3333
- name: Build
34-
run: |
35-
PATH=$PATH:/usr/sbin make GOARCH=${{matrix.arch}} -j$(nproc)
34+
run: PATH=$PATH:/usr/sbin make GOARCH=${{matrix.arch}} -j$(nproc)
3635

3736
- name: Compress Image
3837
run: |
39-
rm -rf _cache/${{matrix.arch}}/bundle
40-
mkdir -p _cache/${{matrix.arch}}/bundle
41-
cp -a _cache/${{matrix.arch}}/disk.img external/${{matrix.arch}}/firmware external/${{matrix.arch}}/variables _cache/${{matrix.arch}}/bundle/
42-
cd _cache/${{matrix.arch}}/bundle
43-
zip ../rlxos-${{github.ref_name}}-${{matrix.arch}}.zip disk.img firmware variables
38+
rm -rf ${CACHE_PATH}/${{matrix.device}}/${{matrix.arch}}/bundle
39+
mkdir -p ${CACHE_PATH}/${{matrix.device}}/${{matrix.arch}}/bundle
40+
cp -a ${CACHE_PATH}/${{matrix.device}}/${{matrix.arch}}/disk.img external/${{matrix.arch}}/firmware external/${{matrix.arch}}/variables ${CACHE_PATH}/${{matrix.device}}/${{matrix.arch}}/bundle/
41+
cd ${CACHE_PATH}/${{matrix.device}}/${{matrix.arch}}/bundle
42+
zip ../rlxos-${{github.ref_name}}-${{matrix.device}}-${{matrix.arch}}.zip disk.img firmware variables
4443
4544
- name: Create / Update Release and Upload Artifact
4645
uses: softprops/action-gh-release@v2
@@ -50,6 +49,6 @@ jobs:
5049
prerelease: ${{ github.ref_type != 'tag' }}
5150
allowUpdates: true
5251
files: |
53-
_cache/${{matrix.arch}}/rlxos-${{github.ref_name}}-${{matrix.arch}}.zip
52+
${CACHE_PATH}/${{matrix.device}}/${{matrix.arch}}/rlxos-${{github.ref_name}}-${{matrix.device}}-${{matrix.arch}}.zip
5453
env:
5554
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ DOCGEN_OUT ?= ${CACHE_PATH}/docs
1313
-include config.inc
1414

1515
DEVICE_CACHE_PATH ?= ${CACHE_PATH}/${DEVICE}/${GOARCH}
16-
16+
DEVICE_PATH := ${PROJECT_PATH}/devices/${DEVICE}/${GOARCH}
1717
SYSTEM_PATH ?= ${DEVICE_CACHE_PATH}/system
1818
SYSTEM_IMAGE ?= ${SYSTEM_PATH}.img
1919

@@ -43,7 +43,7 @@ endif
4343
ifeq (${GOARCH},arm64)
4444
KARGS ?= console=ttyAMA0,115200
4545
else
46-
KARGS ?= console=ttyS0 console=tty0
46+
KARGS ?= console=tty0 console=ttyS0
4747
endif
4848

4949

@@ -89,7 +89,7 @@ DATA_TARGETS = $(shell find data/ -type f)
8989
EXTERNAL_TARGETS =
9090
SYSTEM_TARGETS = $(GO_TARGETS) ${EXTERNAL_TARGETS} ${CONFIG_TARGETS} ${DATA_TARGETS} $(addsuffix /manifest.json,$(addprefix apps/,${APPS})) $(addsuffix /icon.svg,$(addprefix apps/,${APPS}))
9191

92-
INITRAMFS_TARGETS = init
92+
INITRAMFS_TARGETS = init cmd/driver
9393

9494
ifeq (${RELEASE},1)
9595
GOFLAGS += -buildvcs=false -trimpath -ldflags="-s -w -buildid="
@@ -142,7 +142,8 @@ update-kernel: ${DEVICE_CACHE_PATH}/kernel/Makefile
142142
cd ${DEVICE_CACHE_PATH}/kernel && \
143143
cp $$(${MAKE} ${KERNEL_MAKE_ARGS} -s image_name) ${PROJECT_PATH}/devices/${DEVICE}/${GOARCH}/kernel.img
144144

145-
cd ${DEVICE_CACHE_PATH} && \
145+
rm -rf ${KERNEL_DRIVERS_PATH}
146+
cd ${DEVICE_CACHE_PATH}/kernel && \
146147
${MAKE} ${KERNEL_MAKE_ARGS} INSTALL_MOD_PATH=${KERNEL_DRIVERS_PATH}/ INSTALL_MOD_STRIP=1 modules_install
147148

148149
${DEVICE_CACHE_PATH}/variables: ${CURDIR}/devices/${DEVICE}/${GOARCH}/variables
@@ -188,7 +189,10 @@ ${SYSTEM_PATH}/cmd/dlv:
188189

189190
${SYSTEM_IMAGE}: $(addprefix ${SYSTEM_PATH}/,${SYSTEM_TARGETS})
190191
@rm -rf ${SYSTEM_PATH}/drivers
191-
[ -d ${KERNEL_DRIVERS_PATH} ] && cp ${KERNEL_DRIVERS_PATH} ${SYSTEM_PATH}/drivers || true
192+
[ -d ${KERNEL_DRIVERS_PATH} ] && \
193+
mkdir -p ${SYSTEM_PATH}/drivers && \
194+
find ${KERNEL_DRIVERS_PATH} -type f -name "*.ko*" -exec cp -a {} ${SYSTEM_PATH}/drivers \; && \
195+
go run rlxos.org/cmd/driver -driver-path ${SYSTEM_PATH}/drivers -cache ${SYSTEM_PATH}/drivers/cache.json cache || true
192196
mksquashfs ${SYSTEM_PATH} ${SYSTEM_IMAGE} -noappend -all-root -quiet
193197

194198
${INITRAMFS_PATH}/%: ${SYSTEM_PATH}/%
@@ -199,7 +203,12 @@ ${INITRAMFS_PATH}/init: ${SYSTEM_PATH}/cmd/init
199203
@mkdir -p $(dir $@)
200204
cp -a $< $@
201205

202-
${INITRAMFS_IMAGE}: $(addprefix ${INITRAMFS_PATH}/,${INITRAMFS_TARGETS})
206+
${INITRAMFS_IMAGE}: $(addprefix ${INITRAMFS_PATH}/,${INITRAMFS_TARGETS}) ${SYSTEM_IMAGE}
207+
[ -d ${SYSTEM_PATH}/drivers ] && \
208+
rm -rf ${INITRAMFS_PATH}/drivers && \
209+
mkdir -p ${INITRAMFS_PATH}/drivers && \
210+
xargs -I {} cp -a ${SYSTEM_PATH}/drivers/{} ${INITRAMFS_PATH}/drivers < ${DEVICE_PATH}/initrd.list
211+
203212
(cd ${INITRAMFS_PATH}; find . -print0 | cpio --null --create --verbose --format=newc) > $@
204213

205214
-include depends.${GOARCH}.inc

cmd/driver/docs.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
44
Main subcommands:
55
- `list` shows loaded modules.
6-
- `load` loads a module file or name.
6+
- `load` loads a module by file path, name, or modalias (alias). Dependencies
7+
are resolved and loaded automatically from the cache.
78
- `unload` removes a loaded module.
89
- `info` and `deps` show module details.
10+
- `cache` scans /cache/kernel/drivers and /avyos/drivers, parses modules.alias
11+
and modules.dep, and writes a unified cache to /cache/kernel/drivers/cache.json.
912
1013
Example usage:
1114
```sh
15+
driver cache
1216
driver list
1317
driver load e1000e
18+
driver load "pci:v00008086d00001533sv*sd*bc*sc*i*"
1419
driver info e1000e
1520
driver deps e1000e
1621
driver unload e1000e

0 commit comments

Comments
 (0)