Skip to content

Commit

Permalink
win64 & unikernel build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
trholding committed Aug 28, 2023
1 parent eb9d77f commit c3210fa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ model.h
.config
UNIK/
build/
stories15M.bin
18 changes: 14 additions & 4 deletions L2E_amd64_qemu.config
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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

Expand All @@ -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
#
Expand Down Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions run.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

// ----------------------------------------------------------------------------
Expand Down

0 comments on commit c3210fa

Please sign in to comment.