diff --git a/build/build-iso.sh b/build/build-iso.sh index e97d8874..2c62dc60 100755 --- a/build/build-iso.sh +++ b/build/build-iso.sh @@ -64,7 +64,7 @@ umount_tempdisk echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..." $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit -LIMINE_BINARY_BRANCH="v4.x-branch-binary" +LIMINE_BINARY_BRANCH="v5.x-branch-binary" if [ -d "limine" ] then @@ -74,8 +74,7 @@ then git remote set-head origin $LIMINE_BINARY_BRANCH git switch $LIMINE_BINARY_BRANCH git pull - rm limine-deploy - rm limine-version + rm limine cd .. fi @@ -84,13 +83,13 @@ if [ ! -d "limine" ]; then fi make -C limine -touch limine/Limine-HDD.HH -echo "/*\$WW,1\$" > limine/Limine-HDD.HH -cat limine/LICENSE.md >> limine/Limine-HDD.HH -echo "*/\$WW,0\$" >> limine/Limine-HDD.HH -cat limine/limine-hdd.h >> limine/Limine-HDD.HH -sed -i 's/const uint8_t/U8/g' limine/Limine-HDD.HH -sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-hdd.h | wc -l)\]/g" limine/Limine-HDD.HH +touch limine/Limine-BIOS-HDD.HH +echo "/*\$WW,1\$" > limine/Limine-BIOS-HDD.HH +cat limine/LICENSE >> limine/Limine-BIOS-HDD.HH +echo "*/\$WW,0\$" >> limine/Limine-BIOS-HDD.HH +cat limine/limine-bios-hdd.h >> limine/Limine-BIOS-HDD.HH +sed -i 's/const uint8_t/U8/g' limine/Limine-BIOS-HDD.HH +sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-bios-hdd.h | wc -l)\]/g" limine/Limine-BIOS-HDD.HH mount_tempdisk echo "Extracting MyDistro ISO from vdisk ..." @@ -101,11 +100,11 @@ sudo cp -rf $TMPMOUNT/* $TMPISODIR sudo rm $TMPISODIR/Boot/OldMBR.BIN 2> /dev/null sudo rm $TMPISODIR/Boot/BootMHD2.BIN 2> /dev/null sudo mkdir -p $TMPISODIR/EFI/BOOT -sudo cp limine/Limine-HDD.HH $TMPISODIR/Boot/Limine-HDD.HH +sudo cp limine/Limine-BIOS-HDD.HH $TMPISODIR/Boot/Limine-BIOS-HDD.HH sudo cp limine/BOOTX64.EFI $TMPISODIR/EFI/BOOT/BOOTX64.EFI -sudo cp limine/limine-cd-efi.bin $TMPISODIR/Boot/Limine-CD-EFI.BIN -sudo cp limine/limine-cd.bin $TMPISODIR/Boot/Limine-CD.BIN -sudo cp limine/limine.sys $TMPISODIR/Boot/Limine.SYS +sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN +sudo cp limine/limine-bios-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN +sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS sudo cp ../zealbooter/zealbooter.elf $TMPISODIR/Boot/ZealBooter.ELF sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..." @@ -113,13 +112,13 @@ sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null umount_tempdisk -xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-CD.BIN \ +xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-BIOS-CD.BIN \ -no-emul-boot -boot-load-size 4 -boot-info-table \ - --efi-boot Boot/Limine-CD-EFI.BIN \ + --efi-boot Boot/Limine-UEFI-CD.BIN \ -efi-boot-part --efi-boot-image --protective-msdos-label \ $TMPISODIR -o ZealOS-limine.iso -./limine/limine-deploy ZealOS-limine.iso +./limine/limine bios-install ZealOS-limine.iso if [ "$TESTING" = true ]; then if [ ! -d "ovmf" ]; then diff --git a/src/Misc/OSInstall.ZC b/src/Misc/OSInstall.ZC index ad876287..a51671c4 100755 --- a/src/Misc/OSInstall.ZC +++ b/src/Misc/OSInstall.ZC @@ -1,5 +1,5 @@ -#define LIMINE_HDD_FILE "/Boot/Limine-HDD.HH" +#define LIMINE_HDD_FILE "/Boot/Limine-BIOS-HDD.HH" #define LIMINE_HDD_INSTALLER "/System/Boot/LimineMHDIns.ZC" #include LIMINE_HDD_FILE #include LIMINE_HDD_INSTALLER @@ -127,8 +127,8 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':') CopyTree("B:/", dst); - ExePrint("Del(\"%C:/Boot/Limine-CD.BIN\");", dst_drv); - ExePrint("Del(\"%C:/Boot/Limine-CD-EFI.BIN\");", dst_drv); + ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", dst_drv); + ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", dst_drv); ExePrint("Del(\"%C:/Boot/Limine.CFG\");", dst_drv); ExePrint("Del(\"%C:/boot.catalog\");", dst_drv); @@ -245,8 +245,8 @@ U0 InstallDrive(U8 drv_let) ExePrint("CopyTree(\"::/\",\"%C:/\");", drv_let); - ExePrint("Del(\"%C:/Boot/Limine-CD.BIN\");", drv_let); - ExePrint("Del(\"%C:/Boot/Limine-CD-EFI.BIN\");", drv_let); + ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", drv_let); + ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", drv_let); ExePrint("Del(\"%C:/Boot/Limine.CFG\");", drv_let); ExePrint("Del(\"%C:/boot.catalog\");", drv_let); diff --git a/src/System/Boot/LimineMHDIns.ZC b/src/System/Boot/LimineMHDIns.ZC index 714cafe4..c87fbd7e 100755 --- a/src/System/Boot/LimineMHDIns.ZC +++ b/src/System/Boot/LimineMHDIns.ZC @@ -34,7 +34,7 @@ Bool LimineCFGMake(U8 drv_let) bd = drive->bd; drv_let = Drive2Letter(drive); - filename_sys = MStrPrint("%C:/Boot/Limine.SYS", drv_let); + filename_sys = MStrPrint("%C:/Boot/Limine-BIOS.SYS", drv_let); filename_elf = MStrPrint("%C:/Boot/ZealBooter.ELF", drv_let); filename_zxe = MStrPrint("%C:/Boot/Kernel.ZXE", drv_let); if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe)) diff --git a/zealbooter/GNUmakefile b/zealbooter/GNUmakefile index a0d9a1fd..54eca6ed 100644 --- a/zealbooter/GNUmakefile +++ b/zealbooter/GNUmakefile @@ -18,22 +18,28 @@ endef # It is highly recommended to use a custom built cross toolchain to build a kernel. # We are only using "cc" as a placeholder here. It may work by using # the host system's toolchain, but this is not guaranteed. -$(eval $(call DEFAULT_VAR,CC,cc)) +override DEFAULT_CC := cc +$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC))) # Same thing for "ld" (the linker). -$(eval $(call DEFAULT_VAR,LD,ld)) +override DEFAULT_LD := ld +$(eval $(call DEFAULT_VAR,LD,$(DEFAULT_LD))) # User controllable C flags. -$(eval $(call DEFAULT_VAR,CFLAGS,-g -O2 -pipe)) +override DEFAULT_CFLAGS := -g -O2 -pipe +$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS))) # User controllable C preprocessor flags. We set none by default. -$(eval $(call DEFAULT_VAR,CPPFLAGS,)) +override DEFAULT_CPPFLAGS := +$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS))) # User controllable nasm flags. -$(eval $(call DEFAULT_VAR,NASMFLAGS,-F dwarf -g)) +override DEFAULT_NASMFLAGS := -F dwarf -g +$(eval $(call DEFAULT_VAR,NASMFLAGS,$(DEFAULT_NASMFLAGS))) # User controllable linker flags. We set none by default. -$(eval $(call DEFAULT_VAR,LDFLAGS,)) +override DEFAULT_LDFLAGS := +$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS))) # Internal C flags that should not be changed by the user. override CFLAGS += \ @@ -66,9 +72,9 @@ override CPPFLAGS := \ # Internal linker flags that should not be changed by the user. override LDFLAGS += \ + -m elf_x86_64 \ -nostdlib \ -static \ - -m elf_x86_64 \ -z max-page-size=0x1000 \ -T linker.ld @@ -87,8 +93,8 @@ override NASMFLAGS += \ override CFILES := $(shell find -L . -type f -name '*.c') override ASFILES := $(shell find -L . -type f -name '*.S') override NASMFILES := $(shell find -L . -type f -name '*.asm') -override OBJ := $(CFILES:.c=.o) $(ASFILES:.S=.o) $(NASMFILES:.asm=.o) -override HEADER_DEPS := $(CFILES:.c=.d) $(ASFILES:.S=.d) +override OBJ := $(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o) +override HEADER_DEPS := $(CFILES:.c=.c.d) $(ASFILES:.S=.S.d) # Default target. .PHONY: all @@ -105,15 +111,15 @@ $(KERNEL): $(OBJ) -include $(HEADER_DEPS) # Compilation rules for *.c files. -%.o: %.c limine.h +%.c.o: %.c limine.h $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ # Compilation rules for *.S files. -%.o: %.S limine.h +%.S.o: %.S limine.h $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ # Compilation rules for *.asm (nasm) files. -%.o: %.asm +%.asm.o: %.asm nasm $(NASMFLAGS) $< -o $@ # Remove object files and the final executable. diff --git a/zealbooter/lib/print.c b/zealbooter/lib/print.c index 2fbc98d6..d419836f 100644 --- a/zealbooter/lib/print.c +++ b/zealbooter/lib/print.c @@ -4,10 +4,10 @@ #include #include -static volatile struct limine_terminal_request terminal_request = { - .id = LIMINE_TERMINAL_REQUEST, - .revision = 0 -}; +//static volatile struct limine_terminal_request terminal_request = { +// .id = LIMINE_TERMINAL_REQUEST, +// .revision = 0 +//}; #define PRINT_BUFFER_SIZE 8192 @@ -15,14 +15,14 @@ int printf(const char *format, ...) { va_list args; char buffer[PRINT_BUFFER_SIZE]; - struct limine_terminal *terminal; + //struct limine_terminal *terminal; size_t length; va_start(args, format); length = vsnprintf(buffer, PRINT_BUFFER_SIZE, format, args); - terminal = terminal_request.response->terminals[0]; - terminal_request.response->write(terminal, buffer, length); + //terminal = terminal_request.response->terminals[0]; + //terminal_request.response->write(terminal, buffer, length); va_end(args); diff --git a/zealbooter/linker.ld b/zealbooter/linker.ld index 529a4dd1..52f96f0d 100644 --- a/zealbooter/linker.ld +++ b/zealbooter/linker.ld @@ -45,8 +45,8 @@ SECTIONS /* If you need, for example, .init_array and .fini_array, those should be placed */ /* above this. */ .bss : { - *(COMMON) *(.bss .bss.*) + *(COMMON) } :data /* Discard .note.* and .eh_frame since they may cause issues on some hosts. */ diff --git a/zealbooter/zealbooter.c b/zealbooter/zealbooter.c index 195ec3fc..a8a081da 100644 --- a/zealbooter/zealbooter.c +++ b/zealbooter/zealbooter.c @@ -21,7 +21,7 @@ static volatile struct limine_memmap_request memmap_request = { static volatile struct limine_framebuffer_request framebuffer_request = { .id = LIMINE_FRAMEBUFFER_REQUEST, - .revision = 1 + .revision = 0 }; static volatile struct limine_smbios_request smbios_request = {