commit ed5b17d3c85de682a546a71547c56fbc08b97b9b from: Benjamin Stürz date: Thu Aug 15 22:13:22 2024 UTC initial autoconfiscation commit - 680d7d8ae8d10745aa6696d12af66b085ea66326 commit + ed5b17d3c85de682a546a71547c56fbc08b97b9b blob - d354e63370a9d4bc2b261d9e1870b54f53b97d21 (mode 644) blob + /dev/null --- Makefile +++ /dev/null @@ -1,86 +0,0 @@ -.SUFFIXES: -.SUFFIXES: .c .S .o .elf - -TOP != pwd -PREFIX = /usr/local -TARGET = riscv64-unknown-linux-musl -CROSS = ./tools/bin/${TARGET} - -include config.mk - -COPT = -g -O2 -CFLAGS = ${CFLAGS_OS} ${COPT} -std=c2x -Wall -Wextra -LDFLAGS = ${LDFLAGS_OS} -lpthread - -OBJ = src/linurv.o src/ecall.o src/cpu.o src/exec.o src/signal.o src/data.o -T = signal -PROGS = examples/test.elf \ - examples/echo.elf \ - examples/cat.elf \ - examples/hello.elf \ - examples/asm.elf \ - examples/signal.elf \ - examples/true.elf - -all: linurv ${PROGS} - -config: - @echo "CC=${CC}" - @echo "CXX=${CXX}" - @echo "SUDO=${SUDO}" - @echo "CFLAGS=${CFLAGS}" - @echo "LDFLAGS=${LDFLAGS}" - @echo "CHROOT=${CHROOT}" - -od: examples/$T.elf - ${CROSS}-objdump -d examples/$T.elf | less - -od-bb: - ${CROSS}-objdump -d rootfs/bb/bin/busybox | less - -run: linurv ${PROGS} - mkdir -p rootfs/bin - cp -f linurv rootfs/bin/ - for f in ${PROGS:.elf=}; do cp -f $$f.elf rootfs/bin/$$(basename "$$f"); done - cp -f test.txt rootfs/ - ${CHROOT} rootfs /bin/linurv -v /bin/$T - -distclean: clean - (cd tools; ${MAKE} distclean) - -clean: - rm -f linurv src/*.o examples/*.elf *.core src/syscalls.h src/signal-bootstrap-code.h src/sbc.* src/data.[ch] - rm -rf rootfs - -install: linurv - mkdir -p ${DESTDIR}${PREFIX}/bin - cp -f linurv ${DESTDIR}${PREFIX}/bin/ - -linurv: ${OBJ} - ${CC} -o $@ ${OBJ} ${LDFLAGS} - -${OBJ}: src/linurv.h src/data.h -src/ecall.o: src/syscalls.h - -src/cpu.o: src/signal-bootstrap-code.h - -src/syscalls.h: src/syscalls.inc src/gensyscalls.sh - sh src/gensyscalls.sh < src/syscalls.inc > $@ - -.c.o: - ${CC} -c -o $@ $< ${CFLAGS} - -src/signal-bootstrap-code.h: src/signal-bootstrap-code.S - ${CROSS}-as -o src/sbc.o src/signal-bootstrap-code.S - ${CROSS}-objcopy -O binary src/sbc.o src/sbc.bin - hexdump -v -e '16/1 "0x%02x," "\n"' $@ - rm -f src/sbc.* - -.c.elf: - ${CROSS}-gcc -g -o $@ $< -Og - -.S.elf: - ${CROSS}-gcc -g -o $@ $< - -src/data.c src/data.h: src/data.dst - (cd src && ../tools/bin/destruct -e little -H data.h -o data.c data.dst) blob - /dev/null blob + 0e19470f49f39191bd8c827f37040983f574f1bb (mode 644) --- /dev/null +++ Makefile.am @@ -0,0 +1,6 @@ +SUBDIRS = src + +full-clean: distclean + rm -rf src/.deps autom4te.cache build-aux + rm -f src/Makefile.in src/data.[ch] src/signal-bootstrap-code.h src/syscalls.h + rm -f Makefile.in aclocal.m4 config.h.in configure blob - /dev/null blob + 68f4a174b46edae62109464fab50034272627121 (mode 755) --- /dev/null +++ autogen.sh @@ -0,0 +1,2 @@ +#!/bin/sh +autoreconf -i blob - /dev/null blob + e2c2f780476334aab35e5224b5f7542a194046a1 (mode 644) --- /dev/null +++ src/Makefile.am @@ -0,0 +1,19 @@ +AM_CFLAGS = -std=c2x -Wall -Wextra +CROSS = ${top_srcdir}/tools/bin/riscv64-unknown-linux-musl +BUILT_SOURCES = syscalls.h signal-bootstrap-code.h data.h data.c signal-bootstrap-code.h +bin_PROGRAMS = linurv +linurv_SOURCES = linurv.c ecall.c cpu.c exec.c signal.c data.c + +full-clean: distclean + +signal-bootstrap-code.h: signal-bootstrap-code.S + ${CROSS}-as -o sbc.o signal-bootstrap-code.S + ${CROSS}-objcopy -O binary sbc.o sbc.bin + hexdump -v -e '16/1 "0x%02x," "\n"' $@ + rm -f sbc.* + +data.c data.h: data.dst + ../tools/bin/destruct -e little -H data.h -o data.c data.dst + +syscalls.h: syscalls.inc + ./gensyscalls.sh $@ blob - /dev/null blob + 984b6e73d9216c2b71334a56e3f7c7a3479a76c7 (mode 644) --- /dev/null +++ configure.ac @@ -0,0 +1,49 @@ +AC_PREREQ([2.71]) +AC_INIT([linurv], [0.1], [benni@stuerz.xuz]) + +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([1.16 foreign -Wall]) +AC_CONFIG_SRCDIR([src/linurv.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AC_PROG_AWK +AC_PROG_CC +AC_PROG_CXX + +# Checks for libraries. +AC_CHECK_LIB([pthread], [sched_get_priority_max]) + +# Checks for header files. +AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h sys/file.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_TYPE_UID_T +AC_C_INLINE +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INT8_T +AC_TYPE_MODE_T +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_CHECK_MEMBERS([struct stat.st_blksize]) +AC_STRUCT_ST_BLOCKS +AC_CHECK_MEMBERS([struct stat.st_rdev]) +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T + +# Checks for library functions. +AC_FUNC_ERROR_AT_LINE +AC_FUNC_FORK +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_FUNC_MALLOC +AC_FUNC_MMAP +AC_CHECK_FUNCS([err errx fchdir fdatasync ftruncate getcwd getpagesize memchr memset mkdir munmap setenv strcasecmp strdup uname]) + +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT