+ // Start UI subsystem
+ UI_Initialise(800, 480);
+
+ // - Ignore SIGUSR1 (used to wake threads)
+ signal(SIGUSR1, SIG_IGN);
+
+ // Initialise VFS
+ VFS_Init();
+ // - Start IO Drivers
+ if( Video_Install(NULL) ) {
+ Log_Error("Init", "Unable to load NativeVideo");
+ }
+ if( NativeKeyboard_Install(NULL) ) {
+ Log_Error("Init", "Unable to load NativeKeyboard");
+ }
+ NativeFS_Install(NULL);
+ // - Start VTerm
+ {
+ char *args[] = {
+ "Video=NativeVideo",
+ "Input=NativeKeyboard",
+ NULL
+ };
+ VT_Install(args);
+ }
+
+ VFS_MkDir("/Acess");
+ VFS_Mount(gsAcessDir, "/Acess", "nativefs", "");
+
+ Debug_SetKTerminal("/Devices/VTerm/8");
+
+ // Start syscall server
+ SyscallServer();
+
+ // Spawn root application
+ if( rootapp )
+ {
+ int pid;
+ char *args[7+rootapp_argc+1];
+
+ args[0] = "ld-acess";
+ args[1] = "--open"; args[2] = "/Devices/VTerm/0";
+ args[3] = "--open"; args[4] = "/Devices/VTerm/0";
+ args[5] = "--open"; args[6] = "/Devices/VTerm/0";
+ for( i = 0; i < rootapp_argc; i ++ )
+ args[7+i] = rootapp[i];
+ args[7+rootapp_argc] = NULL;
+
+ pid = fork();
+ if(pid < 0) {
+ perror("Starting root application [fork(2)]");
+ return 1;
+ }
+ if(pid == 0)
+ {
+ #ifdef __LINUX__
+ prctl(PR_SET_PDEATHSIG, SIGHUP); // LINUX ONLY!
+ #endif
+ execv("./ld-acess", args);
+ }
+ printf("Root application running as PID %i\n", pid);
+ }
+
+ UI_MainLoop();
+
+ return 0;