mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-25 22:14:34 +00:00
chore: Update codebase
Some checks failed
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 53s
Build OS / Build Cross-Compiler & Toolchain (push) Failing after 17m52s
Build OS / Analyze with CodeQL (cpp) (push) Has been skipped
Build OS / Build amd64 (push) Has been skipped
Build OS / Build i386 (push) Has been skipped
Build OS / Build aarch64 (push) Has been skipped
Some checks failed
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 53s
Build OS / Build Cross-Compiler & Toolchain (push) Failing after 17m52s
Build OS / Analyze with CodeQL (cpp) (push) Has been skipped
Build OS / Build amd64 (push) Has been skipped
Build OS / Build i386 (push) Has been skipped
Build OS / Build aarch64 (push) Has been skipped
This commit is contained in:
parent
640b902045
commit
ce3cf8162a
16
.github/workflows/makefile.yml
vendored
16
.github/workflows/makefile.yml
vendored
@ -57,21 +57,13 @@ jobs:
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools __clone_all_no_qemu
|
||||
|
||||
- name: Compile Binutils amd64
|
||||
- name: Compile Binutils
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_binutils_64
|
||||
run: make --quiet -C tools do_binutils
|
||||
|
||||
- name: Compile Binutils i386
|
||||
- name: Compile GCC
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_binutils_32
|
||||
|
||||
- name: Compile GCC amd64
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_gcc_64
|
||||
|
||||
- name: Compile GCC i386
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
run: make --quiet -C tools do_gcc_32
|
||||
run: make --quiet -C tools do_gcc
|
||||
|
||||
- name: Clean Up
|
||||
if: steps.cache-cross.outputs.cache-hit != 'true'
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -14,7 +14,7 @@ tools/*
|
||||
!tools/*.patch
|
||||
!tools/*.cpp
|
||||
!tools/*.cfg
|
||||
!tools/SSDT1.dat
|
||||
!tools/acpi
|
||||
doxygen-doc
|
||||
initrd.tar
|
||||
.dccache
|
||||
@ -29,3 +29,4 @@ initrd.tar
|
||||
*.so
|
||||
*.o
|
||||
*.dmp
|
||||
*.pcap
|
||||
|
@ -36,10 +36,8 @@ RUN apt -y install \
|
||||
RUN apt clean && rm -rf /var/lib/apt/lists
|
||||
|
||||
RUN make -C tools __clone_all_no_qemu
|
||||
RUN make --quiet -C tools do_binutils_64
|
||||
RUN make --quiet -C tools do_binutils_32
|
||||
RUN make --quiet -C tools do_gcc_64
|
||||
RUN make --quiet -C tools do_gcc_32
|
||||
RUN cd tools && rm -rf binutils-gdb gcc build-binutils64 build-gcc64 build-binutils32 build-gcc32
|
||||
RUN make --quiet -C tools do_binutils
|
||||
RUN make --quiet -C tools do_gcc
|
||||
RUN cd tools && rm -rf binutils-gdb gcc
|
||||
|
||||
RUN make build
|
||||
|
16
Makefile
16
Makefile
@ -39,7 +39,7 @@ QEMUFLAGS += -device vmware-svga -M q35 \
|
||||
-device AC97,audiodev=pa1 \
|
||||
-device intel-hda \
|
||||
-device ich9-intel-hda \
|
||||
-acpitable file=tools/SSDT1.dat
|
||||
-acpitable file=tools/acpi/SSDT1.dat
|
||||
else ifeq ($(OSARCH), i386)
|
||||
QEMUFLAGS += -M q35 \
|
||||
-usb \
|
||||
@ -63,7 +63,7 @@ QEMUFLAGS += -M q35 \
|
||||
-device AC97,audiodev=pa1 \
|
||||
-device intel-hda \
|
||||
-device ich9-intel-hda \
|
||||
-acpitable file=tools/SSDT1.dat
|
||||
-acpitable file=tools/acpi/SSDT1.dat
|
||||
else ifeq ($(OSARCH), aarch64)
|
||||
QEMUFLAGS += -M raspi3b \
|
||||
-cpu cortex-a57 \
|
||||
@ -72,7 +72,7 @@ QEMUFLAGS += -M raspi3b \
|
||||
-serial file:serial3.dmp \
|
||||
-serial stdio \
|
||||
-kernel $(OSNAME).img \
|
||||
-acpitable file=tools/SSDT1.dat
|
||||
-acpitable file=tools/acpi/SSDT1.dat
|
||||
endif
|
||||
|
||||
doxygen:
|
||||
@ -137,13 +137,13 @@ endif
|
||||
cp Kernel/fennix.elf initrd.tar \
|
||||
iso_tmp_data/
|
||||
ifeq ($(BOOTLOADER), limine)
|
||||
cp tools/limine.cfg $(LIMINE_FOLDER)/limine-bios.sys \
|
||||
$(LIMINE_FOLDER)/limine-bios-cd.bin \
|
||||
$(LIMINE_FOLDER)/limine-uefi-cd.bin \
|
||||
cp tools/limine.cfg tools/limine/limine-bios.sys \
|
||||
tools/limine/limine-bios-cd.bin \
|
||||
tools/limine/limine-uefi-cd.bin \
|
||||
iso_tmp_data/
|
||||
mkdir -p iso_tmp_data/EFI/BOOT
|
||||
cp $(LIMINE_FOLDER)/BOOTX64.EFI \
|
||||
$(LIMINE_FOLDER)/BOOTIA32.EFI \
|
||||
cp tools/limine/BOOTX64.EFI \
|
||||
tools/limine/BOOTIA32.EFI \
|
||||
iso_tmp_data/EFI/BOOT/
|
||||
xorriso -as mkisofs -quiet -b limine-bios-cd.bin \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
|
@ -26,9 +26,6 @@ QUIET_BUILD = 1
|
||||
# The path of the cross-compiler.
|
||||
COMPILER_PATH = tools/cross/bin
|
||||
|
||||
# The path of the Limine bootloader.
|
||||
LIMINE_FOLDER = tools/limine
|
||||
|
||||
# Qemu path. If you want to use the one
|
||||
# you have installed in your system, change
|
||||
# it to /usr/bin/qemu-system-
|
||||
|
147
tools/Fex.c
147
tools/Fex.c
@ -1,147 +0,0 @@
|
||||
// FEX is a file format. Right now in development.
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../Kernel/Fex.hpp"
|
||||
|
||||
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("--- FEX file viewer ---\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);
|
||||
|
||||
struct Fex *FexFile = Buffer;
|
||||
|
||||
if (FexFile->Magic[0] != 'F' || FexFile->Magic[1] != 'E' || FexFile->Magic[2] != 'X' || FexFile->Magic[3] != '\0')
|
||||
{
|
||||
printf("Invalid FEX header. Checking if it's in an ELF file...\n");
|
||||
if (st.st_size > 0x1000)
|
||||
{
|
||||
struct Fex *FexFile = (struct Fex *)(Buffer + 0x1000);
|
||||
if (FexFile->Magic[0] != 'F' || FexFile->Magic[1] != 'E' || FexFile->Magic[2] != 'X' || FexFile->Magic[3] != '\0')
|
||||
{
|
||||
printf("Invalid FEX header. Exiting...\n");
|
||||
fclose(FilePointer);
|
||||
free(Buffer);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Invalid FEX header. Exiting...\n");
|
||||
fclose(FilePointer);
|
||||
free(Buffer);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
struct FexExtended *FexExtendedFile = (struct FexExtended *)(Buffer + EXTENDED_SECTION_ADDRESS);
|
||||
|
||||
printf("┌FEX File:\n");
|
||||
printf("├Magic: %c%c%c%c\n", FexFile->Magic[0], FexFile->Magic[1], FexFile->Magic[2], FexFile->Magic[3]);
|
||||
printf("├Type: %d\n", FexFile->Type);
|
||||
printf("├Operating System: %d\n", FexFile->OS);
|
||||
printf("├Entry Point: %#lx\n", FexFile->EntryPoint);
|
||||
printf("┊\n");
|
||||
printf("├FEX Extended Header:\n");
|
||||
printf("│ ├Executable:\n");
|
||||
printf("│ │ └<not implemented>\n");
|
||||
// TODO: Add more stuff to executable category.
|
||||
printf("│ ├Driver:\n");
|
||||
printf("│ │ ├Name: %s\n", FexExtendedFile->Driver.Name);
|
||||
printf("│ │ ├Type: %d\n", FexExtendedFile->Driver.Type);
|
||||
printf("│ │ ├Callback: %#lx\n", FexExtendedFile->Driver.Callback);
|
||||
printf("│ │ ├Bind:\n");
|
||||
printf("│ │ │ ├Type: %d\n", FexExtendedFile->Driver.Bind.Type);
|
||||
printf("│ │ │ ├Interrupt:\n");
|
||||
printf("│ │ │ │ └Vectors: ");
|
||||
for (int i = 0; i < 16; i++)
|
||||
printf("%#x ", FexExtendedFile->Driver.Bind.Interrupt.Vector[i]);
|
||||
printf("\n");
|
||||
printf("│ │ │ ├Process:\n");
|
||||
printf("│ │ │ │ └Process IDs: ");
|
||||
for (int i = 0; i < 16; i++)
|
||||
printf("%d ", FexExtendedFile->Driver.Bind.Process.ProcessId[i]);
|
||||
printf("\n");
|
||||
printf("│ │ │ ├PCI:\n");
|
||||
printf("│ │ │ │ ├Vendor IDs: ");
|
||||
for (int i = 0; i < 16; i++)
|
||||
printf("%#x ", FexExtendedFile->Driver.Bind.PCI.VendorID[i]);
|
||||
printf("\n");
|
||||
printf("│ │ │ │ ├Device IDs: ");
|
||||
for (int i = 0; i < 16; i++)
|
||||
printf("%#x ", FexExtendedFile->Driver.Bind.PCI.DeviceID[i]);
|
||||
printf("\n");
|
||||
printf("│ │ │ │ ├Class: %#x\n", FexExtendedFile->Driver.Bind.PCI.Class);
|
||||
printf("│ │ │ │ ├SubClass: %#x\n", FexExtendedFile->Driver.Bind.PCI.SubClass);
|
||||
printf("│ │ │ │ └ProgIF: %#x\n", FexExtendedFile->Driver.Bind.PCI.ProgIF);
|
||||
printf("│ │ │ ├Input:\n");
|
||||
printf("│ │ │ │ ├Attach to mouse: %s\n", FexExtendedFile->Driver.Bind.Input.AttachToMouse ? "true" : "false");
|
||||
printf("│ │ │ │ └Attach to keyboard: %s\n", FexExtendedFile->Driver.Bind.Input.AttachToKeyboard ? "true" : "false");
|
||||
printf("┊ ┊ ┊ ┊\n");
|
||||
|
||||
fclose(FilePointer);
|
||||
free(Buffer);
|
||||
return 0;
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
WORKING_DIR = $(shell pwd)
|
||||
WORKING_DIR = $(CURDIR)
|
||||
CROSS_DIR=$(WORKING_DIR)/cross
|
||||
export PATH := $(CROSS_DIR):$(PATH)
|
||||
|
||||
QEMU_VERSION = 8.1.2
|
||||
QEMU_VERSION = 8.2.8
|
||||
|
||||
all: do_tools do_limine __clone_all do_binutils_64 do_gcc_64 do_binutils_32 do_gcc_32 do_qemu
|
||||
all: do_tools do_limine __clone_all do_binutils do_gcc do_qemu
|
||||
|
||||
clean:
|
||||
rm -f rep ep
|
||||
@ -29,7 +29,7 @@ ifeq ("$(wildcard ./qemu)", "")
|
||||
rm -f qemu-${QEMU_VERSION}.tar.xz
|
||||
mv qemu-${QEMU_VERSION} qemu
|
||||
else
|
||||
$(info > TOOLS: Skipping cloning qemu because directory already exists.)
|
||||
$(info > TOOLS: Skipping downloading qemu because directory already exists.)
|
||||
endif
|
||||
|
||||
.PHONY: all clean __clone_binutils __clone_gcc __prep_cross __patch_cross __patch_cross_binutils __patch_cross_gcc
|
||||
@ -91,7 +91,8 @@ do_qemu: __prep_cross
|
||||
--disable-opengl && \
|
||||
make --quiet -j$(shell nproc) && make --quiet install
|
||||
|
||||
do_binutils_64:
|
||||
do_binutils:
|
||||
# x86_64
|
||||
$(MAKE) __patch_cross_binutils
|
||||
$(MAKE) __prep_cross
|
||||
cd binutils-gdb/__build && \
|
||||
@ -100,8 +101,18 @@ do_binutils_64:
|
||||
--with-sysroot --enable-shared --disable-werror && \
|
||||
make --quiet all -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
# i386
|
||||
$(MAKE) __patch_cross_binutils
|
||||
$(MAKE) __prep_cross
|
||||
cd binutils-gdb/__build && \
|
||||
../configure --target=i386-fennix \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls --quiet \
|
||||
--with-sysroot --enable-shared --disable-werror && \
|
||||
make --quiet all -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
|
||||
do_gcc_64:
|
||||
do_gcc:
|
||||
# x86_64
|
||||
$(MAKE) __patch_cross_gcc
|
||||
$(MAKE) __prep_cross
|
||||
cd gcc/__build && \
|
||||
@ -112,18 +123,7 @@ do_gcc_64:
|
||||
make --quiet all-target-libgcc -j$(shell nproc) && \
|
||||
make --quiet install-gcc -j$(shell nproc) && \
|
||||
make --quiet install-target-libgcc -j$(shell nproc)
|
||||
|
||||
do_binutils_32:
|
||||
$(MAKE) __patch_cross_binutils
|
||||
$(MAKE) __prep_cross
|
||||
cd binutils-gdb/__build && \
|
||||
../configure --target=i386-fennix \
|
||||
--prefix="$(CROSS_DIR)" --disable-nls --quiet \
|
||||
--with-sysroot --enable-shared --disable-werror && \
|
||||
make --quiet all -j$(shell nproc) && \
|
||||
make --quiet install
|
||||
|
||||
do_gcc_32:
|
||||
# i386
|
||||
$(MAKE) __patch_cross_gcc
|
||||
$(MAKE) __prep_cross
|
||||
cd gcc/__build && \
|
||||
|
Loading…
x
Reference in New Issue
Block a user