From 1110bc9ac7ca5aa4ab09c1be0c8b0c59931636bb Mon Sep 17 00:00:00 2001 From: d0p1 Date: Tue, 28 May 2024 13:50:12 +0200 Subject: [PATCH] ci: code analysis --- .github/workflows/analyze.yml | 26 ++++++++++++++++++++++++++ Makefile | 9 +++------ boot/loader/disk.inc | 4 ---- boot/loader/loader.asm | 3 +-- 4 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/analyze.yml diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml new file mode 100644 index 0000000..b32636d --- /dev/null +++ b/.github/workflows/analyze.yml @@ -0,0 +1,26 @@ +name: Code Analysis + +on: + push: + branches: + - main + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt update + sudo apt install shellcheck cppcheck + + - name: Run shellcheck + run: | + shellcheck ./build.sh ./releasetools/cdimage.sh ./releasetools/floppyimage.sh ./releasetools/hdimages.sh ./releasetools/image.defaults ./releasetools/images.functions + + - name: Run CppCheck + run: | + cppcheck -x c --std=c89 --quiet --error-exitcode=2 include sbin bin diff --git a/Makefile b/Makefile index 0305c0e..de18fb2 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,10 @@ RM = rm -f MK_BUGREPORT := \"https://git.cute.engineering/d0p1/StupidOS/issues\" MK_COMMIT := \"$(shell git rev-parse --short HEAD)\" -ifneq (,$(findstring cl,$(CC))) -CFLAGS = /TC /D MK_COMMIT="$(MK_COMMIT)" /DMK_BUGREPORT="$(MK_BUGREPORT)" /INCLUDE:$(TOPDIR)include -LDFLAGS = /SUBSYSTEM:CONSOLE -else + CFLAGS = -DMK_COMMIT="$(MK_COMMIT)" -DMK_BUGREPORT="$(MK_BUGREPORT)" -I$(TOPDIR)include LDFLAGS = -endif + QEMU_COMMON = \ -rtc base=localtime \ @@ -93,7 +90,7 @@ run: all -drive file=fat:rw:./sysroot,if=none,id=hdd \ -device floppy,drive=boot \ -device ide-hd,drive=hdd \ - -global isa-fdc.bootindexA=0 \ + -global isa-fdc.bootindexA=0 .PHONY: run-iso run-iso: all diff --git a/boot/loader/disk.inc b/boot/loader/disk.inc index ef312b4..47412d9 100644 --- a/boot/loader/disk.inc +++ b/boot/loader/disk.inc @@ -1,7 +1,3 @@ -struc -{ - .boot_jmp db 3 dup(?) -} disk_read_sectors: test byte [drive_lba], 1 diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index b920a89..8454a38 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -123,10 +123,9 @@ drive_lba db 0 msg_stage2 db "StupidOS Loader", 0 kernel_fat12_file db "VMSTUPIDSYS", 0 -config_fat12_file db "BOOT INI", 0 msg_error_a20 db "ERROR: can't enable a20 line", 0 msg_error_memory db "ERROR: can't detect available memory", 0 -msg_error_sector db "ERROR: reading sector", CR, LF, 0 +msg_error_sector db "ERROR: reading sector", CR, LF, 0 msg_error_not_found db "ERROR: kernel not found", 0 use32