Update files

This commit is contained in:
Alex 2022-10-08 04:33:50 +03:00
parent 432096fc25
commit 9390b309eb
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
8 changed files with 119 additions and 18 deletions

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ initrd.tar.gz
*.log
*.img
*.iso
*.drv
*.o

View File

@ -3,7 +3,7 @@
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/include/**"
"${workspaceFolder}/"
],
"defines": [
"KERNEL_NAME=\"Fennix\"",
@ -11,7 +11,7 @@
"GIT_COMMIT=\"0000000000000000000000000000000000000000\"",
"GIT_COMMIT_SHORT=\"0000000\""
],
"compilerPath": "/usr/bin/gcc",
"compilerPath": "${workspaceFolder}/tools/cross/bin/amd64-elf-gcc",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "gcc-x64",

View File

@ -23,8 +23,17 @@ default:
# -netdev tap,id=usernet0,ifname=tap0,script=no,downscript=no
QEMU = ./$(QEMU_PATH)$(QEMU_ARCH)
QEMUFLAGS := -display gtk
ifeq ($(OSARCH), amd64)
QEMUHWACCELERATION = -machine q35 -enable-kvm
QEMUMEMORY = -m 4G
else ifeq ($(OSARCH), i686)
QEMUHWACCELERATION = -machine q35 -enable-kvm
QEMUMEMORY = -m 4G
else ifeq ($(OSARCH), aarch64)
QEMUHWACCELERATION =
QEMUMEMORY = -m 1G
endif
ifeq ($(OSARCH), amd64)
QEMUFLAGS += -device bochs-display -M q35 \
@ -59,11 +68,10 @@ QEMUFLAGS += -M q35 \
-machine pcspk-audiodev=audio0 \
-device AC97,audiodev=audio0
else ifeq ($(OSARCH), aarch64)
QEMUFLAGS += -M virt \
QEMUFLAGS += -M raspi3b \
-cpu cortex-a57 \
-smp $(shell nproc) \
-serial file:serial.log \
-hda $(OSNAME).iso
-kernel $(OSNAME).img
endif
doxygen:
@ -86,8 +94,9 @@ tools:
make --quiet -C Kernel prepare
make --quiet -C Lynx prepare
make --quiet -C Userspace prepare
make --quiet -C Drivers prepare
build: build_lynx build_kernel build_userspace build_image
build: build_lynx build_kernel build_userspace build_drivers build_image
rebuild: clean build
@ -103,6 +112,10 @@ build_kernel:
build_userspace:
make --quiet -C Userspace build
build_drivers:
make --quiet -C Drivers build
cp Drivers/out/* initrd/system/drivers/
build_image:
mkdir -p iso_tmp_data
tar cf initrd.tar.gz -C initrd/ ./ --format=ustar
@ -131,16 +144,21 @@ ifeq ($(OSARCH), i686)
cp tools/grub.cfg iso_tmp_data/boot/grub/
grub-mkrescue -o $(OSNAME).iso iso_tmp_data
endif
ifeq ($(OSARCH), aarch64)
$(COMPILER_PATH)/$(COMPILER_ARCH)objcopy Kernel/kernel.fsys -O binary $(OSNAME).img
endif
endif
QEMU_UEFI_BIOS :=
ifeq ($(OSARCH), amd64)
QEMU_UEFI_BIOS += -bios /usr/share/qemu/OVMF.fd
QEMU_UEFI_BIOS = -bios /usr/share/qemu/OVMF.fd
endif
# ifeq ($(OSARCH), aarch64)
# QEMU_UEFI_BIOS = -bios -bios /usr/share/AAVMF/AAVMF_CODE.fd
# endif
vscode_debug: build_kernel build_userspace build_image
vscode_debug: build_kernel build_userspace build_drivers build_image
rm -f serial.log network.log
$(QEMU) -S -gdb tcp::1234 -d int -no-shutdown $(QEMU_UEFI_BIOS) -m 4G $(QEMUFLAGS)
$(QEMU) -S -gdb tcp::1234 -d int -no-reboot -no-shutdown $(QEMU_UEFI_BIOS) -m 4G $(QEMUFLAGS)
qemu: qemu_vdisk
rm -f serial.log network.log
@ -153,7 +171,9 @@ qemubios: qemu_vdisk
run: build qemu
clean:
rm -rf doxygen-doc iso_tmp_data initrd.tar.gz $(OSNAME).iso
make --quiet -C Kernel clean
make --quiet -C Lynx clean
make --quiet -C Userspace clean
rm -rf doxygen-doc iso_tmp_data
rm -f initrd/system/drivers/*.drv initrd.tar.gz $(OSNAME).iso $(OSNAME).img
make -C Kernel clean
make -C Lynx clean
make -C Userspace clean
make -C Drivers clean

View File

0
tools/ErrorParser.cpp Normal file → Executable file
View File

75
tools/Fex.c Normal file
View File

@ -0,0 +1,75 @@
// FEX is a file format. Right now in development.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
void DumpData(const char *Description, unsigned char *Address, unsigned long Length)
{
printf("-------------------------------------------------------------------------\n");
unsigned char Buffer[17];
unsigned long Iterate;
if (Description != NULL)
printf("%s:\n", Description);
for (Iterate = 0; Iterate < Length; Iterate++)
{
if ((Iterate % 16) == 0)
{
if (Iterate != 0)
printf(" %s\n", Buffer);
printf(" %04x ", Iterate);
}
printf(" %02x", Address[Iterate]);
if ((Address[Iterate] < 0x20) || (Address[Iterate] > 0x7e))
Buffer[Iterate % 16] = '.';
else
Buffer[Iterate % 16] = Address[Iterate];
Buffer[(Iterate % 16) + 1] = '\0';
}
while ((Iterate % 16) != 0)
{
printf(" ");
Iterate++;
}
printf(" %s\n", Buffer);
printf("-------------------------------------------------------------------------\n");
}
int main()
{
FILE *FilePointer;
char FileName[20];
unsigned char *Buffer;
char BufferChar;
struct stat st;
printf("--- THIS IS NOT A COMPLETE VERSION ---\n\n");
FileSelection:
printf("File Name: ");
fgets(FileName, 20, stdin);
FileName[strcspn(FileName, "\r\n")] = 0;
FilePointer = fopen(FileName, "r");
if (NULL == FilePointer)
{
printf("Error opening file %s. Try again...\n", FileName);
FileName[0] = 0;
goto FileSelection;
}
stat(FileName, &st);
Buffer = (unsigned char *)malloc(st.st_size);
fread(Buffer, 1, st.st_size, FilePointer);
DumpData(FileName, Buffer, st.st_size);
fclose(FilePointer);
free(Buffer);
return 0;
}

View File

@ -4,19 +4,23 @@ export PATH := $(CROSS_DIR):$(PATH)
QEMU_VERSION = qemu-7.1.0
all: do_rep do_ep do_limine clone_all do_binutils64 do_binutils32 do_binutilsarm64 do_gcc64 do_gcc32 do_gccarm64 do_qemu
all: do_rep do_ep do_fex do_limine clone_all do_binutils64 do_binutils32 do_binutilsarm64 do_gcc64 do_gcc32 do_gccarm64 do_qemu
clean:
rm -f rep ep
rm -f rep ep fex
do_rep:
gcc -w ReadEthernetPackets.c -o rep
chmod +x rep
do_ep:
g++ -w e.cpp -o ep
g++ -w ErrorParser.cpp -o ep
chmod +x ep
do_fex:
gcc -w Fex.c -o fex
chmod +x fex
do_limine:
git clone https://github.com/limine-bootloader/limine.git --branch=v4.x-branch-binary --depth=1

View File

@ -5,7 +5,7 @@ INTERFACE_BRANDING=Fennix
# DO NOT EDIT!
COMMENT=Boot Fennix using Limine protocol
PROTOCOL=limine
KERNEL_CMDLINE=debug
KERNEL_CMDLINE=debug liballoc11
KERNEL_PATH=boot:///kernel.fsys
MODULE_PATH=boot:///initrd.tar.gz