fix: multiboot in stpdboot.sys
This commit is contained in:
parent
6b36d17a5e
commit
9aaad60e6e
132
Makefile
132
Makefile
|
@ -1,66 +1,66 @@
|
||||||
.EXPORT_ALL_VARIABLES:
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
|
||||||
TOPDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
TOPDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
SYSROOTDIR := $(TOPDIR)/sysroot
|
SYSROOTDIR := $(TOPDIR)/sysroot
|
||||||
TOOLSDIR := $(TOPDIR)/tools
|
TOOLSDIR := $(TOPDIR)/tools
|
||||||
|
|
||||||
RM = echo
|
RM = echo
|
||||||
|
|
||||||
MK_BUGREPORT := \"https://git.cute.engineering/d0p1/StupidOS/issues\"
|
MK_BUGREPORT := \"https://git.cute.engineering/d0p1/StupidOS/issues\"
|
||||||
MK_COMMIT := \"$(shell git rev-parse --short HEAD)\"
|
MK_COMMIT := \"$(shell git rev-parse --short HEAD)\"
|
||||||
|
|
||||||
SUBDIRS := tools boot kernel lib bin
|
SUBDIRS := tools boot kernel lib bin
|
||||||
|
|
||||||
TARGET = stupid.tar.gz floppy_boot.img
|
TARGET = stupid.tar.gz floppy_boot.img
|
||||||
ifneq ($(OS),Windows_NT)
|
ifneq ($(OS),Windows_NT)
|
||||||
EXEXT =
|
EXEXT =
|
||||||
TARGET += stupid.iso stdupid.hdd
|
TARGET += stupid.iso stupid.hdd
|
||||||
else
|
else
|
||||||
EXEXT = .exe
|
EXEXT = .exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
GOAL:=install
|
GOAL:=install
|
||||||
clean: GOAL:=clean
|
clean: GOAL:=clean
|
||||||
|
|
||||||
.PHONY: $(SUBDIRS)
|
.PHONY: $(SUBDIRS)
|
||||||
$(SUBDIRS):
|
$(SUBDIRS):
|
||||||
@echo "📁 $@"
|
@echo "📁 $@"
|
||||||
DESTDIR=$(SYSROOTDIR) $(MAKE) -C $@ $(GOAL)
|
DESTDIR=$(SYSROOTDIR) $(MAKE) -C $@ $(GOAL)
|
||||||
|
|
||||||
.PHONY: stupid.iso
|
.PHONY: stupid.iso
|
||||||
stupid.iso: $(SUBDIRS)
|
stupid.iso: $(SUBDIRS)
|
||||||
$(TOPDIR)/tools/create-iso $@ sysroot
|
$(TOPDIR)/tools/create-iso $@ sysroot
|
||||||
|
|
||||||
.PHONY: stupid.hdd
|
.PHONY: stupid.hdd
|
||||||
stupid.hdd: $(SUBDIRS)
|
stupid.hdd: $(SUBDIRS)
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
||||||
.PHONY: stupid.tar.gz
|
.PHONY: stupid.tar.gz
|
||||||
stupid.tar.gz: $(SUBDIRS)
|
stupid.tar.gz: $(SUBDIRS)
|
||||||
tar -czvf $@ sysroot
|
tar -czvf $@ sysroot
|
||||||
|
|
||||||
.PHONY: floppy_boot.img
|
.PHONY: floppy_boot.img
|
||||||
floppy_boot.img: $(SUBDIRS)
|
floppy_boot.img: $(SUBDIRS)
|
||||||
dd if=/dev/zero of=$@ bs=512 count=1440
|
dd if=/dev/zero of=$@ bs=512 count=1440
|
||||||
mformat -C -f 1440 -i $@
|
mformat -C -f 1440 -i $@
|
||||||
dd if=boot/bootsector.bin of=$@ conv=notrunc
|
dd if=boot/bootsector.bin of=$@ conv=notrunc
|
||||||
mcopy -i $@ boot/stpdboot.sys ::/STPDBOOT.SYS
|
mcopy -i $@ boot/stpdboot.sys ::/STPDBOOT.SYS
|
||||||
mcopy -i $@ kernel/vmstupid.sys ::/VMSTUPID.SYS
|
mcopy -i $@ kernel/vmstupid.sys ::/VMSTUPID.SYS
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run: all
|
run: all
|
||||||
qemu-system-i386 \
|
qemu-system-i386 \
|
||||||
-rtc base=localtime \
|
-rtc base=localtime \
|
||||||
-drive file=floppy_boot.img,if=none,format=raw,id=boot \
|
-drive file=floppy_boot.img,if=none,format=raw,id=boot \
|
||||||
-drive file=fat:rw:./sysroot,if=none,id=hdd \
|
-drive file=fat:rw:./sysroot,if=none,id=hdd \
|
||||||
-device floppy,drive=boot \
|
-device floppy,drive=boot \
|
||||||
-device ide-hd,drive=hdd \
|
-device ide-hd,drive=hdd \
|
||||||
-global isa-fdc.bootindexA=0 \
|
-global isa-fdc.bootindexA=0 \
|
||||||
-serial mon:stdio
|
-serial mon:stdio
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: $(SUBDIRS)
|
clean: $(SUBDIRS)
|
||||||
$(RM) $(TARGET) $(SYSROOTDIR)
|
$(RM) $(TARGET) $(SYSROOTDIR)
|
||||||
|
|
240
boot/boot0.asm
240
boot/boot0.asm
|
@ -1,120 +1,120 @@
|
||||||
INCLUDE 'const.inc'
|
INCLUDE 'const.inc'
|
||||||
|
|
||||||
ORG STAGE0_BASE
|
ORG STAGE0_BASE
|
||||||
USE16
|
USE16
|
||||||
|
|
||||||
jmp short _start
|
jmp short _start
|
||||||
nop
|
nop
|
||||||
|
|
||||||
; Boot Record
|
; Boot Record
|
||||||
OEM_identifier db 'STUPID '
|
OEM_identifier db 'STUPID '
|
||||||
bytes_per_sector dw 512
|
bytes_per_sector dw 512
|
||||||
sectors_per_cluster db 1
|
sectors_per_cluster db 1
|
||||||
reserved_sectors dw 1
|
reserved_sectors dw 1
|
||||||
FAT_count db 2
|
FAT_count db 2
|
||||||
root_dir_entries dw 224
|
root_dir_entries dw 224
|
||||||
total_sectors dw 2880
|
total_sectors dw 2880
|
||||||
media_desc_type db 0xF0
|
media_desc_type db 0xF0
|
||||||
sectors_per_FAT dw 9
|
sectors_per_FAT dw 9
|
||||||
sectors_per_track dw 18
|
sectors_per_track dw 18
|
||||||
heads_per_cylinder dw 2
|
heads_per_cylinder dw 2
|
||||||
hidden_sectors dd 0
|
hidden_sectors dd 0
|
||||||
large_sector_count dd 0
|
large_sector_count dd 0
|
||||||
|
|
||||||
; Extended Boot Record
|
; Extended Boot Record
|
||||||
drive_number db 0x0
|
drive_number db 0x0
|
||||||
reserved db 0x0
|
reserved db 0x0
|
||||||
signature db 0x29 ; 0x28 or 0x29
|
signature db 0x29 ; 0x28 or 0x29
|
||||||
volume_id dd 0xB00B135 ; hope mine will grow :'(
|
volume_id dd 0xB00B135 ; hope mine will grow :'(
|
||||||
volume_label db 'Stupid Boot'
|
volume_label db 'Stupid Boot'
|
||||||
system_id db 'FAT12 '
|
system_id db 'FAT12 '
|
||||||
|
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
cli
|
cli
|
||||||
cld
|
cld
|
||||||
jmp 0x0:.canonicalize_cs
|
jmp 0x0:.canonicalize_cs
|
||||||
|
|
||||||
.canonicalize_cs:
|
.canonicalize_cs:
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov ss, ax
|
mov ss, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov sp, 0x7c00
|
mov sp, 0x7c00
|
||||||
|
|
||||||
mov [drive_number], dl
|
mov [drive_number], dl
|
||||||
|
|
||||||
; reset floppy disk
|
; reset floppy disk
|
||||||
@@:
|
@@:
|
||||||
mov dl, [drive_number]
|
mov dl, [drive_number]
|
||||||
xor ah, ah
|
xor ah, ah
|
||||||
int 0x13
|
int 0x13
|
||||||
jc @b
|
jc @b
|
||||||
|
|
||||||
call fat_load_root
|
call fat_load_root
|
||||||
|
|
||||||
; search in root directory
|
; search in root directory
|
||||||
|
|
||||||
mov si, kernel_file
|
mov si, kernel_file
|
||||||
call fat_search_root
|
call fat_search_root
|
||||||
jc .error_not_found
|
jc .error_not_found
|
||||||
mov [kernel_start], ax
|
mov [kernel_start], ax
|
||||||
|
|
||||||
mov si, stage1_file
|
mov si, stage1_file
|
||||||
call fat_search_root
|
call fat_search_root
|
||||||
jc .error_not_found
|
jc .error_not_found
|
||||||
mov [stage1_start], ax
|
mov [stage1_start], ax
|
||||||
|
|
||||||
; load fat
|
; load fat
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
mov al, [FAT_count]
|
mov al, [FAT_count]
|
||||||
mul word [sectors_per_FAT]
|
mul word [sectors_per_FAT]
|
||||||
mov cx, ax
|
mov cx, ax
|
||||||
mov ax, [reserved_sectors]
|
mov ax, [reserved_sectors]
|
||||||
|
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
|
|
||||||
call disk_read_sectors
|
call disk_read_sectors
|
||||||
|
|
||||||
; preload kernel
|
; preload kernel
|
||||||
mov ax, KERNEL_PRELOAD/0x10
|
mov ax, KERNEL_PRELOAD/0x10
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov ax, [kernel_start]
|
mov ax, [kernel_start]
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
call fat_load_binary
|
call fat_load_binary
|
||||||
|
|
||||||
; load stage 2
|
; load stage 2
|
||||||
mov ax, STAGE1_BASE/0x10
|
mov ax, STAGE1_BASE/0x10
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov ax, [stage1_start]
|
mov ax, [stage1_start]
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
call fat_load_binary
|
call fat_load_binary
|
||||||
|
|
||||||
jmp 0x0:STAGE1_BASE
|
jmp 0x0:STAGE1_BASE
|
||||||
|
|
||||||
.error_not_found:
|
.error_not_found:
|
||||||
push si
|
push si
|
||||||
mov si, msg_error
|
mov si, msg_error
|
||||||
call bios_print
|
call bios_print
|
||||||
pop si
|
pop si
|
||||||
call bios_print
|
call bios_print
|
||||||
mov si, msg_not_found
|
mov si, msg_not_found
|
||||||
call bios_print
|
call bios_print
|
||||||
hlt
|
hlt
|
||||||
jmp $
|
jmp $
|
||||||
|
|
||||||
INCLUDE "utils.inc"
|
INCLUDE "utils.inc"
|
||||||
INCLUDE "fat12.inc"
|
INCLUDE "fat12.inc"
|
||||||
|
|
||||||
msg_error db "ERROR: ", 0
|
msg_error db "ERROR: ", 0
|
||||||
msg_not_found db " not found", CR, LF, 0
|
msg_not_found db " not found", CR, LF, 0
|
||||||
|
|
||||||
kernel_file db "VMSTUPIDSYS", 0
|
kernel_file db "VMSTUPIDSYS", 0
|
||||||
stage1_file db "STPDBOOTSYS", 0
|
stage1_file db "STPDBOOTSYS", 0
|
||||||
|
|
||||||
kernel_start dw 0x0
|
kernel_start dw 0x0
|
||||||
stage1_start dw 0x0
|
stage1_start dw 0x0
|
||||||
|
|
||||||
|
|
||||||
rb 0x7C00+512-2-$
|
rb 0x7C00+512-2-$
|
||||||
db 0x55, 0xAA
|
db 0x55, 0xAA
|
||||||
|
|
133
boot/boot1.asm
133
boot/boot1.asm
|
@ -1,65 +1,68 @@
|
||||||
INCLUDE 'const.inc'
|
INCLUDE 'const.inc'
|
||||||
INCLUDE 'multiboot.inc'
|
INCLUDE 'multiboot.inc'
|
||||||
|
|
||||||
ORG STAGE1_BASE
|
ORG STAGE1_BASE
|
||||||
USE16
|
USE32
|
||||||
|
|
||||||
jmp _start
|
jmp _start
|
||||||
|
|
||||||
mb_header MultibootHeader mb_header
|
ALIGN 4
|
||||||
|
multiboot_header:
|
||||||
_start:
|
mb_header MultibootHeader multiboot_header
|
||||||
cmp eax, MULTIBOOT_MAGIC
|
|
||||||
je .multiboot
|
_start:
|
||||||
|
cmp eax, MULTIBOOT_MAGIC
|
||||||
;; non multiboot process
|
je .multiboot
|
||||||
push cs
|
|
||||||
pop ds
|
USE16
|
||||||
|
;; non multiboot process
|
||||||
mov si, msg_stage2
|
push cs
|
||||||
call bios_print
|
pop ds
|
||||||
|
|
||||||
call a20_enable
|
mov si, msg_stage2
|
||||||
jc .error_a20
|
call bios_print
|
||||||
|
|
||||||
; detect memory
|
call a20_enable
|
||||||
call memory_get_map
|
jc .error_a20
|
||||||
jc .error_memory
|
|
||||||
xchg bx, bx
|
; detect memory
|
||||||
|
call memory_get_map
|
||||||
call video_setup
|
jc .error_memory
|
||||||
|
xchg bx, bx
|
||||||
.multiboot:
|
|
||||||
jmp .hang
|
call video_setup
|
||||||
|
|
||||||
.error_memory:
|
.multiboot:
|
||||||
mov si, msg_error_memory
|
jmp .hang
|
||||||
jmp .error
|
|
||||||
.error_a20:
|
.error_memory:
|
||||||
mov si, msg_error_a20
|
mov si, msg_error_memory
|
||||||
.error:
|
jmp .error
|
||||||
call bios_print
|
.error_a20:
|
||||||
.hang:
|
mov si, msg_error_a20
|
||||||
hlt
|
.error:
|
||||||
jmp $
|
call bios_print
|
||||||
|
.hang:
|
||||||
INCLUDE 'a20.inc'
|
hlt
|
||||||
INCLUDE 'utils.inc'
|
jmp $
|
||||||
INCLUDE 'memory.inc'
|
|
||||||
INCLUDE 'video.inc'
|
INCLUDE 'a20.inc'
|
||||||
|
INCLUDE 'utils.inc'
|
||||||
msg_stage2 db "StupidOS Bootloader (Stage 1)", CR, LF, 0
|
INCLUDE 'memory.inc'
|
||||||
msg_error_a20 db "ERROR: can't enable a20 line", CR, LF, 0
|
INCLUDE 'video.inc'
|
||||||
msg_error_memory db "ERROR: can't detect available memory", CR, LF, 0
|
|
||||||
|
msg_stage2 db "StupidOS Bootloader (Stage 1)", CR, LF, 0
|
||||||
|
msg_error_a20 db "ERROR: can't enable a20 line", CR, LF, 0
|
||||||
;;
|
msg_error_memory db "ERROR: can't detect available memory", CR, LF, 0
|
||||||
bi_screen_width: dw 0
|
|
||||||
bi_screen_height: dw 0
|
|
||||||
|
;;
|
||||||
_edata:
|
bi_screen_width: dw 0
|
||||||
|
bi_screen_height: dw 0
|
||||||
; BSS
|
|
||||||
rb 0x4000
|
_edata:
|
||||||
|
|
||||||
_end:
|
; BSS
|
||||||
|
rb 0x4000
|
||||||
|
|
||||||
|
_end:
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
CR = 0x0D
|
CR = 0x0D
|
||||||
LF = 0x0A
|
LF = 0x0A
|
||||||
|
|
||||||
; -------- Address ----------
|
; -------- Address ----------
|
||||||
STAGE0_BASE = 0x7C00
|
STAGE0_BASE = 0x7C00
|
||||||
STAGE1_BASE = 0x1000
|
STAGE1_BASE = 0x1000
|
||||||
DISK_BUFFER = 0x8000
|
MULTIBOOT_BASE = 0x100000
|
||||||
KERNEL_PRELOAD = 0xF000
|
DISK_BUFFER = 0x8000
|
||||||
STACK_TOP = 0x7000
|
KERNEL_PRELOAD = 0xF000
|
||||||
|
STACK_TOP = 0x7000
|
||||||
; ---------- Video ------------
|
|
||||||
VIDEO_WIDTH = 1024
|
; ---------- Video ------------
|
||||||
VIDEO_HEIGHT = 768
|
VIDEO_WIDTH = 1024
|
||||||
VIDEO_DEPTH = 32
|
VIDEO_HEIGHT = 768
|
||||||
|
VIDEO_DEPTH = 32
|
||||||
|
|
|
@ -1,107 +1,108 @@
|
||||||
MULTIBOOT_HDR_MAGIC = 0x1BADB002
|
MULTIBOOT_HDR_MAGIC = 0x1BADB002
|
||||||
MULTIBOOT_MAGIC = 0x2BADB002
|
MULTIBOOT_MAGIC = 0x2BADB002
|
||||||
|
|
||||||
MULTIBOOT_HDR_ALIGN = 0x1
|
MULTIBOOT_HDR_ALIGN = 0x1
|
||||||
MULTIBOOT_HDR_MEMINFO = 0x2
|
MULTIBOOT_HDR_MEMINFO = 0x2
|
||||||
MULTIBOOT_HDR_VIDEO = 0x4
|
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
|
|
||||||
{
|
struc MultibootHeader addr
|
||||||
.magic dd MULTIBOOT_HDR_MAGIC
|
{
|
||||||
.flags dd MULTIBOOT_FLAGS
|
.magic dd MULTIBOOT_HDR_MAGIC
|
||||||
.checksum dd -(MULTIBOOT_HDR_MAGIC + MULTIBOOT_FLAGS)
|
.flags dd MULTIBOOT_FLAGS
|
||||||
|
.checksum dd -(MULTIBOOT_HDR_MAGIC + MULTIBOOT_FLAGS)
|
||||||
; address fields (we'll just skip them)
|
|
||||||
.header_addr dd addr
|
; address fields (we'll just skip them)
|
||||||
.load_addr dd STAGE1_BASE
|
.header_addr dd addr
|
||||||
.load_end_addr dd _edata - STAGE1_BASE
|
.load_addr dd STAGE1_BASE
|
||||||
.bss_end_addr dd _end - STAGE1_BASE
|
.load_end_addr dd _edata
|
||||||
.entry_addr dd _start
|
.bss_end_addr dd _end
|
||||||
|
.entry_addr dd _start
|
||||||
; Video mode
|
|
||||||
.mode_type dd 0x0
|
; Video mode
|
||||||
.width dd VIDEO_WIDTH
|
.mode_type dd 0x0
|
||||||
.height dd VIDEO_HEIGHT
|
.width dd VIDEO_WIDTH
|
||||||
.depth dd VIDEO_DEPTH
|
.height dd VIDEO_HEIGHT
|
||||||
}
|
.depth dd VIDEO_DEPTH
|
||||||
|
}
|
||||||
struc MultibootData
|
|
||||||
{
|
struc MultibootData
|
||||||
.flags dd ?
|
{
|
||||||
|
.flags dd ?
|
||||||
; if flags[0] is set
|
|
||||||
.mem_lower dd ?
|
; if flags[0] is set
|
||||||
.mem_upper dd ?
|
.mem_lower dd ?
|
||||||
|
.mem_upper dd ?
|
||||||
; if flags[1] is set
|
|
||||||
.boot_device dd ?
|
; if flags[1] is set
|
||||||
|
.boot_device dd ?
|
||||||
; if flags[2] is set
|
|
||||||
.cmdline dd ?
|
; if flags[2] is set
|
||||||
|
.cmdline dd ?
|
||||||
; if flags[3] is set
|
|
||||||
.mods_count dd ?
|
; if flags[3] is set
|
||||||
.mods_addr dd ?
|
.mods_count dd ?
|
||||||
|
.mods_addr dd ?
|
||||||
; if flags[4] is set
|
|
||||||
.syms dd 4 dup ?
|
; if flags[4] is set
|
||||||
|
.syms dd 4 dup ?
|
||||||
; if flags[6] is set
|
|
||||||
.mmap_length dd ?
|
; if flags[6] is set
|
||||||
.mmap_addr dd ?
|
.mmap_length dd ?
|
||||||
|
.mmap_addr dd ?
|
||||||
; if flags[7] is set
|
|
||||||
.drives_length dd ?
|
; if flags[7] is set
|
||||||
.drives_addr dd ?
|
.drives_length dd ?
|
||||||
|
.drives_addr dd ?
|
||||||
; if flags[8] is set
|
|
||||||
.config_table dd ?
|
; if flags[8] is set
|
||||||
|
.config_table dd ?
|
||||||
; if flags[9] is set
|
|
||||||
.bootloader_name dd ?
|
; if flags[9] is set
|
||||||
|
.bootloader_name dd ?
|
||||||
; if flags[10] is set
|
|
||||||
.apm_table dd ?
|
; if flags[10] is set
|
||||||
|
.apm_table dd ?
|
||||||
; if flags[11] is set
|
|
||||||
.vbe_control_info dd ?
|
; if flags[11] is set
|
||||||
.vbe_mode_info dd ?
|
.vbe_control_info dd ?
|
||||||
.vbe_mode dw ?
|
.vbe_mode_info dd ?
|
||||||
.vbe_if_seg dw ?
|
.vbe_mode dw ?
|
||||||
.vbe_if_off dw ?
|
.vbe_if_seg dw ?
|
||||||
.vbe_if_length dw ?
|
.vbe_if_off dw ?
|
||||||
|
.vbe_if_length dw ?
|
||||||
; if flags[12] is set
|
|
||||||
.fb_addr dq ?
|
; if flags[12] is set
|
||||||
.fb_pitch dd ?
|
.fb_addr dq ?
|
||||||
.fb_width dd ?
|
.fb_pitch dd ?
|
||||||
.fb_height dd ?
|
.fb_width dd ?
|
||||||
.fb_bpp db ?
|
.fb_height dd ?
|
||||||
.fb_type db ?
|
.fb_bpp db ?
|
||||||
.fb_misc dw 3 dup ?
|
.fb_type db ?
|
||||||
}
|
.fb_misc dw 3 dup ?
|
||||||
|
}
|
||||||
MULTIBOOT_DATA_MEM = 0x0001
|
|
||||||
MULTIBOOT_DATA_BOOTDEV = 0x0002
|
MULTIBOOT_DATA_MEM = 0x0001
|
||||||
MULTIBOOT_DATA_CMDLINE = 0x0004
|
MULTIBOOT_DATA_BOOTDEV = 0x0002
|
||||||
MULTIBOOT_DATA_MODULES = 0x0008
|
MULTIBOOT_DATA_CMDLINE = 0x0004
|
||||||
MULTIBOOT_DATA_MMAP = 0x0040
|
MULTIBOOT_DATA_MODULES = 0x0008
|
||||||
MULTIBOOT_DATA_DRIVES = 0x0080
|
MULTIBOOT_DATA_MMAP = 0x0040
|
||||||
MULTIBOOT_DATA_BOOTLOADER_NAME = 0x0200
|
MULTIBOOT_DATA_DRIVES = 0x0080
|
||||||
MULTIBOOT_DATA_VBE = 0x0800
|
MULTIBOOT_DATA_BOOTLOADER_NAME = 0x0200
|
||||||
MULTIBOOT_DATA_FB = 0x1000
|
MULTIBOOT_DATA_VBE = 0x0800
|
||||||
|
MULTIBOOT_DATA_FB = 0x1000
|
||||||
struc MultibootMMap
|
|
||||||
{
|
struc MultibootMMap
|
||||||
.size dd ?
|
{
|
||||||
.addr dq ?
|
.size dd ?
|
||||||
.length dq ?
|
.addr dq ?
|
||||||
.type dd ?
|
.length dq ?
|
||||||
}
|
.type dd ?
|
||||||
|
}
|
||||||
MULTIBOOT_MEMORY_AVAILABLE = 0x1
|
|
||||||
MULTIBOOT_MEMORY_RESERVED = 0x2
|
MULTIBOOT_MEMORY_AVAILABLE = 0x1
|
||||||
MULTIBOOT_MEMORY_ACPI = 0x3
|
MULTIBOOT_MEMORY_RESERVED = 0x2
|
||||||
MULTIBOOT_MEMORY_NVS = 0x4
|
MULTIBOOT_MEMORY_ACPI = 0x3
|
||||||
MULTIBOOT_MEMORY_BADPARAM = 0x5
|
MULTIBOOT_MEMORY_NVS = 0x4
|
||||||
|
MULTIBOOT_MEMORY_BADPARAM = 0x5
|
||||||
|
|
|
@ -8,7 +8,8 @@ set default=0
|
||||||
menuentry "StupidOS" {
|
menuentry "StupidOS" {
|
||||||
echo "verify system integrity"
|
echo "verify system integrity"
|
||||||
hashsum --hash sha256 --check /boot/hashfile --prefix /
|
hashsum --hash sha256 --check /boot/hashfile --prefix /
|
||||||
multiboot /vmstupid
|
multiboot /stpdboot.sys
|
||||||
|
module /vmstupid.sys
|
||||||
boot
|
boot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +19,10 @@ EOF
|
||||||
gen_iso_file() {
|
gen_iso_file() {
|
||||||
mkdir -p "$2/boot/grub"
|
mkdir -p "$2/boot/grub"
|
||||||
echo "$grub_config" > "$2/boot/grub/grub.cfg"
|
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
|
grub-mkrescue -o $1 $2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue