From ed3c578e6436e797b5e2ff55d2ee098e820aac18 Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Fri, 13 Dec 2013 20:50:04 -0800 Subject: [PATCH] clean up some legacy util stuff --- Makefile | 41 ++----------------------- kernel/fs/devfs.c | 48 ------------------------------ {util => userspace/util}/readelf.c | 2 +- util/typewriter.c | 18 ----------- 4 files changed, 4 insertions(+), 105 deletions(-) delete mode 100644 kernel/fs/devfs.c rename {util => userspace/util}/readelf.c (99%) delete mode 100644 util/typewriter.c diff --git a/Makefile b/Makefile index 642b01f9..44e505b9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ # ToAruOS Primary Build Script -# This script will pull either clang (with -fcolor-diagnostics), gcc (with no extra options), or cc -# ifeq ($(CCC_ANALYZE),yes) # CC is set by CCC_ANALYZE to clang # It is not recommended that you use a kernel built this way @@ -9,25 +7,14 @@ CC = i686-pc-toaru-gcc endif # CFLAGS for core components CFLAGS = -Wall -Wextra -pedantic -m32 -O0 -std=c99 -finline-functions -fno-stack-protector -nostdinc -ffreestanding -Wno-unused-function -Wno-unused-parameter -Wstrict-prototypes -g -# CFLAGS for native utils -NATIVEFLAGS = -std=c99 -g -pedantic -Wall -Wextra -Wno-unused-parameter # Linker for core LD = i686-pc-toaru-ld YASM = yasm # Feel free to be specific, but I'd rather you not be. -FILESYSTEMS = $(patsubst %.c,%.o,$(wildcard kernel/fs/*.c)) -VIDEODRIVERS = $(patsubst %.c,%.o,$(wildcard kernel/video/*.c)) -DEVICES = $(patsubst %.c,%.o,$(wildcard kernel/devices/*.c)) -VIRTUALMEM = $(patsubst %.c,%.o,$(wildcard kernel/mem/*.c)) -MISCMODS = $(patsubst %.c,%.o,$(wildcard kernel/misc/*.c)) -SYSTEM = $(patsubst %.c,%.o,$(wildcard kernel/sys/*.c)) -DATASTRUCTS = $(patsubst %.c,%.o,$(wildcard kernel/ds/*.c)) -CPUBITS = $(patsubst %.c,%.o,$(wildcard kernel/cpu/*.c)) +SUBMODULES = $(patsubst %.c,%.o,$(wildcard kernel/*/*.c)) -SUBMODULES = ${MODULES} ${FILESYSTEMS} ${VIDEODRIVERS} ${DEVICES} ${VIRTUALMEM} ${MISCMODS} ${SYSTEM} ${DATASTRUCTS} ${CPUBITS} USERSPACE = $(shell find userspace/ -type f -name '*.c') $(shell find userspace/ -type f -name '*.cpp') $(shell find userspace/ -type f -name '*.h') -UTILITIES = util/bin/readelf util/bin/typewriter util/bin/bim EMU = qemu-system-i386 GENEXT = genext2fs DISK_SIZE = 524288 @@ -46,11 +33,10 @@ ENDRM = util/mk-end-rm EMUARGS = -sdl -kernel toaruos-kernel -m 1024 -serial stdio -vga std -hda toaruos-disk.img -k en-us -no-frame -rtc base=localtime EMUKVM = -enable-kvm -.PHONY: all system clean clean-once clean-hard clean-soft clean-bin clean-aux clean-core install run utils +.PHONY: all system clean clean-once clean-hard clean-soft clean-bin clean-aux clean-core install run .SECONDARY: all: .passed system tags -aux: utils system: .passed toaruos-disk.img toaruos-kernel install: system @@ -86,8 +72,6 @@ run-config: system test: system python util/run-tests.py 2>/dev/null -utils: ${UTILITIES} - .passed: @util/check-reqs > /dev/null @touch .passed @@ -142,20 +126,6 @@ toaruos-disk.img: .userspace-check @${END} "hdd" "Generated Hard Disk image" @${INFO} "--" "Hard disk image is ready!" -################ -# Utilities # -################ - -util/bin/bim: userspace/bim.c - @${BEG} "CC" "$<" - @${CC} -std=c99 -posix -m32 -g -o $@ $< userspace/lib/wcwidth.c - @${END} "CC" "$<" - -util/bin/%: util/%.c - @${BEG} "CC" "$<" - @${CC} ${NATIVEFLAGS} -o $@ $< ${ERRORS} - @${END} "CC" "$<" - ############## # ctags # ############## @@ -179,11 +149,6 @@ clean-bin: @-rm -f hdd/bin/* @${ENDRM} "RM" "Cleaned native binaries" -clean-aux: - @${BEGRM} "RM" "Cleaning auxillary files..." - @-rm -f util/bin/* - @${ENDRM} "RM" "Cleaned auxillary files" - clean-core: @${BEGRM} "RM" "Cleaning final output..." @-rm -f toaruos-kernel @@ -193,7 +158,7 @@ clean-core: clean: clean-soft clean-core @${INFO} "--" "Finished soft cleaning" -clean-hard: clean clean-bin clean-aux +clean-hard: clean clean-bin @${INFO} "--" "Finished hard cleaning" clean-disk: diff --git a/kernel/fs/devfs.c b/kernel/fs/devfs.c deleted file mode 100644 index 55960354..00000000 --- a/kernel/fs/devfs.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ToAruOS DevFS - * - */ -#include -#include - -uint32_t read_devfs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer); -uint32_t write_devfs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer); -void open_devfs(fs_node_t *node, uint8_t read, uint8_t write); -void close_devfs(fs_node_t *node); -struct dirent *readdir_devfs(fs_node_t *node, uint32_t index); -fs_node_t *finddir_devfs(fs_node_t *node, char *name); - -fs_node_t * devfs_root; - -/* - * Install the DevFS to the given path. - * Path should be `/dev` - */ -void -devfs_install(char * path) { - fs_node_t * dev_node = kopen(path,0); - kprintf("Installing devfs... %s\n", dev_node->name); -} - -/* - * These functions require that the requested node have a valid handler of their own - * and are not part of the devfs natively - */ -uint32_t read_devfs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) { - return -1; -} -uint32_t write_devfs(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buffer) { - return -1; -} - - -fs_node_t * -devfs_create_keyboard(void) { - return NULL; -} - -/* - * vim:noexpandtab - * vim:tabstop=4 - * vim:shiftwidth=4 - */ diff --git a/util/readelf.c b/userspace/util/readelf.c similarity index 99% rename from util/readelf.c rename to userspace/util/readelf.c index 834443fa..56f0feed 100644 --- a/util/readelf.c +++ b/userspace/util/readelf.c @@ -8,7 +8,7 @@ #include /* The Master ELF Header */ -#include "../kernel/include/elf.h" +#include "../../kernel/include/elf.h" /** * Show usage for the readelf application. diff --git a/util/typewriter.c b/util/typewriter.c deleted file mode 100644 index c76befe0..00000000 --- a/util/typewriter.c +++ /dev/null @@ -1,18 +0,0 @@ -#define _XOPEN_SOURCE 500 -#include -#include -#include - -int main(int argc, char ** argv) { - if (argc < 3) { return -1; } - FILE * f = fopen(argv[2],"r"); - char * buffer = malloc(sizeof(char) * 1); - while (!feof(f)) { - fread(buffer, 1, 1, f); - printf("%c", buffer[0]); - fflush(stdout); - usleep(atoi(argv[1])); - } - fclose(f); - return 0; -}