mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Merge branch 'master' into pitch-fix
This commit is contained in:
commit
d1380b57f1
11 changed files with 109 additions and 89 deletions
|
@ -66,7 +66,7 @@ umount_tempdisk
|
||||||
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
|
||||||
$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
|
$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
|
||||||
|
|
||||||
LIMINE_BINARY_BRANCH="v6.x-branch-binary"
|
LIMINE_BINARY_BRANCH="v8.x-binary"
|
||||||
|
|
||||||
if [ -d "limine" ]
|
if [ -d "limine" ]
|
||||||
then
|
then
|
||||||
|
@ -110,7 +110,7 @@ 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-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN
|
||||||
sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
|
sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS
|
||||||
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
|
sudo cp ../zealbooter/bin/kernel $TMPISODIR/Boot/ZealBooter.ELF
|
||||||
sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG
|
sudo cp ../zealbooter/limine.conf $TMPISODIR/Boot/Limine.CONF
|
||||||
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..."
|
||||||
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE
|
||||||
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null
|
||||||
|
|
|
@ -44,9 +44,10 @@ DOCS_DIR=
|
||||||
TMPMOUNT=/tmp/zealtmp
|
TMPMOUNT=/tmp/zealtmp
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "Usage: $0 ( repo | vm ) [OPTION]"
|
echo "Usage: $0 ( repo | vm | diff ) [OPTION]"
|
||||||
echo " repo Overwrites src/ with virtual disk contents."
|
echo " repo Overwrites src/ with virtual disk contents."
|
||||||
echo " vm Overwrites virtual disk with src/ contents."
|
echo " vm Overwrites virtual disk with src/ contents."
|
||||||
|
echo " diff Runs a 'diff' between src/ and virtual disk."
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --ignore-dots Ignore dotfiles/dotfolders during synchronize."
|
echo " --ignore-dots Ignore dotfiles/dotfolders during synchronize."
|
||||||
}
|
}
|
||||||
|
@ -73,6 +74,12 @@ else
|
||||||
sudo modprobe nbd
|
sudo modprobe nbd
|
||||||
[ ! -d $TMPMOUNT ] && mkdir $TMPMOUNT
|
[ ! -d $TMPMOUNT ] && mkdir $TMPMOUNT
|
||||||
case $1 in
|
case $1 in
|
||||||
|
diff)
|
||||||
|
mount_vdisk
|
||||||
|
diff -x *.MAP --color=always -r ../src/ $TMPMOUNT/ | less -R -p "diff -x.*|Only in.*"
|
||||||
|
umount_vdisk
|
||||||
|
echo "Finished."
|
||||||
|
;;
|
||||||
repo)
|
repo)
|
||||||
echo "Emptying src..."
|
echo "Emptying src..."
|
||||||
rm -rf ../src/*
|
rm -rf ../src/*
|
||||||
|
|
|
@ -14,7 +14,7 @@ U8 *rev_bits_table; //Table with U8 bits reversed
|
||||||
CDate local_time_offset;
|
CDate local_time_offset;
|
||||||
F64 *pow10_I64,
|
F64 *pow10_I64,
|
||||||
sys_os_version = 2.03;
|
sys_os_version = 2.03;
|
||||||
U64 sys_os_version_sub = 117;
|
U64 sys_os_version_sub = 118;
|
||||||
U8 *sys_os_version_str;
|
U8 *sys_os_version_str;
|
||||||
U8 *sys_os_version_full;
|
U8 *sys_os_version_full;
|
||||||
U8 *sys_os_version_nice;
|
U8 *sys_os_version_nice;
|
||||||
|
|
|
@ -3026,7 +3026,7 @@ class CAtapiModeWriteList
|
||||||
#define FILEMASK_AOT "*.ZC*;*.HH*;*.PRJ*"
|
#define FILEMASK_AOT "*.ZC*;*.HH*;*.PRJ*"
|
||||||
#define FILEMASK_SRC "*.ZC*;*.HH*;*.IN*;*.PRJ*"
|
#define FILEMASK_SRC "*.ZC*;*.HH*;*.IN*;*.PRJ*"
|
||||||
#define FILEMASK_DD FILEMASK_SRC ";*.DD*"
|
#define FILEMASK_DD FILEMASK_SRC ";*.DD*"
|
||||||
#define FILEMASK_TXT FILEMASK_DD ";*.TXT*;*.CFG*"
|
#define FILEMASK_TXT FILEMASK_DD ";*.TXT*;*.CFG*;*.CONF*"
|
||||||
#define FILEMASK_GR "*.GR*"
|
#define FILEMASK_GR "*.GR*"
|
||||||
|
|
||||||
#help_index "File/Low Level"
|
#help_index "File/Low Level"
|
||||||
|
|
|
@ -111,7 +111,7 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':')
|
||||||
Del("B:/Misc/Bible.TXT"); // Deleting from B:/ prevents causing hang when merging large .TXT files,
|
Del("B:/Misc/Bible.TXT"); // Deleting from B:/ prevents causing hang when merging large .TXT files,
|
||||||
Del("B:/Misc/Clementine.TXT"); // they will instead be copied over from boot drive in OSMergeInner
|
Del("B:/Misc/Clementine.TXT"); // they will instead be copied over from boot drive in OSMergeInner
|
||||||
|
|
||||||
Del("B:/Boot/Limine.CFG"); // Delete to make merge output ignore (copy) this, since it gets regenerated later
|
Del("B:/Boot/Limine.CONF"); // Delete to make merge output ignore (copy) this, since it gets regenerated later
|
||||||
|
|
||||||
DocMax;
|
DocMax;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':')
|
||||||
|
|
||||||
ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.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-UEFI-CD.BIN\");", dst_drv);
|
||||||
ExePrint("Del(\"%C:/Boot/Limine.CFG\");", dst_drv);
|
ExePrint("Del(\"%C:/Boot/Limine.CONF\");", dst_drv);
|
||||||
ExePrint("Del(\"%C:/boot.catalog\");", dst_drv);
|
ExePrint("Del(\"%C:/boot.catalog\");", dst_drv);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ U0 OSUpgrade()
|
||||||
if (ch == 'Z')
|
if (ch == 'Z')
|
||||||
{
|
{
|
||||||
BootMHDIns(drv_let);
|
BootMHDIns(drv_let);
|
||||||
"\n(Generating optional UEFI-mode Limine.CFG...)\n";
|
"\n(Generating optional UEFI-mode Limine.CONF...)\n";
|
||||||
LimineCFGMake(drv_let);
|
LimineCFGMake(drv_let);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -247,7 +247,7 @@ U0 InstallDrive(U8 drv_let)
|
||||||
|
|
||||||
ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.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-UEFI-CD.BIN\");", drv_let);
|
||||||
ExePrint("Del(\"%C:/Boot/Limine.CFG\");", drv_let);
|
ExePrint("Del(\"%C:/Boot/Limine.CONF\");", drv_let);
|
||||||
ExePrint("Del(\"%C:/boot.catalog\");", drv_let);
|
ExePrint("Del(\"%C:/boot.catalog\");", drv_let);
|
||||||
|
|
||||||
ExePrint("DirMake(\"%C:/Tmp\");", drv_let);
|
ExePrint("DirMake(\"%C:/Tmp\");", drv_let);
|
||||||
|
@ -351,7 +351,7 @@ U0 VMInstallWiz()
|
||||||
if (ch == 'Z')
|
if (ch == 'Z')
|
||||||
{
|
{
|
||||||
BootMHDIns('C');
|
BootMHDIns('C');
|
||||||
"\n(Generating optional UEFI-mode Limine.CFG...)\n";
|
"\n(Generating optional UEFI-mode Limine.CONF...)\n";
|
||||||
LimineCFGMake('C');
|
LimineCFGMake('C');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -467,8 +467,8 @@ U0 RegularInstallWiz()
|
||||||
if (ch == 'Z')
|
if (ch == 'Z')
|
||||||
{
|
{
|
||||||
BootMHDIns(drv_let);
|
BootMHDIns(drv_let);
|
||||||
"\n(Generating optional UEFI-mode Limine.CFG...)\n";
|
"\n(Generating optional UEFI-mode Limine.CONF...)\n";
|
||||||
LimineCFGMake(drv_let); // ensures we don't leave the LiveCD's Limine.CFG on the HDD
|
LimineCFGMake(drv_let); // ensures we don't leave the LiveCD's Limine.CONF on the HDD
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,18 +13,18 @@ U8 binary_limine_hdd_bin_data[0];
|
||||||
|
|
||||||
Bool LimineCFGMake(U8 drv_let)
|
Bool LimineCFGMake(U8 drv_let)
|
||||||
{
|
{
|
||||||
U8 *filename_cfg = MStrPrint("%C:/Boot/Limine.CFG", drv_let);
|
U8 *filename_cfg = MStrPrint("%C:/Boot/Limine.CONF", drv_let);
|
||||||
CDoc *doc = DocNew(filename_cfg);
|
CDoc *doc = DocNew(filename_cfg);
|
||||||
CDrive *drive;
|
CDrive *drive;
|
||||||
CBlkDev *bd;
|
CBlkDev *bd;
|
||||||
I64 i;
|
I64 i;
|
||||||
U8 *filename_sys, *filename_elf, *filename_zxe, *st;
|
U8 *filename_sys, *filename_elf, *filename_zxe, *st;
|
||||||
|
|
||||||
"\nGenerating Limine.CFG ...\n";
|
"\nGenerating Limine.CONF ...\n";
|
||||||
|
|
||||||
DocPrint(doc,
|
DocPrint(doc,
|
||||||
"TIMEOUT=2\n"
|
"timeout: 2\n"
|
||||||
"INTERFACE_RESOLUTION=1024x768\n\n");
|
"interface_resolution: 1024x768\n\n");
|
||||||
|
|
||||||
"Searching drives for Limine bootloader files ...\n";
|
"Searching drives for Limine bootloader files ...\n";
|
||||||
for (i = 0, drive = blkdev.drvs; i < DRIVES_NUM; i++, drive++)
|
for (i = 0, drive = blkdev.drvs; i < DRIVES_NUM; i++, drive++)
|
||||||
|
@ -39,15 +39,15 @@ Bool LimineCFGMake(U8 drv_let)
|
||||||
filename_zxe = MStrPrint("%C:/Boot/Kernel.ZXE", drv_let);
|
filename_zxe = MStrPrint("%C:/Boot/Kernel.ZXE", drv_let);
|
||||||
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
|
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
|
||||||
{
|
{
|
||||||
st = MStrPrint(":ZealOS %C:/\n"
|
st = MStrPrint("/ZealOS %C:/\n"
|
||||||
"PROTOCOL=limine\n"
|
"protocol: limine\n"
|
||||||
"RESOLUTION=1024x768\n"
|
"resolution: 1024x768\n"
|
||||||
"KERNEL_PATH=boot://%d/Boot/ZealBooter.ELF\n"
|
"kernel_path: boot(%d):/Boot/ZealBooter.ELF\n"
|
||||||
"MODULE_PATH=boot://%d/Boot/Kernel.ZXE\n"
|
"module_path: boot(%d):/Boot/Kernel.ZXE\n"
|
||||||
"\n", drv_let, drive->prt_num + 1, drive->prt_num + 1);
|
"\n", drv_let, drive->prt_num + 1, drive->prt_num + 1);
|
||||||
|
|
||||||
DocPrint(doc, st);
|
DocPrint(doc, st);
|
||||||
"%C:/ drive added as a Limine.CFG menu entry.\n", drv_let;
|
"%C:/ drive added as a Limine.CONF menu entry.\n", drv_let;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
"%C:/ drive is missing Limine bootloader files.\n", drv_let;
|
"%C:/ drive is missing Limine bootloader files.\n", drv_let;
|
||||||
|
@ -56,9 +56,9 @@ Bool LimineCFGMake(U8 drv_let)
|
||||||
DocWrite(doc);
|
DocWrite(doc);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
|
|
||||||
"/Boot/Limine.CFG generated.\n";
|
"/Boot/Limine.CONF generated.\n";
|
||||||
|
|
||||||
"Copying Limine.CFG to all other drives ...\n";
|
"Copying Limine.CONF to all other drives ...\n";
|
||||||
for (i = 0, drive = blkdev.drvs; i < DRIVES_NUM; i++, drive++)
|
for (i = 0, drive = blkdev.drvs; i < DRIVES_NUM; i++, drive++)
|
||||||
{
|
{
|
||||||
if (drive->drive_signature == DRIVE_SIGNATURE_VAL && drive->fs_type == FSt_FAT32 && DriveIsWritable(drive->drv_let))
|
if (drive->drive_signature == DRIVE_SIGNATURE_VAL && drive->fs_type == FSt_FAT32 && DriveIsWritable(drive->drv_let))
|
||||||
|
@ -66,7 +66,7 @@ Bool LimineCFGMake(U8 drv_let)
|
||||||
drv_let = Drive2Letter(drive);
|
drv_let = Drive2Letter(drive);
|
||||||
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
|
if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe))
|
||||||
{
|
{
|
||||||
st = MStrPrint("%C:/Boot/Limine.CFG", drv_let);
|
st = MStrPrint("%C:/Boot/Limine.CONF", drv_let);
|
||||||
Copy(filename_cfg, st);
|
Copy(filename_cfg, st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Nuke built-in rules and variables.
|
# Nuke built-in rules and variables.
|
||||||
override MAKEFLAGS += -rR
|
override MAKEFLAGS += -rR
|
||||||
|
|
||||||
# This is the name that our final kernel executable will have.
|
# This is the name that our final executable will have.
|
||||||
# Change as needed.
|
# Change as needed.
|
||||||
override KERNEL := kernel
|
override OUTPUT := kernel
|
||||||
|
|
||||||
# Convenience macro to reliably declare user overridable variables.
|
# Convenience macro to reliably declare user overridable variables.
|
||||||
define DEFAULT_VAR =
|
define DEFAULT_VAR =
|
||||||
|
@ -15,34 +15,32 @@ define DEFAULT_VAR =
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# It is suggested to use a custom built cross toolchain to build a kernel.
|
# User controllable C compiler command.
|
||||||
# We are using the standard "cc" here, it may work by using
|
override DEFAULT_KCC := cc
|
||||||
# the host system's toolchain, but this is not guaranteed.
|
$(eval $(call DEFAULT_VAR,KCC,$(DEFAULT_KCC)))
|
||||||
override DEFAULT_CC := cc
|
|
||||||
$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC)))
|
|
||||||
|
|
||||||
# Same thing for "ld" (the linker).
|
# User controllable linker command.
|
||||||
override DEFAULT_LD := ld
|
override DEFAULT_KLD := ld
|
||||||
$(eval $(call DEFAULT_VAR,LD,$(DEFAULT_LD)))
|
$(eval $(call DEFAULT_VAR,KLD,$(DEFAULT_KLD)))
|
||||||
|
|
||||||
# User controllable C flags.
|
# User controllable C flags.
|
||||||
override DEFAULT_CFLAGS := -g -O2 -pipe
|
override DEFAULT_KCFLAGS := -g -O2 -pipe
|
||||||
$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS)))
|
$(eval $(call DEFAULT_VAR,KCFLAGS,$(DEFAULT_KCFLAGS)))
|
||||||
|
|
||||||
# User controllable C preprocessor flags. We set none by default.
|
# User controllable C preprocessor flags. We set none by default.
|
||||||
override DEFAULT_CPPFLAGS :=
|
override DEFAULT_KCPPFLAGS :=
|
||||||
$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS)))
|
$(eval $(call DEFAULT_VAR,KCPPFLAGS,$(DEFAULT_KCPPFLAGS)))
|
||||||
|
|
||||||
# User controllable nasm flags.
|
# User controllable nasm flags.
|
||||||
override DEFAULT_NASMFLAGS := -F dwarf -g
|
override DEFAULT_KNASMFLAGS := -F dwarf -g
|
||||||
$(eval $(call DEFAULT_VAR,NASMFLAGS,$(DEFAULT_NASMFLAGS)))
|
$(eval $(call DEFAULT_VAR,KNASMFLAGS,$(DEFAULT_KNASMFLAGS)))
|
||||||
|
|
||||||
# User controllable linker flags. We set none by default.
|
# User controllable linker flags. We set none by default.
|
||||||
override DEFAULT_LDFLAGS :=
|
override DEFAULT_KLDFLAGS :=
|
||||||
$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS)))
|
$(eval $(call DEFAULT_VAR,KLDFLAGS,$(DEFAULT_KLDFLAGS)))
|
||||||
|
|
||||||
# Internal C flags that should not be changed by the user.
|
# Internal C flags that should not be changed by the user.
|
||||||
override CFLAGS += \
|
override KCFLAGS += \
|
||||||
-Wall \
|
-Wall \
|
||||||
-Wextra \
|
-Wextra \
|
||||||
-std=gnu11 \
|
-std=gnu11 \
|
||||||
|
@ -50,8 +48,9 @@ override CFLAGS += \
|
||||||
-fno-stack-protector \
|
-fno-stack-protector \
|
||||||
-fno-stack-check \
|
-fno-stack-check \
|
||||||
-fno-lto \
|
-fno-lto \
|
||||||
-fno-PIE \
|
|
||||||
-fno-PIC \
|
-fno-PIC \
|
||||||
|
-ffunction-sections \
|
||||||
|
-fdata-sections \
|
||||||
-m64 \
|
-m64 \
|
||||||
-march=x86-64 \
|
-march=x86-64 \
|
||||||
-mno-80387 \
|
-mno-80387 \
|
||||||
|
@ -62,50 +61,46 @@ override CFLAGS += \
|
||||||
-mcmodel=kernel
|
-mcmodel=kernel
|
||||||
|
|
||||||
# Internal C preprocessor flags that should not be changed by the user.
|
# Internal C preprocessor flags that should not be changed by the user.
|
||||||
override CPPFLAGS := \
|
override KCPPFLAGS := \
|
||||||
-I src \
|
-I src \
|
||||||
-I src/lib \
|
-I src/lib \
|
||||||
$(CPPFLAGS) \
|
$(KCPPFLAGS) \
|
||||||
-MMD \
|
-MMD \
|
||||||
-MP
|
-MP
|
||||||
|
|
||||||
|
# Internal nasm flags that should not be changed by the user.
|
||||||
|
override KNASMFLAGS += \
|
||||||
|
-Wall \
|
||||||
|
-f elf64
|
||||||
|
|
||||||
# Internal linker flags that should not be changed by the user.
|
# Internal linker flags that should not be changed by the user.
|
||||||
override LDFLAGS += \
|
override KLDFLAGS += \
|
||||||
-m elf_x86_64 \
|
-m elf_x86_64 \
|
||||||
-nostdlib \
|
-nostdlib \
|
||||||
-static \
|
-static \
|
||||||
-z max-page-size=0x1000 \
|
-z max-page-size=0x1000 \
|
||||||
|
-gc-sections \
|
||||||
-T linker.ld
|
-T linker.ld
|
||||||
|
|
||||||
# Check if the linker supports -no-pie and enable it if it does.
|
|
||||||
ifeq ($(shell $(LD) --help 2>&1 | grep 'no-pie' >/dev/null 2>&1; echo $$?),0)
|
|
||||||
override LDFLAGS += -no-pie
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Internal nasm flags that should not be changed by the user.
|
|
||||||
override NASMFLAGS += \
|
|
||||||
-Wall \
|
|
||||||
-f elf64
|
|
||||||
|
|
||||||
# Use "find" to glob all *.c, *.S, and *.asm files in the tree and obtain the
|
# Use "find" to glob all *.c, *.S, and *.asm files in the tree and obtain the
|
||||||
# object and header dependency file names.
|
# object and header dependency file names.
|
||||||
override CFILES := $(shell cd src && find -L . -type f -name '*.c')
|
override CFILES := $(shell cd src && find -L * -type f -name '*.c' | LC_ALL=C sort)
|
||||||
override ASFILES := $(shell cd src && find -L . -type f -name '*.S')
|
override ASFILES := $(shell cd src && find -L * -type f -name '*.S' | LC_ALL=C sort)
|
||||||
override NASMFILES := $(shell cd src && find -L . -type f -name '*.asm')
|
override NASMFILES := $(shell cd src && find -L * -type f -name '*.asm' | LC_ALL=C sort)
|
||||||
override OBJ := $(addprefix obj/,$(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o))
|
override OBJ := $(addprefix obj/,$(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o))
|
||||||
override HEADER_DEPS := $(addprefix obj/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))
|
override HEADER_DEPS := $(addprefix obj/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))
|
||||||
|
|
||||||
# Default target.
|
# Default target.
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: bin/$(KERNEL)
|
all: bin/$(OUTPUT)
|
||||||
|
|
||||||
src/limine.h:
|
src/limine.h:
|
||||||
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h src/limine.h || echo "ERROR"
|
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h src/limine.h || echo "ERROR"
|
||||||
|
|
||||||
# Link rules for the final kernel executable.
|
# Link rules for the final executable.
|
||||||
bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
|
bin/$(OUTPUT): GNUmakefile linker.ld $(OBJ)
|
||||||
mkdir -p "$$(dirname $@)"
|
mkdir -p "$$(dirname $@)"
|
||||||
$(LD) $(OBJ) $(LDFLAGS) -o $@
|
$(KLD) $(OBJ) $(KLDFLAGS) -o $@
|
||||||
|
|
||||||
# Include header dependencies.
|
# Include header dependencies.
|
||||||
-include $(HEADER_DEPS)
|
-include $(HEADER_DEPS)
|
||||||
|
@ -113,17 +108,17 @@ bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
|
||||||
# Compilation rules for *.c files.
|
# Compilation rules for *.c files.
|
||||||
obj/%.c.o: src/%.c GNUmakefile src/limine.h
|
obj/%.c.o: src/%.c GNUmakefile src/limine.h
|
||||||
mkdir -p "$$(dirname $@)"
|
mkdir -p "$$(dirname $@)"
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(KCC) $(KCFLAGS) $(KCPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Compilation rules for *.S files.
|
# Compilation rules for *.S files.
|
||||||
obj/%.S.o: src/%.S GNUmakefile src/limine.h
|
obj/%.S.o: src/%.S GNUmakefile src/limine.h
|
||||||
mkdir -p "$$(dirname $@)"
|
mkdir -p "$$(dirname $@)"
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(KCC) $(KCFLAGS) $(KCPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Compilation rules for *.asm (nasm) files.
|
# Compilation rules for *.asm (nasm) files.
|
||||||
obj/%.asm.o: src/%.asm GNUmakefile
|
obj/%.asm.o: src/%.asm GNUmakefile
|
||||||
mkdir -p "$$(dirname $@)"
|
mkdir -p "$$(dirname $@)"
|
||||||
nasm $(NASMFLAGS) $< -o $@
|
nasm $(KNASMFLAGS) $< -o $@
|
||||||
|
|
||||||
# Remove object files and the final executable.
|
# Remove object files and the final executable.
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
TIMEOUT=2
|
|
||||||
INTERFACE_RESOLUTION=1024x768
|
|
||||||
|
|
||||||
:ZealOS LiveCD
|
|
||||||
PROTOCOL=limine
|
|
||||||
RESOLUTION=1024x768
|
|
||||||
KERNEL_PATH=boot:///Boot/ZealBooter.ELF
|
|
||||||
MODULE_PATH=boot:///Boot/Kernel.ZXE
|
|
8
zealbooter/limine.conf
Normal file
8
zealbooter/limine.conf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
timeout: 2
|
||||||
|
interface_resolution: 1024x768
|
||||||
|
|
||||||
|
/ZealOS LiveCD
|
||||||
|
protocol: limine
|
||||||
|
resolution: 1024x768
|
||||||
|
kernel_path: boot():/Boot/ZealBooter.ELF
|
||||||
|
module_path: boot():/Boot/Kernel.ZXE
|
|
@ -1,22 +1,22 @@
|
||||||
/* Tell the linker that we want an x86_64 ELF64 output file */
|
/* Tell the linker that we want an x86_64 ELF64 output file */
|
||||||
OUTPUT_FORMAT(elf64-x86-64)
|
OUTPUT_FORMAT(elf64-x86-64)
|
||||||
OUTPUT_ARCH(i386:x86-64)
|
|
||||||
|
|
||||||
/* We want the symbol _start to be our entry point */
|
/* We want the symbol kmain to be our entry point */
|
||||||
ENTRY(_start)
|
ENTRY(kmain)
|
||||||
|
|
||||||
/* Define the program headers we want so the bootloader gives us the right */
|
/* Define the program headers we want so the bootloader gives us the right */
|
||||||
/* MMU permissions */
|
/* MMU permissions; this also allows us to exert more control over the linking */
|
||||||
|
/* process. */
|
||||||
PHDRS
|
PHDRS
|
||||||
{
|
{
|
||||||
text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
|
text PT_LOAD;
|
||||||
rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */
|
rodata PT_LOAD;
|
||||||
data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
|
data PT_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* We wanna be placed in the topmost 2GiB of the address space, for optimisations */
|
/* We want to be placed in the topmost 2GiB of the address space, for optimisations */
|
||||||
/* and because that is what the Limine spec mandates. */
|
/* and because that is what the Limine spec mandates. */
|
||||||
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
|
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
|
||||||
/* that is the beginning of the region. */
|
/* that is the beginning of the region. */
|
||||||
|
@ -27,17 +27,23 @@ SECTIONS
|
||||||
} :text
|
} :text
|
||||||
|
|
||||||
/* Move to the next memory page for .rodata */
|
/* Move to the next memory page for .rodata */
|
||||||
. += CONSTANT(MAXPAGESIZE);
|
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||||
|
|
||||||
.rodata : {
|
.rodata : {
|
||||||
*(.rodata .rodata.*)
|
*(.rodata .rodata.*)
|
||||||
} :rodata
|
} :rodata
|
||||||
|
|
||||||
/* Move to the next memory page for .data */
|
/* Move to the next memory page for .data */
|
||||||
. += CONSTANT(MAXPAGESIZE);
|
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||||
|
|
||||||
.data : {
|
.data : {
|
||||||
*(.data .data.*)
|
*(.data .data.*)
|
||||||
|
|
||||||
|
/* Place the sections that contain the Limine requests as part of the .data */
|
||||||
|
/* output section. */
|
||||||
|
KEEP(*(.requests_start_marker))
|
||||||
|
KEEP(*(.requests))
|
||||||
|
KEEP(*(.requests_end_marker))
|
||||||
} :data
|
} :data
|
||||||
|
|
||||||
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
|
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
|
||||||
|
@ -49,9 +55,9 @@ SECTIONS
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
} :data
|
} :data
|
||||||
|
|
||||||
/* Discard .note.* and .eh_frame since they may cause issues on some hosts. */
|
/* Discard .note.* and .eh_frame* since they may cause issues on some hosts. */
|
||||||
/DISCARD/ : {
|
/DISCARD/ : {
|
||||||
*(.eh_frame)
|
*(.eh_frame*)
|
||||||
*(.note .note.*)
|
*(.note .note.*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,31 +4,43 @@
|
||||||
#include <limine.h>
|
#include <limine.h>
|
||||||
#include <lib.h>
|
#include <lib.h>
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests_start_marker")))
|
||||||
|
static volatile LIMINE_REQUESTS_START_MARKER;
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests_end_marker")))
|
||||||
|
static volatile LIMINE_REQUESTS_END_MARKER;
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests")))
|
||||||
static volatile struct limine_module_request module_request = {
|
static volatile struct limine_module_request module_request = {
|
||||||
.id = LIMINE_MODULE_REQUEST,
|
.id = LIMINE_MODULE_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests")))
|
||||||
static volatile struct limine_hhdm_request hhdm_request = {
|
static volatile struct limine_hhdm_request hhdm_request = {
|
||||||
.id = LIMINE_HHDM_REQUEST,
|
.id = LIMINE_HHDM_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests")))
|
||||||
static volatile struct limine_memmap_request memmap_request = {
|
static volatile struct limine_memmap_request memmap_request = {
|
||||||
.id = LIMINE_MEMMAP_REQUEST,
|
.id = LIMINE_MEMMAP_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests")))
|
||||||
static volatile struct limine_framebuffer_request framebuffer_request = {
|
static volatile struct limine_framebuffer_request framebuffer_request = {
|
||||||
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests")))
|
||||||
static volatile struct limine_smbios_request smbios_request = {
|
static volatile struct limine_smbios_request smbios_request = {
|
||||||
.id = LIMINE_SMBIOS_REQUEST,
|
.id = LIMINE_SMBIOS_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__attribute__((used, section(".requests")))
|
||||||
static volatile struct limine_efi_system_table_request efi_request = {
|
static volatile struct limine_efi_system_table_request efi_request = {
|
||||||
.id = LIMINE_EFI_SYSTEM_TABLE_REQUEST,
|
.id = LIMINE_EFI_SYSTEM_TABLE_REQUEST,
|
||||||
.revision = 0
|
.revision = 0
|
||||||
|
@ -167,7 +179,7 @@ static struct E801 get_E801(void) {
|
||||||
return E801;
|
return E801;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _start(void) {
|
void kmain(void) {
|
||||||
printf("ZealBooter prekernel\n");
|
printf("ZealBooter prekernel\n");
|
||||||
printf("____________________\n\n");
|
printf("____________________\n\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue