Index: trunk/Makefile.tsar
===================================================================
--- trunk/Makefile.tsar	(revision 380)
+++ trunk/Makefile.tsar	(revision 407)
@@ -18,4 +18,5 @@
 
 LIBGCC = -L$(shell $(CC) -print-libgcc-file-name | sed 's/libgcc.a//')
+
 # Default values for hardware parameters.
 # These parameters should be defined in the 'params.mk' file.
@@ -141,9 +142,8 @@
 
 SYS_OBJS_0  = build/kernel/syscalls/sys_thread_exit.o     \
-              build/kernel/syscalls/sys_mmap.o            \
+              build/kernel/syscalls/sys_thread_yield.o    \
               build/kernel/syscalls/sys_thread_create.o   \
               build/kernel/syscalls/sys_thread_join.o     \
               build/kernel/syscalls/sys_thread_detach.o   \
-              build/kernel/syscalls/sys_thread_yield.o    \
               build/kernel/syscalls/sys_sem.o             \
               build/kernel/syscalls/sys_condvar.o         \
@@ -151,8 +151,7 @@
               build/kernel/syscalls/sys_mutex.o
 
-SYS_OBJS_1  = build/kernel/syscalls/sys_thread_sleep.o    \
-              build/kernel/syscalls/sys_thread_wakeup.o   \
+SYS_OBJS_1  = build/kernel/syscalls/sys_munmap.o          \
               build/kernel/syscalls/sys_open.o            \
-              build/kernel/syscalls/sys_creat.o           \
+              build/kernel/syscalls/sys_mmap.o            \
               build/kernel/syscalls/sys_read.o            \
               build/kernel/syscalls/sys_write.o           \
@@ -169,5 +168,4 @@
               build/kernel/syscalls/sys_closedir.o        \
               build/kernel/syscalls/sys_getcwd.o          \
-              build/kernel/syscalls/sys_clock.o           \
               build/kernel/syscalls/sys_alarm.o           \
               build/kernel/syscalls/sys_rmdir.o
@@ -184,27 +182,31 @@
               build/kernel/syscalls/sys_trace.o
 
-VFS_OBJS    = build/kernel/vfs/vfs.o              \
-              build/kernel/vfs/fatfs.o            \
-              build/kernel/vfs/devfs.o            \
-              build/kernel/vfs/ramfs.o
+SYS_OBJS_4  = build/kernel/syscalls/sys_get_config.o      \
+              build/kernel/syscalls/sys_get_core.o        \
+              build/kernel/syscalls/sys_get_cycle.o       \
+              build/kernel/syscalls/sys_get_sched.o       \
+              build/kernel/syscalls/sys_panic.o           \
+              build/kernel/syscalls/sys_thread_sleep.o    \
+              build/kernel/syscalls/sys_thread_wakeup.o 
+
+VFS_OBJS    = build/kernel/fs/vfs.o              \
+              build/kernel/fs/fatfs.o            \
+              build/kernel/fs/devfs.o            \
+              build/kernel/fs/ramfs.o
 
 # List of directories to be searched for included files
 # when compiling for kernel.elf generation
-KERNEL_INCLUDE = -Ikernel                \
-                 -Ikernel/kern           \
-                 -Ikernel/devices        \
-                 -Ikernel/syscalls       \
+KERNEL_INCLUDE = -Ikernel                  \
+                 -Ikernel/kern             \
+                 -Ikernel/devices          \
+                 -Ikernel/syscalls         \
                  -Ihal/tsar_mips32/drivers \
-                 -Ikernel/syscalls       \
-                 -Ikernel/libk           \
-                 -Ikernel/mm             \
-                 -Ikernel/vfs            \
-                 -Ikernel/fatfs          \
-                 -Ikernel/sysfs          \
-                 -Ikernel/ramfs          \
-                 -Ikernel/devfs          \
-                 -Itools/arch_info       \
-                 -Ihal/generic           \
-                 -Ihal/tsar_mips32/core  \
+                 -Ikernel/syscalls         \
+                 -Ikernel/libk             \
+                 -Ikernel/mm               \
+                 -Ikernel/fs               \
+                 -Itools/arch_info         \
+                 -Ihal/generic             \
+                 -Ihal/tsar_mips32/core    \
                  -I.
 
@@ -222,5 +224,5 @@
 MTOOLS_SKIP_CHECK := 1
 
-# Rule to generate compile boot.elf, kernel.elf, init.elf and update virtual disk.
+# Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk.
 compile: dirs                     \
          build_disk               \
@@ -228,5 +230,6 @@
 		 build/boot/boot.elf      \
          build/kernel/kernel.elf  \
-         build/user/init/init.elf \
+         build/user/ksh/ksh.elf   \
+         build/user/sort/sort.elf \
          list
 
@@ -241,9 +244,9 @@
 	@mkdir -p build/kernel/libk
 	@mkdir -p build/kernel/drivers
-	@mkdir -p build/kernel/vfs
+	@mkdir -p build/kernel/fs
 	@mkdir -p build/kernel/syscalls
 	@mkdir -p build/user
-	@mkdir -p build/user/init
 	@mkdir -p build/user/ksh
+	@mkdir -p build/user/sort
 	@mkdir -p hdd
 
@@ -264,9 +267,10 @@
 	rm -f hard_config.h arch_info.xml arch_info.bin
 	rm -rf build
-	cd user/init   &&  $(MAKE) clean  &&  cd ../..
+	cd user/ksh  &&  $(MAKE) clean  &&  cd ../..
+	cd user/sort  &&  $(MAKE) clean  &&  cd ../..
 
 ####################################################	
 # Rule for building a new virtual disk from scratch.
-# It creates the bin, bin/kernel, bin/init, and home directories.
+# It creates the bin, bin/kernel, bin/user, and home directories.
 # This requires the generic Linux/MacOS 'create_dmg' script, that should be
 # placed in the same directory as this Makefile.
@@ -278,5 +282,5 @@
 	mmd 			-o -i $(DISK_IMAGE) ::/bin         || true
 	mmd 			-o -i $(DISK_IMAGE) ::/bin/kernel  || true
-	mmd 			-o -i $(DISK_IMAGE) ::/bin/init    || true
+	mmd 			-o -i $(DISK_IMAGE) ::/bin/user    || true
 	mmd 			-o -i $(DISK_IMAGE) ::/home        || true
 	mdir		 -/ -b -i $(DISK_IMAGE) ::/
@@ -421,5 +425,5 @@
 
 build/kernel/hal/hal_switch.o:  hal/tsar_mips32/core/hal_switch.S \
-                                hal/tsar_mips32/core/hal_switch.h
+                                hal/generic/hal_switch.h
 	$(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $<
 	$(DU) -D $@ > $@.txt
@@ -458,13 +462,14 @@
 
 #######################################
-# Rules to generate kernel/vfs objects
-build/kernel/vfs/%.o:           kernel/vfs/%.c              \
-                                kernel/vfs/%.h              \
-                                kernel_config.h             \
-                                hal/tsar_mips32/core/hal_types.h
-	$(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $<
-
-###########################################################
+# Rules to generate kernel/fs objects
+build/kernel/fs/%.o:            kernel/fs/%.c               \
+                                kernel/fs/%.h               \
+                                kernel_config.h             \
+                                hal/tsar_mips32/core/hal_types.h
+	$(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $<
+
+#############################################################
 # Rule to generate kernel.elf and place it on virtual disk
+# TODO the syscalls grouped in SYS_OBJS_2 must be introduced
 build/kernel/kernel.elf:	    $(KERN_OBJS)                \
                                 $(HAL_OBJS)                 \
@@ -478,4 +483,5 @@
                                 $(SYS_OBJS_2)               \
                                 $(SYS_OBJS_3)               \
+                                $(SYS_OBJS_4)               \
 								hal/tsar_mips32/kernel.ld
 	$(LD) -o $@ -T hal/tsar_mips32/kernel.ld $(LIBGCC)      \
@@ -483,14 +489,18 @@
           $(LIBK_OBJS) $(DRIVERS_OBJS) $(VFS_OBJS)          \
           $(SYS_OBJS_0) $(SYS_OBJS_1) $(SYS_OBJS_2)         \
-          $(SYS_OBJS_3) -lgcc
+          $(SYS_OBJS_3) $(SYS_OBJS_4) -lgcc
 
 	$(DU) -D $@ > $@.txt
 	mcopy -o -i $(DISK_IMAGE) build/kernel/kernel.elf ::/bin/kernel
 
-############################################################
-# Rule to generate the init.elf and place it on virtual disk
-build/user/init/init.elf : user/init/init.c 
-	$(MAKE) -C user/init 
-	mcopy -o -i $(DISK_IMAGE) user/init/init.elf ::/bin/init 
+###############################################################
+# Rules to generate various user .elf and copy on virtual disk
+
+build/user/ksh/ksh.elf : user/ksh/ksh.c 
+	$(MAKE) -C user/ksh 
+	mcopy -o -i $(DISK_IMAGE) user/ksh/ksh.elf ::/bin/user 
   
-
+build/user/sort/sort.elf : user/sort/sort.c 
+	$(MAKE) -C user/sort 
+	mcopy -o -i $(DISK_IMAGE) user/sort/sort.elf ::/bin/user 
+
