fix: multiboot in stpdboot.sys
Some checks are pending
Build / test (push) Waiting to run
Docs / test (push) Waiting to run

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-03-20 10:48:47 +01:00
parent 6b36d17a5e
commit 9aaad60e6e
6 changed files with 383 additions and 374 deletions

View file

@ -14,7 +14,7 @@ SUBDIRS := tools boot kernel lib bin
TARGET = stupid.tar.gz floppy_boot.img
ifneq ($(OS),Windows_NT)
EXEXT =
TARGET += stupid.iso stdupid.hdd
TARGET += stupid.iso stupid.hdd
else
EXEXT = .exe
endif

View file

@ -2,16 +2,19 @@
INCLUDE 'multiboot.inc'
ORG STAGE1_BASE
USE16
USE32
jmp _start
mb_header MultibootHeader mb_header
ALIGN 4
multiboot_header:
mb_header MultibootHeader multiboot_header
_start:
cmp eax, MULTIBOOT_MAGIC
je .multiboot
USE16
;; non multiboot process
push cs
pop ds

View file

@ -4,6 +4,7 @@ LF = 0x0A
; -------- Address ----------
STAGE0_BASE = 0x7C00
STAGE1_BASE = 0x1000
MULTIBOOT_BASE = 0x100000
DISK_BUFFER = 0x8000
KERNEL_PRELOAD = 0xF000
STACK_TOP = 0x7000

View file

@ -4,7 +4,8 @@ MULTIBOOT_MAGIC = 0x2BADB002
MULTIBOOT_HDR_ALIGN = 0x1
MULTIBOOT_HDR_MEMINFO = 0x2
MULTIBOOT_HDR_VIDEO = 0x4
MULTIBOOT_FLAGS = MULTIBOOT_HDR_ALIGN or MULTIBOOT_HDR_MEMINFO or MULTIBOOT_HDR_VIDEO
MULTIBOOT_HDR_AOUT_KLUDGE = 0x10000
MULTIBOOT_FLAGS = MULTIBOOT_HDR_ALIGN or MULTIBOOT_HDR_MEMINFO or MULTIBOOT_HDR_VIDEO or MULTIBOOT_HDR_AOUT_KLUDGE
struc MultibootHeader addr
{
@ -15,8 +16,8 @@ struc MultibootHeader addr
; address fields (we'll just skip them)
.header_addr dd addr
.load_addr dd STAGE1_BASE
.load_end_addr dd _edata - STAGE1_BASE
.bss_end_addr dd _end - STAGE1_BASE
.load_end_addr dd _edata
.bss_end_addr dd _end
.entry_addr dd _start
; Video mode

View file

@ -8,7 +8,8 @@ set default=0
menuentry "StupidOS" {
echo "verify system integrity"
hashsum --hash sha256 --check /boot/hashfile --prefix /
multiboot /vmstupid
multiboot /stpdboot.sys
module /vmstupid.sys
boot
}
@ -18,7 +19,10 @@ EOF
gen_iso_file() {
mkdir -p "$2/boot/grub"
echo "$grub_config" > "$2/boot/grub/grub.cfg"
sha256sum "$2/vmstupid" > "$2/boot/hashfile"
sha256sum "$2/vmstupid.sys" > "$2/boot/hashfile"
sha256sum "$2/stpdboot.sys" >> "$2/boot/hashfile"
grub-file --is-x86-multiboot "$2/stpdboot.sys" || exit 1
grub-mkrescue -o $1 $2
}