From: John Hodge Date: Mon, 9 Jul 2012 04:38:29 +0000 (+0800) Subject: DiskTool - Now compiles (but does nothing) X-Git-Tag: rel0.15~611^2~41^2~29 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0a3c1408fe7dfd6c50d104eb3ecafc534719d4fe;p=tpg%2Facess2.git DiskTool - Now compiles (but does nothing) --- diff --git a/Tools/DiskTool/src/Makefile b/Tools/DiskTool/src/Makefile index 150cdbae..f7d72569 100644 --- a/Tools/DiskTool/src/Makefile +++ b/Tools/DiskTool/src/Makefile @@ -1,16 +1,23 @@ TARGET := $(shell gcc -v 2>&1 | grep Targ | awk '{print $$2}') +-include ../../Makefile.Version.cfg +-include Makefile.BuildNum +ifeq ($(BUILD_NUM),) +BUILD_NUM = 1 +endif + + KERNEL_SRC = ../../../KernelLand/Kernel/ BIN = ../DiskTool # Kernel Sources (compiled with -ffreestanding) K_OBJ = vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o -K_OBJ += vfs/nodecache.o vfs/mount.o vfs/memfile.o vfs/select.o +K_OBJ += vfs/nodecache.o vfs/mount.o vfs/memfile.o # vfs/select.o K_OBJ += vfs/fs/root.o vfs/fs/devfs.o K_OBJ += drv/proc.o # Local kernel soruces (same as above, but located in same directory as Makefile) -L_OBJ = vfs_handles.o threads.o nativefs.o +L_OBJ = vfs_handles.o threads.o nativefs.o time.o # Native Sources (compiled as usual) N_OBJ = main.o script.o logging.o @@ -18,6 +25,10 @@ N_OBJ = main.o script.o logging.o CFLAGS := -Wall CPPFLAGS := -I include/ K_CPPFLAGS := -I $(KERNEL_SRC)include +LDFLAGS += -Wl,--defsym,__buildnum=$(BUILD_NUM) + +BUILDINFO_OBJ := obj/$(TARGET)/buildinfo.o +BUILDINFO_SRC := $(BUILDINFO_OBJ:%.o=%.c) # == Start of Magic == OBJ_PREFIX = obj/$(TARGET)/ @@ -26,7 +37,7 @@ K_OBJ := $(addprefix $(K_OBJ_PREFIX),$(K_OBJ)) L_OBJ := $(addprefix $(OBJ_PREFIX),$(L_OBJ)) N_OBJ := $(addprefix $(OBJ_PREFIX),$(N_OBJ)) -OBJ := $(N_OBJ) $(L_OBJ) $(K_OBJ) +OBJ := $(N_OBJ) $(L_OBJ) $(K_OBJ) $(BUILDINFO_OBJ) DEPFILES = $(filter %.o,$(OBJ)) DEPFILES := $(DEPFILES:%=%.dep) @@ -40,18 +51,35 @@ clean: $(RM) -f $(OBJ) $(DEPFILES) $(BIN) $(BIN): $(OBJ) - $(CC) -o $(BIN) $(OBJ) $(LDFLAGS) + @echo [CC Link] -o $(BIN) + @$(CC) -o $(BIN) $(OBJ) $(LDFLAGS) + @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum $(K_OBJ): $(K_OBJ_PREFIX)%.o: $(KERNEL_SRC)%.c @mkdir -p $(dir $@) - $(CC) -c $< -o $@ -ffreestanding $(CFLAGS) $(CPPFLAGS) $(K_CPPFLAGS) -MMD -MP -MF $@.dep + @echo [CC Acess] -o $@ + @$(CC) -c $< -o $@ -ffreestanding $(CFLAGS) $(CPPFLAGS) $(K_CPPFLAGS) -MMD -MP -MF $@.dep $(L_OBJ): $(OBJ_PREFIX)%.o: %.c @mkdir -p $(dir $@) - $(CC) -c $< -o $@ -ffreestanding $(CFLAGS) $(CPPFLAGS) $(K_CPPFLAGS) -MMD -MP -MF $@.dep + @echo [CC Acess] -o $@ + @$(CC) -c $< -o $@ -ffreestanding $(CFLAGS) $(CPPFLAGS) $(K_CPPFLAGS) -MMD -MP -MF $@.dep $(N_OBJ): $(OBJ_PREFIX)%.o: %.c @mkdir -p $(dir $@) - $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) -MMD -MP -MF $@.dep + @echo [CC Native] -o $@ + @$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) -MMD -MP -MF $@.dep + +# Hacky buildinfo.c file +$(BUILDINFO_SRC): $(filter-out $(BUILDINFO_OBJ), $(OBJ)) Makefile + @echo "" > $@ + @echo "const char gsKernelVersion[] = \"$(ACESS_VERSION)\";" >> $@ + @echo "const char gsGitHash[] = \""`git log -n 1 | head -n 1 | awk '{print $$2}'`"\";" >> $@ + @echo "const int giBuildNumber = $(BUILD_NUM);" >> $@ +$(BUILDINFO_OBJ): $(BUILDINFO_SRC) + @echo [CC] -o $@ + @$(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS) + +$(OBJ): Makefile -include $(DEPFILES) diff --git a/Tools/DiskTool/src/include/acess.h b/Tools/DiskTool/src/include/acess.h index ec319f21..79eb27ed 100644 --- a/Tools/DiskTool/src/include/acess.h +++ b/Tools/DiskTool/src/include/acess.h @@ -79,6 +79,8 @@ extern tGID Threads_GetGID(void); #define errno (*(Threads_GetErrno())) #include +extern int strpos(const char *Str, char Ch); +extern void itoa(char *buf, uint64_t num, int base, int minLength, char pad); #define ENTER(...) do{}while(0) diff --git a/Tools/DiskTool/src/main.c b/Tools/DiskTool/src/main.c index 3698df64..bb9e9f24 100644 --- a/Tools/DiskTool/src/main.c +++ b/Tools/DiskTool/src/main.c @@ -9,16 +9,18 @@ // === CODE === int main(int argc, char *argv[]) { + return 0; } +// NOTE: This is in a native compiled file because it needs access to the real errno macro int *Threads_GetErrno(void) { return &errno; } // TODO: Move into a helper lib? -extern void itoa(char *buf, uint64_t num, int base, int minLength, char pad) +void itoa(char *buf, uint64_t num, int base, int minLength, char pad) { char fmt[] = "%0ll*x"; switch(base) diff --git a/Tools/DiskTool/src/time.c b/Tools/DiskTool/src/time.c index e69de29b..445b04b1 100644 --- a/Tools/DiskTool/src/time.c +++ b/Tools/DiskTool/src/time.c @@ -0,0 +1,32 @@ +/* + * Acess2 DiskTool + * - By John Hodge (thePowersGang) + * + * time.c + * - Timing functions (emulated) + */ +#include +#include + +// === CODE === +tTimer *Time_AllocateTimer(tTimerCallback *Callback, void *Argument) +{ + return NULL; +} + +void Time_ScheduleTimer(tTimer *Timer, int Delta) +{ + +} + +void Time_FreeTimer(tTimer *Timer) +{ + +} + +Sint64 now(void) +{ + // TODO: Translate UNIX time into Acess time + return 0; +} +