Remove some excess serail debugging

This commit is contained in:
K. Lange 2018-07-02 13:21:27 +09:00
parent 3700630f0e
commit 9533ea1bf6
4 changed files with 17 additions and 14 deletions

View File

@ -198,6 +198,7 @@ clean:
rm -f cdrom/boot/boot.sys
rm -f boot/*.o
rm -f cdrom/kernel
rm -f cdrom/netboot cdrom/netinit
rm -f ${KERNEL_OBJS} ${KERNEL_ASMOBJS} kernel/symbols.o kernel/symbols.S
rm -f base/lib/crt*.o
rm -f ${MODULES}

View File

@ -41,7 +41,6 @@ int start_options(char * args[]) {
int main(int argc, char * argv[]) {
set_console();
fprintf(stderr, "Hello, world?\n");
syscall_sethostname("base");

View File

@ -14,8 +14,6 @@ int main(int argc, char * argv[]) {
return 1;
}
TRACE("Starting live session.");
int _session_pid = fork();
if (!_session_pid) {
setuid(1000);

View File

@ -12,8 +12,12 @@
#include <toaru/hashmap.h>
#define TRACE_APP_NAME "migrate"
#define TRACE_(...) do { if (_debug) { TRACE(__VA_ARGS__); } } while (0)
#define CHUNK_SIZE 4096
static int _debug = 0;
int tokenize(char * str, char * sep, char **buf) {
char * pch_i;
char * save_i;
@ -122,8 +126,6 @@ hashmap_t * get_cmdline(void) {
out[r-1] = '\0';
}
TRACE("Command line: %s", out);
char * arg = strdup(out);
char * argv[1024];
int argc = tokenize(arg, " ", argv);
@ -164,16 +166,19 @@ _break:
int main(int argc, char * argv[]) {
TRACE("Reading command line.");
hashmap_t * cmdline = get_cmdline();
if (hashmap_has(cmdline, "logtoserial")) {
_debug = 1;
}
if (hashmap_has(cmdline, "root")) {
TRACE("Original root was %s", hashmap_get(cmdline, "root"));
TRACE_("Original root was %s", hashmap_get(cmdline, "root"));
} else if (hashmap_has(cmdline,"init") && !strcmp(hashmap_get(cmdline,"init"),"/dev/ram0")) {
TRACE("Init is ram0, so this is probably a netboot image, going to assume root is /tmp/netboot.img");
TRACE_("Init is ram0, so this is probably a netboot image, going to assume root is /tmp/netboot.img");
hashmap_set(cmdline,"root","/tmp/netboot.img");
} else {
TRACE("Fatal: Don't know how to boot this. No root set.\n");
TRACE_("Fatal: Don't know how to boot this. No root set.\n");
return 1;
}
@ -190,14 +195,14 @@ int main(int argc, char * argv[]) {
char tmp[1024];
TRACE("Remounting root to /dev/base");
TRACE_("Remounting root to /dev/base");
sprintf(tmp, "mount %s %s /dev/base", root_type, root);
system(tmp);
TRACE("Mounting tmpfs to /");
TRACE_("Mounting tmpfs to /");
system("mount tmpfs x /");
TRACE("Migrating root...");
TRACE_("Migrating root...");
copy_directory("/dev/base","/",0660);
system("mount tmpfs x /dev/base");
@ -207,12 +212,12 @@ int main(int argc, char * argv[]) {
if (c) {
*c = '\0';
}
TRACE("Freeing ramdisk at %s", tmp);
TRACE_("Freeing ramdisk at %s", tmp);
free_ramdisk(tmp);
free(tmp);
}
TRACE("Launching intended startup app...");
TRACE_("Launching intended startup app...");
if (!strcmp(start, "--vga")) {
execvp("/bin/terminal-vga", (char *[]){"terminal-vga","-l",NULL});
} else if (start) {