From 50392995d6e7f3a10fb74bb2f9073a4790f8933c Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Mon, 11 Mar 2024 21:40:28 -0400 Subject: simple env with basic test init program --- initrd/Makefile | 15 +++++++++++++++ initrd/archive/init | Bin 0 -> 4352 bytes initrd/programs/init/Makefile | 8 ++++++++ initrd/programs/init/main.c | 9 +++++++++ 4 files changed, 32 insertions(+) create mode 100644 initrd/Makefile create mode 100755 initrd/archive/init create mode 100644 initrd/programs/init/Makefile create mode 100644 initrd/programs/init/main.c (limited to 'initrd') diff --git a/initrd/Makefile b/initrd/Makefile new file mode 100644 index 0000000..66f3753 --- /dev/null +++ b/initrd/Makefile @@ -0,0 +1,15 @@ +ARCHIVEDIR := archive +PROGRAMSDIR := programs +FILESDIR := files + +PROGRAMDIRS := $(wildcard $(PROGRAMSDIR)/*) +PROGRAMBINS := $(patsubst $(PROGRAMSDIR)/%,$(ARCHIVEDIR)/%,$(PROGRAMDIRS)) + +OUT = initrd.tar + +all: ${PROGRAMBINS} + tar -cf $(OUT) -C $(ARCHIVEDIR) . + +.PHONY: $(ARCHIVEDIR)/% +$(ARCHIVEDIR)/% : $(PROGRAMSDIR)/% + $(MAKE) -C $< OUT=../../$@ ABIDIR=$(ABIDIR) diff --git a/initrd/archive/init b/initrd/archive/init new file mode 100755 index 0000000..44e70d6 Binary files /dev/null and b/initrd/archive/init differ diff --git a/initrd/programs/init/Makefile b/initrd/programs/init/Makefile new file mode 100644 index 0000000..3a283de --- /dev/null +++ b/initrd/programs/init/Makefile @@ -0,0 +1,8 @@ +CFILES := $(wildcard *.c) +OFILES := $(patsubst %.c,%.o,$(CFILES)) + +all: ${OFILES} + $(CC) $< -o $(OUT) -lc + +%.o : %.c + $(CC) -I$(ABIDIR) -g $(CFLAGS) -c $< -o $@ diff --git a/initrd/programs/init/main.c b/initrd/programs/init/main.c new file mode 100644 index 0000000..870ad28 --- /dev/null +++ b/initrd/programs/init/main.c @@ -0,0 +1,9 @@ +#include "syscall.h" + +int +main(int argc, char *argv[]) +{ + _syscall_log("Hello, Userland!\n"); + for(;;); + return 0; +} -- cgit v1.2.1