first commit

This commit is contained in:
Jack Halford 2019-04-23 19:39:21 +02:00
commit 80e86f4ec0
3 changed files with 32 additions and 0 deletions

6
unikernel-demo/Makefile Normal file
View file

@ -0,0 +1,6 @@
export ukl-obj-m := fs1.o
all:
$(MAKE) -C ../whiterose/ UKL=$(PWD) bzImage
qemu:
qemu-system-x86_64 -enable-kvm -m 1G -s -kernel ../whiterose/arch/x86/boot/bzImage -append "console=ttyS0 ukl quiet" -nographic

1
unikernel-demo/README.md Normal file
View file

@ -0,0 +1 @@
# unikernel-demo

25
unikernel-demo/fs1.c Normal file
View file

@ -0,0 +1,25 @@
#include <unistd.h>
#include <fcntl.h>
#ifndef USERSPACE
# define main ukl_main
#endif
int main(void) {
char buf[256] = { 0 };
int fd = open("/etc/passwd", O_RDONLY);
ssize_t ret;
if (fd == -1)
return 1;
while ((ret = read(fd, buf, sizeof(buf))))
{
buf[ret] = 0;
write(1, buf, ret);
}
close(fd);
return 0;
}