From c3210fa0ed9cbc849fdf3a439d7ce50e7ed500f2 Mon Sep 17 00:00:00 2001 From: Vulcan <93451215+trholding@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:31:54 +0530 Subject: [PATCH] win64 & unikernel build fixes --- .gitignore | 1 + L2E_amd64_qemu.config | 18 ++++++++++++++---- Makefile | 18 ++++++++++-------- run.c | 6 +++--- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 88f7be56..b81a9756 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ model.h .config UNIK/ build/ +stories15M.bin diff --git a/L2E_amd64_qemu.config b/L2E_amd64_qemu.config index ac470f63..13fbc8ef 100644 --- a/L2E_amd64_qemu.config +++ b/L2E_amd64_qemu.config @@ -1,8 +1,8 @@ # # Automatically generated file; DO NOT EDIT. -# Unikraft/0.14.0~2ebfa32b Configuration +# Unikraft/0.14.0~245a6829 Configuration # -CONFIG_UK_FULLVERSION="0.14.0~2ebfa32b" +CONFIG_UK_FULLVERSION="0.14.0~245a6829" CONFIG_UK_CODENAME="Prometheus" CONFIG_UK_ARCH="x86_64" CONFIG_UK_DEFNAME="L2E" @@ -71,14 +71,13 @@ CONFIG_KVM_SERIAL_BAUD_115200=y CONFIG_KVM_MAX_IRQ_HANDLER_ENTRIES=8 # CONFIG_KVM_PCI is not set -CONFIG_VIRTIO_BUS=y +# CONFIG_VIRTIO_BUS is not set # # Virtio # # end of Virtio -CONFIG_UKPLAT_ALLOW_GIC=y # CONFIG_PLAT_LINUXU is not set # CONFIG_PLAT_XEN is not set @@ -96,6 +95,16 @@ CONFIG_UKPLAT_LCPU_MAXCOUNT=1 CONFIG_HZ=100 # end of Platform Configuration +# +# Device Drivers +# + +# +# Interrupt controller +# +# end of Interrupt controller +# end of Device Drivers + # # Library Configuration # @@ -207,6 +216,7 @@ CONFIG_LIBUKDEBUG_PRINT_SRCNAME=y # CONFIG_LIBUKDEBUG_TRACEPOINTS is not set # CONFIG_LIBUKFALLOC is not set # CONFIG_LIBUKFALLOCBUDDY is not set +CONFIG_LIBUKINTCTLR=y CONFIG_LIBUKLIBID=y # CONFIG_LIBUKLIBPARAM is not set CONFIG_LIBUKLOCK=y diff --git a/Makefile b/Makefile index 5b630514..73eaf364 100644 --- a/Makefile +++ b/Makefile @@ -180,17 +180,19 @@ run_clang_static_strlit: run.c .PHONY: run_unik_qemu_x86_64 run_unik_qemu_x86_64: run.c - [ ! -d "UNIK" ] && echo "Cloning unikraft and musl sources..." - [ ! -d "UNIK/unikraft" ] && git clone https://github.com/unikraft/unikraft UNIK/unikraft - [ ! -d "UNIK/libs/musl" ] && git clone https://github.com/unikraft/lib-musl UNIK/libs/musl + [ ! -d "UNIK" ] && echo "Cloning unikraft and musl sources..." || true + [ ! -d "UNIK/unikraft" ] && git clone https://github.com/unikraft/unikraft UNIK/unikraft || true + [ ! -d "UNIK/libs/musl" ] && git clone https://github.com/unikraft/lib-musl UNIK/libs/musl || true make -f Makefile.unikernel # Build for termux on Android + .PHONY: run_incbin run_incbin: run.c - wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin - mkdir out - mv stories15M.bin out/model.bin + [ ! -d "out/" ] && echo "Downloading model..." || true + [ ! -d "out/" ] && wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin || true + [ ! -d "out/" ] && mkdir out || true + [ -f "stories15M.bin" ] && mv stories15M.bin out/model.bin || true $(CC) -Ofast -D INC_BIN -D MODPATH=$(MOD_PATH) -D TOKPATH=$(TOK_PATH) -o run run.c -lm # run all tests @@ -213,12 +215,12 @@ testcc: .PHONY: clean clean: - rm -f run run.com model.h tokenizer.h strlit run.com.dbg *~ + rm -f run run.com model.h tokenizer.h strlit run.com.dbg .config.old .config *~ make -f Makefile.unikernel clean .PHONY: distclean distclean: - rm -f run run.com model.h tokenizer.h strlit run.com.dbg *~ + rm -f run run.com model.h tokenizer.h strlit run.com.dbg .config.old .config *~ make -f Makefile.unikernel distclean rm -rf UNIK diff --git a/run.c b/run.c index e1700198..34325a21 100644 --- a/run.c +++ b/run.c @@ -6,12 +6,12 @@ // Unikraft Unikernel Support Directives // -#define LSTATUS 0 - #ifdef UNIK #define STRLIT #define LLOOP -#define LSTATUS 1 +#define LSTATUS 1 // Status on +#else +#define LSTATUS 0 // Status off #endif // ----------------------------------------------------------------------------