mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-24 22:50:28 +00:00
Merge branch 'master' into sound-dev
This commit is contained in:
commit
fca070fecf
32 changed files with 48 additions and 33 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -15,4 +15,6 @@
|
||||||
*.hdd
|
*.hdd
|
||||||
*.o
|
*.o
|
||||||
*.d
|
*.d
|
||||||
/zealbooter/limine.h
|
/zealbooter/src/limine.h
|
||||||
|
/zealbooter/bin
|
||||||
|
/zealbooter/obj
|
||||||
|
|
|
@ -105,7 +105,7 @@ sudo cp limine/BOOTX64.EFI $TMPISODIR/EFI/BOOT/BOOTX64.EFI
|
||||||
sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN
|
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/zealbooter.elf $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.CFG $TMPISODIR/Boot/Limine.CFG
|
||||||
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
|
||||||
|
|
|
@ -44,11 +44,11 @@ DOCS_DIR=
|
||||||
TMPMOUNT=/tmp/zealtmp
|
TMPMOUNT=/tmp/zealtmp
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "Usage: $0 [ repo | vm ]"
|
echo "Usage: $0 ( repo | vm ) [OPTION]"
|
||||||
echo
|
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 "Options:"
|
||||||
echo
|
echo " --ignore-dots Ignore dotfiles/dotfolders during synchronize."
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_vdisk() {
|
mount_vdisk() {
|
||||||
|
@ -94,8 +94,17 @@ else
|
||||||
;;
|
;;
|
||||||
vm)
|
vm)
|
||||||
mount_vdisk
|
mount_vdisk
|
||||||
echo "Copying src to vdisk..."
|
case $2 in
|
||||||
sudo cp -r ../src/* $TMPMOUNT
|
--ignore-dots | --dots)
|
||||||
|
echo "Copying src to vdisk ignoring dotfiles and dotfolders..."
|
||||||
|
cd ../src/
|
||||||
|
sudo find . \( ! -path './.*' -and ! -name '.*' \) -and ! -path '*/.*/*' -type f -exec cp --parents {} $TMPMOUNT/ \;
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Copying entire src to vdisk..."
|
||||||
|
sudo cp -r ../src/* $TMPMOUNT
|
||||||
|
;;
|
||||||
|
esac
|
||||||
umount_vdisk
|
umount_vdisk
|
||||||
echo "Finished."
|
echo "Finished."
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -129,5 +129,5 @@ $FG$
|
||||||
* No args are passed in registers.
|
* No args are passed in registers.
|
||||||
|
|
||||||
* RAX holds function return values, of course.
|
* RAX holds function return values, of course.
|
||||||
$FG,8$
|
|
||||||
* "MagicISO" is a trademark owned by MagicISO Corp.
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ U8 *FlagsStrPrint(U8 *dst, U8 *list, I64 flags, Bool print_all=FALSE, I64 print_
|
||||||
I64 i = 0;
|
I64 i = 0;
|
||||||
|
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
if (!print_all_length)
|
if (!print_all_length || print_all_length > 64)
|
||||||
print_all_length = 64;
|
print_all_length = 64;
|
||||||
while (i < print_all_length)
|
while (i < print_all_length)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
I64 Str2I64(U8 *st, I64 radix=10, U8 **_end_ptr=NULL)
|
I64 Str2I64(U8 *st, I64 radix=10, U8 **_end_ptr=NULL)
|
||||||
{//String to I64. Similar to strtoul().
|
{//String to I64. Similar to strtol().
|
||||||
//Allows radix change with "0x20" "0b1010" "0d123" "0o18".
|
//Allows radix change with "0x20" "0b1010" "0d123" "0o18".
|
||||||
//Be careful of Str2I64("0b101", 16)-->0xB101.
|
//Be careful of Str2I64("0b101", 16)-->0xB101.
|
||||||
Bool neg = FALSE;
|
Bool neg = FALSE;
|
||||||
|
@ -32,6 +32,7 @@ I64 Str2I64(U8 *st, I64 radix=10, U8 **_end_ptr=NULL)
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case 'B': radix = 2; st++; break;
|
case 'B': radix = 2; st++; break;
|
||||||
|
case 'O': radix = 8; st++; break;
|
||||||
case 'D': radix = 10; st++; break;
|
case 'D': radix = 10; st++; break;
|
||||||
case 'X': radix = 16; st++; break;
|
case 'X': radix = 16; st++; break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ override MAKEFLAGS += -rR
|
||||||
|
|
||||||
# This is the name that our final kernel executable will have.
|
# This is the name that our final kernel executable will have.
|
||||||
# Change as needed.
|
# Change as needed.
|
||||||
override KERNEL := zealbooter.elf
|
override KERNEL := kernel
|
||||||
|
|
||||||
# Convenience macro to reliably declare user overridable variables.
|
# Convenience macro to reliably declare user overridable variables.
|
||||||
define DEFAULT_VAR =
|
define DEFAULT_VAR =
|
||||||
|
@ -15,8 +15,8 @@ define DEFAULT_VAR =
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# It is highly recommended to use a custom built cross toolchain to build a kernel.
|
# It is suggested 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
|
# We are using the standard "cc" here, it may work by using
|
||||||
# the host system's toolchain, but this is not guaranteed.
|
# the host system's toolchain, but this is not guaranteed.
|
||||||
override DEFAULT_CC := cc
|
override DEFAULT_CC := cc
|
||||||
$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC)))
|
$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC)))
|
||||||
|
@ -54,7 +54,6 @@ override CFLAGS += \
|
||||||
-fno-PIC \
|
-fno-PIC \
|
||||||
-m64 \
|
-m64 \
|
||||||
-march=x86-64 \
|
-march=x86-64 \
|
||||||
-mabi=sysv \
|
|
||||||
-mno-80387 \
|
-mno-80387 \
|
||||||
-mno-mmx \
|
-mno-mmx \
|
||||||
-mno-sse \
|
-mno-sse \
|
||||||
|
@ -64,8 +63,8 @@ override CFLAGS += \
|
||||||
|
|
||||||
# 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 CPPFLAGS := \
|
||||||
-I. \
|
-I src \
|
||||||
-I./lib \
|
-I src/lib \
|
||||||
$(CPPFLAGS) \
|
$(CPPFLAGS) \
|
||||||
-MMD \
|
-MMD \
|
||||||
-MP
|
-MP
|
||||||
|
@ -90,43 +89,47 @@ override NASMFLAGS += \
|
||||||
|
|
||||||
# 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 find -L . -type f -name '*.c')
|
override CFILES := $(shell cd src && find -L . -type f -name '*.c')
|
||||||
override ASFILES := $(shell find -L . -type f -name '*.S')
|
override ASFILES := $(shell cd src && find -L . -type f -name '*.S')
|
||||||
override NASMFILES := $(shell find -L . -type f -name '*.asm')
|
override NASMFILES := $(shell cd src && find -L . -type f -name '*.asm')
|
||||||
override 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 := $(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: $(KERNEL)
|
all: bin/$(KERNEL)
|
||||||
|
|
||||||
limine.h:
|
src/limine.h:
|
||||||
curl -Lo $@ https://github.com/limine-bootloader/limine/raw/trunk/limine.h || cp ../build/limine/limine.h 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 kernel executable.
|
||||||
$(KERNEL): $(OBJ)
|
bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
|
||||||
|
mkdir -p "$$(dirname $@)"
|
||||||
$(LD) $(OBJ) $(LDFLAGS) -o $@
|
$(LD) $(OBJ) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
# Include header dependencies.
|
# Include header dependencies.
|
||||||
-include $(HEADER_DEPS)
|
-include $(HEADER_DEPS)
|
||||||
|
|
||||||
# Compilation rules for *.c files.
|
# Compilation rules for *.c files.
|
||||||
%.c.o: %.c limine.h
|
obj/%.c.o: src/%.c GNUmakefile src/limine.h
|
||||||
|
mkdir -p "$$(dirname $@)"
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Compilation rules for *.S files.
|
# Compilation rules for *.S files.
|
||||||
%.S.o: %.S limine.h
|
obj/%.S.o: src/%.S GNUmakefile src/limine.h
|
||||||
|
mkdir -p "$$(dirname $@)"
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Compilation rules for *.asm (nasm) files.
|
# Compilation rules for *.asm (nasm) files.
|
||||||
%.asm.o: %.asm
|
obj/%.asm.o: src/%.asm GNUmakefile
|
||||||
|
mkdir -p "$$(dirname $@)"
|
||||||
nasm $(NASMFLAGS) $< -o $@
|
nasm $(NASMFLAGS) $< -o $@
|
||||||
|
|
||||||
# Remove object files and the final executable.
|
# Remove object files and the final executable.
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(KERNEL) $(OBJ) $(HEADER_DEPS)
|
rm -rf bin obj
|
||||||
|
|
||||||
.PHONY: distclean
|
.PHONY: distclean
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f limine.h
|
rm -f src/limine.h
|
||||||
|
|
Loading…
Reference in a new issue