diff options
| author | Ada Christine <adachristine18@gmail.com> | 2024-03-03 08:44:42 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2024-03-03 08:44:42 +0000 |
| commit | f61da8be06fdfebc598cba783e78117319231140 (patch) | |
| tree | 0ef21f89e98a985ab5d985aaac1e032c868e8b81 | |
| parent | 9681d6a6cbde12b00beab62683b8db98f680ba2b (diff) | |
build changes
| -rw-r--r-- | boot/Makefile (renamed from kjarna/Makefile) | 0 | ||||
| -rw-r--r-- | boot/efi/config.h | 4 | ||||
| -rw-r--r-- | boot/efi/file.c (renamed from kjarna/efi/file.c) | 12 | ||||
| -rw-r--r-- | boot/efi/image.c (renamed from kjarna/efi/image.c) | 4 | ||||
| -rw-r--r-- | boot/efi/kjarna_efi.h (renamed from kjarna/efi/kjarna_efi.h) | 0 | ||||
| -rw-r--r-- | boot/efi/memory.c (renamed from kjarna/efi/memory.c) | 0 | ||||
| -rw-r--r-- | boot/efi/protocol.c (renamed from kjarna/efi/protocol.c) | 0 | ||||
| -rw-r--r-- | boot/efi/start.c (renamed from kjarna/efi/start.c) | 0 | ||||
| -rw-r--r-- | boot/kjarna.h (renamed from kjarna/kjarna.h) | 0 | ||||
| -rw-r--r-- | boot/main.c (renamed from kjarna/main.c) | 0 | ||||
| -rwxr-xr-x | debug.sh | 42 | ||||
| -rw-r--r-- | service/Makefile (renamed from kjarna_runtime/Makefile) | 0 | ||||
| -rw-r--r-- | service/dynamic_x86_64.c (renamed from kjarna_runtime/dynamic_x86_64.c) | 0 | ||||
| -rw-r--r-- | service/kc.h (renamed from kjarna_runtime/kc.h) | 0 | ||||
| -rw-r--r-- | service/kc.ld (renamed from kjarna_runtime/kc.ld) | 0 | ||||
| -rw-r--r-- | service/kjarna.c (renamed from kjarna_runtime/kjarna.c) | 0 | ||||
| -rw-r--r-- | service/main.c (renamed from kjarna_runtime/main.c) | 0 | ||||
| -rw-r--r-- | service/start_x86_64.S (renamed from kjarna_runtime/start_x86_64.S) | 0 |
18 files changed, 46 insertions, 16 deletions
diff --git a/kjarna/Makefile b/boot/Makefile index 482744f..482744f 100644 --- a/kjarna/Makefile +++ b/boot/Makefile diff --git a/boot/efi/config.h b/boot/efi/config.h new file mode 100644 index 0000000..ae55f21 --- /dev/null +++ b/boot/efi/config.h @@ -0,0 +1,4 @@ +#pragma once + +#define SERVICE_FILE_PATH "/service/kjarna/kjarna.os" + diff --git a/kjarna/efi/file.c b/boot/efi/file.c index 517e09e..9178654 100644 --- a/kjarna/efi/file.c +++ b/boot/efi/file.c @@ -64,6 +64,16 @@ static void free_fd(int fd) } } +CHAR16 *swap_path_separator(CHAR16 *path) +{ + for (CHAR16 *r = path; *r != '\0'; r++) + { + *r = *r == L'/' ? '\\' : *r; + } + + return path; +} + int efi_open(const char *path, int flags, int mode) { static EFI_GUID lip_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID; @@ -108,6 +118,8 @@ int efi_open(const char *path, int flags, int mode) } else { + wcpath = swap_path_separator(wcpath); + efi_errno = root->Open( root, &open_files[fd], diff --git a/kjarna/efi/image.c b/boot/efi/image.c index c26b588..42dab7d 100644 --- a/kjarna/efi/image.c +++ b/boot/efi/image.c @@ -6,6 +6,8 @@ #include "kjarna_efi.h" +#include "config.h" + #include <efi/error.h> struct image_buffer @@ -89,7 +91,7 @@ static ssize_t load_segments(int fd, Elf64_Ehdr *ehdr, Elf64_Phdr *phdrs, char * static struct image_buffer load_image(void) { - const char *image_entry_path = "\\adasoft\\sophia\\kjarna.os"; + const char *image_entry_path = SERVICE_FILE_PATH; int image_fd; diff --git a/kjarna/efi/kjarna_efi.h b/boot/efi/kjarna_efi.h index ea9d3f1..ea9d3f1 100644 --- a/kjarna/efi/kjarna_efi.h +++ b/boot/efi/kjarna_efi.h diff --git a/kjarna/efi/memory.c b/boot/efi/memory.c index 7fbb4a8..7fbb4a8 100644 --- a/kjarna/efi/memory.c +++ b/boot/efi/memory.c diff --git a/kjarna/efi/protocol.c b/boot/efi/protocol.c index 6bf8123..6bf8123 100644 --- a/kjarna/efi/protocol.c +++ b/boot/efi/protocol.c diff --git a/kjarna/efi/start.c b/boot/efi/start.c index 8ef8cbe..8ef8cbe 100644 --- a/kjarna/efi/start.c +++ b/boot/efi/start.c diff --git a/kjarna/kjarna.h b/boot/kjarna.h index 81bb79b..81bb79b 100644 --- a/kjarna/kjarna.h +++ b/boot/kjarna.h diff --git a/kjarna/main.c b/boot/main.c index 38c913f..38c913f 100644 --- a/kjarna/main.c +++ b/boot/main.c @@ -1,30 +1,42 @@ #!/usr/bin/env bash -make -C kjarna_runtime && -make -C kjarna && +BOOT_DIR=boot +BOOT_FILE=${BOOT_DIR}/kjarna.efi -BOOT_DIR=EFI/BOOT -BOOT_FILE=BOOTX64.EFI -SYS_DIR=adasoft/sophia -OVMF_DIR=/usr/share/ovmf/x64 +SERVICE_DIR=service +SERVICE_FILE=${SERVICE_DIR}/kjarna.os -LOADER_FILE=kjarna/kjarna.efi -SHIM_FILE=kjarna_runtime/kjarna.os +FIRMWARE_DIR=/usr/share/ovmf/x64 +FIRMWARE_FILE=${FIRMWARE_DIR}/OVMF_CODE.fd +FIRMWARE_VARS=${FIRMWARE_DIR}/OVMF_VARS.fd -KERNEL_FILE=kc/core/kernel.os +INSTALL_PREFIX=adasoft/sophia + +make -C ${SERVICE_DIR} && +make -C ${BOOT_DIR} && tempdir=$(mktemp -d) && -rundir=${tempdir}/run && +rundir=${tempdir}/run + +varsfile=${tempdir}/$(basename ${FIRMWARE_VARS}) + +efidir=${rundir}/efi +efibootdir=${efidir}/boot +bootdir=${efidir}/adasoft/kjarna +bootfile=${efibootdir}/BOOTX64.EFI +servdir=${rundir}/service/kjarna -cp ${OVMF_DIR}/OVMF_VARS.fd ${tempdir} && +mkdir -p ${efidir} ${efibootdir} && +mkdir -p ${bootdir} ${servdir} && -mkdir -p ${rundir}/${BOOT_DIR} ${rundir}/${SYS_DIR} && -cp ${LOADER_FILE} ${rundir}/${BOOT_DIR}/${BOOT_FILE} && -cp ${LOADER_FILE} ${SHIM_FILE} ${rundir}/${SYS_DIR} && +cp ${FIRMWARE_VARS} ${varsfile} && +cp ${BOOT_FILE} ${bootdir} && +cp ${BOOT_FILE} ${bootfile} && +cp ${SERVICE_FILE} ${servdir} && qemu-system-x86_64 -d int \ -drive if=pflash,format=raw,unit=0,file=/usr/share/ovmf/x64/OVMF_CODE.fd,readonly=on \ - -drive if=pflash,format=raw,unit=1,file=${tempdir}/OVMF_VARS.fd \ + -drive if=pflash,format=raw,unit=1,file=${varsfile} \ -net none -drive file=fat:rw:${rundir} -monitor stdio \ -serial file:sophia.log -no-shutdown -no-reboot -s -S diff --git a/kjarna_runtime/Makefile b/service/Makefile index d6e762d..d6e762d 100644 --- a/kjarna_runtime/Makefile +++ b/service/Makefile diff --git a/kjarna_runtime/dynamic_x86_64.c b/service/dynamic_x86_64.c index 02538ec..02538ec 100644 --- a/kjarna_runtime/dynamic_x86_64.c +++ b/service/dynamic_x86_64.c diff --git a/kjarna_runtime/kc.h b/service/kc.h index ff3a1ca..ff3a1ca 100644 --- a/kjarna_runtime/kc.h +++ b/service/kc.h diff --git a/kjarna_runtime/kc.ld b/service/kc.ld index f7b0339..f7b0339 100644 --- a/kjarna_runtime/kc.ld +++ b/service/kc.ld diff --git a/kjarna_runtime/kjarna.c b/service/kjarna.c index 6b37d1e..6b37d1e 100644 --- a/kjarna_runtime/kjarna.c +++ b/service/kjarna.c diff --git a/kjarna_runtime/main.c b/service/main.c index 12a5522..12a5522 100644 --- a/kjarna_runtime/main.c +++ b/service/main.c diff --git a/kjarna_runtime/start_x86_64.S b/service/start_x86_64.S index 19db34f..19db34f 100644 --- a/kjarna_runtime/start_x86_64.S +++ b/service/start_x86_64.S |
