Skip to content

Commit 66f29b3

Browse files
authored
Merge pull request Zeal-Operating-System#160 from Zeal-Operating-System/limine8
Update Zealbooter to Limine 8.x and backport template changes
2 parents b1e0034 + f2a7f94 commit 66f29b3

File tree

10 files changed

+101
-88
lines changed

10 files changed

+101
-88
lines changed

‎build/build-iso.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ umount_tempdisk
6666
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
6767
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS
6868

69-
LIMINE_BINARY_BRANCH="v6.x-branch-binary"
69+
LIMINE_BINARY_BRANCH="v8.x-binary"
7070

7171
if [ -d "limine" ]
7272
then
@@ -110,7 +110,7 @@ sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN
110110
sudo cp limine/limine-bios-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN
111111
sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
112112
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
113-
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
113+
sudo cp ../zealbooter/limine.conf $TMPISODIR/Boot/Limine.CONF
114114
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
115115
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
116116
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null

‎src/Kernel/KGlobals.ZC‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ U8 *rev_bits_table; //Table with U8 bits reversed
1414
CDate local_time_offset;
1515
F64 *pow10_I64,
1616
sys_os_version = 2.03;
17-
U64 sys_os_version_sub = 117;
17+
U64 sys_os_version_sub = 118;
1818
U8 *sys_os_version_str;
1919
U8 *sys_os_version_full;
2020
U8 *sys_os_version_nice;

‎src/Kernel/KernelA.HH‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3026,7 +3026,7 @@ class CAtapiModeWriteList
30263026
#define FILEMASK_AOT "*.ZC*;*.HH*;*.PRJ*"
30273027
#define FILEMASK_SRC "*.ZC*;*.HH*;*.IN*;*.PRJ*"
30283028
#define FILEMASK_DD FILEMASK_SRC ";*.DD*"
3029-
#define FILEMASK_TXT FILEMASK_DD ";*.TXT*;*.CFG*"
3029+
#define FILEMASK_TXT FILEMASK_DD ";*.TXT*;*.CFG*;*.CONF*"
30303030
#define FILEMASK_GR "*.GR*"
30313031

30323032
#help_index "File/Low Level"

‎src/Misc/OSInstall.ZC‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':')
111111
Del("B:/Misc/Bible.TXT"); // Deleting from B:/ prevents causing hang when merging large .TXT files,
112112
Del("B:/Misc/Clementine.TXT"); // they will instead be copied over from boot drive in OSMergeInner
113113

114-
Del("B:/Boot/Limine.CFG"); // Delete to make merge output ignore (copy) this, since it gets regenerated later
114+
Del("B:/Boot/Limine.CONF"); // Delete to make merge output ignore (copy) this, since it gets regenerated later
115115

116116
DocMax;
117117

@@ -129,7 +129,7 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':')
129129

130130
ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", dst_drv);
131131
ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", dst_drv);
132-
ExePrint("Del(\"%C:/Boot/Limine.CFG\");", dst_drv);
132+
ExePrint("Del(\"%C:/Boot/Limine.CONF\");", dst_drv);
133133
ExePrint("Del(\"%C:/boot.catalog\");", dst_drv);
134134

135135
}
@@ -208,7 +208,7 @@ U0 OSUpgrade()
208208
if (ch == 'Z')
209209
{
210210
BootMHDIns(drv_let);
211-
"\n(Generating optional UEFI-mode Limine.CFG...)\n";
211+
"\n(Generating optional UEFI-mode Limine.CONF...)\n";
212212
LimineCFGMake(drv_let);
213213
}
214214
else
@@ -247,7 +247,7 @@ U0 InstallDrive(U8 drv_let)
247247

248248
ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", drv_let);
249249
ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", drv_let);
250-
ExePrint("Del(\"%C:/Boot/Limine.CFG\");", drv_let);
250+
ExePrint("Del(\"%C:/Boot/Limine.CONF\");", drv_let);
251251
ExePrint("Del(\"%C:/boot.catalog\");", drv_let);
252252

253253
ExePrint("DirMake(\"%C:/Tmp\");", drv_let);
@@ -351,7 +351,7 @@ U0 VMInstallWiz()
351351
if (ch == 'Z')
352352
{
353353
BootMHDIns('C');
354-
"\n(Generating optional UEFI-mode Limine.CFG...)\n";
354+
"\n(Generating optional UEFI-mode Limine.CONF...)\n";
355355
LimineCFGMake('C');
356356
}
357357
else
@@ -467,8 +467,8 @@ U0 RegularInstallWiz()
467467
if (ch == 'Z')
468468
{
469469
BootMHDIns(drv_let);
470-
"\n(Generating optional UEFI-mode Limine.CFG...)\n";
471-
LimineCFGMake(drv_let); // ensures we don't leave the LiveCD's Limine.CFG on the HDD
470+
"\n(Generating optional UEFI-mode Limine.CONF...)\n";
471+
LimineCFGMake(drv_let); // ensures we don't leave the LiveCD's Limine.CONF on the HDD
472472
}
473473
else
474474
{

‎src/System/Boot/LimineMHDIns.ZC‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ U8 binary_limine_hdd_bin_data[0];
1313

1414
Bool LimineCFGMake(U8 drv_let)
1515
{
16-
U8 *filename_cfg = MStrPrint("%C:/Boot/Limine.CFG", drv_let);
16+
U8 *filename_cfg = MStrPrint("%C:/Boot/Limine.CONF", drv_let);
1717
CDoc *doc = DocNew(filename_cfg);
1818
CDrive *drive;
1919
CBlkDev *bd;
2020
I64 i;
2121
U8 *filename_sys, *filename_elf, *filename_zxe, *st;
2222

23-
"\nGenerating Limine.CFG ...\n";
23+
"\nGenerating Limine.CONF ...\n";
2424

2525
DocPrint(doc,
26-
"TIMEOUT=2\n"
27-
"INTERFACE_RESOLUTION=1024x768\n\n");
26+
"timeout: 2\n"
27+
"interface_resolution: 1024x768\n\n");
2828

2929
"Searching drives for Limine bootloader files ...\n";
3030
for (i = 0, drive = blkdev.drvs; i < DRIVES_NUM; i++, drive++)
@@ -39,15 +39,15 @@ Bool LimineCFGMake(U8 drv_let)
3939
filename_zxe = MStrPrint("%C:/Boot/Kernel.ZXE", drv_let);
4040
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
4141
{
42-
st = MStrPrint(":ZealOS %C:/\n"
43-
"PROTOCOL=limine\n"
44-
"RESOLUTION=1024x768\n"
45-
"KERNEL_PATH=boot://%d/Boot/ZealBooter.ELF\n"
46-
"MODULE_PATH=boot://%d/Boot/Kernel.ZXE\n"
42+
st = MStrPrint("/ZealOS %C:/\n"
43+
"protocol: limine\n"
44+
"resolution: 1024x768\n"
45+
"kernel_path: boot(%d):/Boot/ZealBooter.ELF\n"
46+
"module_path: boot(%d):/Boot/Kernel.ZXE\n"
4747
"\n", drv_let, drive->prt_num + 1, drive->prt_num + 1);
4848

4949
DocPrint(doc, st);
50-
"%C:/ drive added as a Limine.CFG menu entry.\n", drv_let;
50+
"%C:/ drive added as a Limine.CONF menu entry.\n", drv_let;
5151
}
5252
else
5353
"%C:/ drive is missing Limine bootloader files.\n", drv_let;
@@ -56,17 +56,17 @@ Bool LimineCFGMake(U8 drv_let)
5656
DocWrite(doc);
5757
DocDel(doc);
5858

59-
"/Boot/Limine.CFG generated.\n";
59+
"/Boot/Limine.CONF generated.\n";
6060

61-
"Copying Limine.CFG to all other drives ...\n";
61+
"Copying Limine.CONF to all other drives ...\n";
6262
for (i = 0, drive = blkdev.drvs; i < DRIVES_NUM; i++, drive++)
6363
{
6464
if (drive->drive_signature == DRIVE_SIGNATURE_VAL && drive->fs_type == FSt_FAT32 && DriveIsWritable(drive->drv_let))
6565
{
6666
drv_let = Drive2Letter(drive);
6767
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
6868
{
69-
st = MStrPrint("%C:/Boot/Limine.CFG", drv_let);
69+
st = MStrPrint("%C:/Boot/Limine.CONF", drv_let);
7070
Copy(filename_cfg, st);
7171
}
7272
}

‎zealbooter/GNUmakefile‎

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Nuke built-in rules and variables.
22
override MAKEFLAGS += -rR
33

4-
# This is the name that our final kernel executable will have.
4+
# This is the name that our final executable will have.
55
# Change as needed.
6-
override KERNEL := kernel
6+
override OUTPUT := kernel
77

88
# Convenience macro to reliably declare user overridable variables.
99
define DEFAULT_VAR =
@@ -15,43 +15,42 @@ define DEFAULT_VAR =
1515
endif
1616
endef
1717

18-
# It is suggested to use a custom built cross toolchain to build a kernel.
19-
# We are using the standard "cc" here, it may work by using
20-
# the host system's toolchain, but this is not guaranteed.
21-
override DEFAULT_CC := cc
22-
$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC)))
18+
# User controllable C compiler command.
19+
override DEFAULT_KCC := cc
20+
$(eval $(call DEFAULT_VAR,KCC,$(DEFAULT_KCC)))
2321

24-
# Same thing for "ld" (the linker).
25-
override DEFAULT_LD := ld
26-
$(eval $(call DEFAULT_VAR,LD,$(DEFAULT_LD)))
22+
# User controllable linker command.
23+
override DEFAULT_KLD := ld
24+
$(eval $(call DEFAULT_VAR,KLD,$(DEFAULT_KLD)))
2725

2826
# User controllable C flags.
29-
override DEFAULT_CFLAGS := -g -O2 -pipe
30-
$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS)))
27+
override DEFAULT_KCFLAGS := -g -O2 -pipe
28+
$(eval $(call DEFAULT_VAR,KCFLAGS,$(DEFAULT_KCFLAGS)))
3129

3230
# User controllable C preprocessor flags. We set none by default.
33-
override DEFAULT_CPPFLAGS :=
34-
$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS)))
31+
override DEFAULT_KCPPFLAGS :=
32+
$(eval $(call DEFAULT_VAR,KCPPFLAGS,$(DEFAULT_KCPPFLAGS)))
3533

3634
# User controllable nasm flags.
37-
override DEFAULT_NASMFLAGS := -F dwarf -g
38-
$(eval $(call DEFAULT_VAR,NASMFLAGS,$(DEFAULT_NASMFLAGS)))
35+
override DEFAULT_KNASMFLAGS := -F dwarf -g
36+
$(eval $(call DEFAULT_VAR,KNASMFLAGS,$(DEFAULT_KNASMFLAGS)))
3937

4038
# User controllable linker flags. We set none by default.
41-
override DEFAULT_LDFLAGS :=
42-
$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS)))
39+
override DEFAULT_KLDFLAGS :=
40+
$(eval $(call DEFAULT_VAR,KLDFLAGS,$(DEFAULT_KLDFLAGS)))
4341

4442
# Internal C flags that should not be changed by the user.
45-
override CFLAGS += \
43+
override KCFLAGS += \
4644
-Wall \
4745
-Wextra \
4846
-std=gnu11 \
4947
-ffreestanding \
5048
-fno-stack-protector \
5149
-fno-stack-check \
5250
-fno-lto \
53-
-fno-PIE \
5451
-fno-PIC \
52+
-ffunction-sections \
53+
-fdata-sections \
5554
-m64 \
5655
-march=x86-64 \
5756
-mno-80387 \
@@ -62,68 +61,64 @@ override CFLAGS += \
6261
-mcmodel=kernel
6362

6463
# Internal C preprocessor flags that should not be changed by the user.
65-
override CPPFLAGS := \
64+
override KCPPFLAGS := \
6665
-I src \
6766
-I src/lib \
68-
$(CPPFLAGS) \
67+
$(KCPPFLAGS) \
6968
-MMD \
7069
-MP
7170

71+
# Internal nasm flags that should not be changed by the user.
72+
override KNASMFLAGS += \
73+
-Wall \
74+
-f elf64
75+
7276
# Internal linker flags that should not be changed by the user.
73-
override LDFLAGS += \
77+
override KLDFLAGS += \
7478
-m elf_x86_64 \
7579
-nostdlib \
7680
-static \
7781
-z max-page-size=0x1000 \
82+
-gc-sections \
7883
-T linker.ld
7984

80-
# Check if the linker supports -no-pie and enable it if it does.
81-
ifeq ($(shell $(LD) --help 2>&1 | grep 'no-pie' >/dev/null 2>&1; echo $$?),0)
82-
override LDFLAGS += -no-pie
83-
endif
84-
85-
# Internal nasm flags that should not be changed by the user.
86-
override NASMFLAGS += \
87-
-Wall \
88-
-f elf64
89-
9085
# Use "find" to glob all *.c, *.S, and *.asm files in the tree and obtain the
9186
# object and header dependency file names.
92-
override CFILES := $(shell cd src && find -L . -type f -name '*.c')
93-
override ASFILES := $(shell cd src && find -L . -type f -name '*.S')
94-
override NASMFILES := $(shell cd src && find -L . -type f -name '*.asm')
87+
override CFILES := $(shell cd src && find -L * -type f -name '*.c' | LC_ALL=C sort)
88+
override ASFILES := $(shell cd src && find -L * -type f -name '*.S' | LC_ALL=C sort)
89+
override NASMFILES := $(shell cd src && find -L * -type f -name '*.asm' | LC_ALL=C sort)
9590
override OBJ := $(addprefix obj/,$(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o))
9691
override HEADER_DEPS := $(addprefix obj/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))
9792

9893
# Default target.
9994
.PHONY: all
100-
all: bin/$(KERNEL)
95+
all: bin/$(OUTPUT)
10196

10297
src/limine.h:
10398
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h src/limine.h || echo "ERROR"
10499

105-
# Link rules for the final kernel executable.
106-
bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
100+
# Link rules for the final executable.
101+
bin/$(OUTPUT): GNUmakefile linker.ld $(OBJ)
107102
mkdir -p "$$(dirname $@)"
108-
$(LD) $(OBJ) $(LDFLAGS) -o $@
103+
$(KLD) $(OBJ) $(KLDFLAGS) -o $@
109104

110105
# Include header dependencies.
111106
-include $(HEADER_DEPS)
112107

113108
# Compilation rules for *.c files.
114109
obj/%.c.o: src/%.c GNUmakefile src/limine.h
115110
mkdir -p "$$(dirname $@)"
116-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
111+
$(KCC) $(KCFLAGS) $(KCPPFLAGS) -c $< -o $@
117112

118113
# Compilation rules for *.S files.
119114
obj/%.S.o: src/%.S GNUmakefile src/limine.h
120115
mkdir -p "$$(dirname $@)"
121-
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
116+
$(KCC) $(KCFLAGS) $(KCPPFLAGS) -c $< -o $@
122117

123118
# Compilation rules for *.asm (nasm) files.
124119
obj/%.asm.o: src/%.asm GNUmakefile
125120
mkdir -p "$$(dirname $@)"
126-
nasm $(NASMFLAGS) $< -o $@
121+
nasm $(KNASMFLAGS) $< -o $@
127122

128123
# Remove object files and the final executable.
129124
.PHONY: clean

‎zealbooter/Limine.CFG‎

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

‎zealbooter/limine.conf‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
timeout: 2
2+
interface_resolution: 1024x768
3+
4+
/ZealOS LiveCD
5+
protocol: limine
6+
resolution: 1024x768
7+
kernel_path: boot():/Boot/ZealBooter.ELF
8+
module_path: boot():/Boot/Kernel.ZXE

0 commit comments

Comments
 (0)