| 1 | ############################################################################# | 
|---|
| 2 | #                                               ALMOS-MK  Makefile for TSAR                         # | 
|---|
| 3 | ############################################################################# | 
|---|
| 4 |  | 
|---|
| 5 | -include params.mk | 
|---|
| 6 |  | 
|---|
| 7 | # Compilation flags. | 
|---|
| 8 | CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -g -O2 \ | 
|---|
| 9 |                  -fno-delete-null-pointer-checks | 
|---|
| 10 | #                -fno-delete-null-pointer-checks -std=c99 | 
|---|
| 11 |  | 
|---|
| 12 | # Export all variables to applications sub-Makefile. | 
|---|
| 13 | export  | 
|---|
| 14 | CC = mipsel-unknown-elf-gcc | 
|---|
| 15 | AS = mipsel-unknown-elf-as | 
|---|
| 16 | LD = mipsel-unknown-elf-ld | 
|---|
| 17 | DU = mipsel-unknown-elf-objdump | 
|---|
| 18 | AR = mipsel-unknown-elf-ar | 
|---|
| 19 |  | 
|---|
| 20 | # Default values for hardware parameters. | 
|---|
| 21 | # These parameters should be defined in the 'params.mk' file. | 
|---|
| 22 | ARCH            ?= /users/alain/soc/tsar-trunk-svn-2013/platforms/tsar_generic_iob  | 
|---|
| 23 | X_SIZE          ?= 2 | 
|---|
| 24 | Y_SIZE          ?= 2 | 
|---|
| 25 | NB_PROCS        ?= 2 | 
|---|
| 26 | NB_TTYS         ?= 1 | 
|---|
| 27 | FBF_WIDTH       ?= 256 | 
|---|
| 28 | IOC_TYPE        ?= IOC_BDV | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | # Checking hardware platform definition. | 
|---|
| 32 | ifeq ($(wildcard $(ARCH)),) | 
|---|
| 33 | $(error Please define in ARCH parameter the path to the hardware platform!) | 
|---|
| 34 | endif | 
|---|
| 35 |  | 
|---|
| 36 | # Rules that don't build target files  | 
|---|
| 37 | # always out-of-date, need to be regenerated everytime they are called | 
|---|
| 38 | .PHONY: compile                         \ | 
|---|
| 39 |                 dirs                                \ | 
|---|
| 40 |                 list                                \ | 
|---|
| 41 |                 extract                             \ | 
|---|
| 42 |                 fsck                                \ | 
|---|
| 43 |                 clean                               \ | 
|---|
| 44 |                 build-disk                          \ | 
|---|
| 45 |                 build/boot/boot.elf         \ | 
|---|
| 46 |                 build/kernel/kernel.elf  | 
|---|
| 47 |  | 
|---|
| 48 | # Objects to be linked for boot.elf generation | 
|---|
| 49 | BOOT_OBJS       = build/boot/boot.o            \ | 
|---|
| 50 |                           build/boot/boot_fat32.o      \ | 
|---|
| 51 |                           build/boot/boot_utils.o      \ | 
|---|
| 52 |                           build/boot/boot_entry.o      \ | 
|---|
| 53 |               build/boot/boot_tty_driver.o \ | 
|---|
| 54 |               build/boot/boot_hba_driver.o \ | 
|---|
| 55 |                           build/boot/boot_bdv_driver.o \ | 
|---|
| 56 |                           build/boot/boot_mmc_driver.o   | 
|---|
| 57 |  | 
|---|
| 58 | # List of directories to be searched for included files | 
|---|
| 59 | # when compiling for boot.elf generation | 
|---|
| 60 | BOOT_INCLUDE = -Itools/bootloader_tsar  \ | 
|---|
| 61 |                        -Itools/arch_info        \ | 
|---|
| 62 |                -Ihal/tsar_mips32        \ | 
|---|
| 63 |                -I. | 
|---|
| 64 |  | 
|---|
| 65 | # Objects to be linked for the soclib drivers library  | 
|---|
| 66 | DRIVERS_OBJS = build/kernel/drivers/soclib_tty.o  \ | 
|---|
| 67 |                build/kernel/drivers/soclib_bdv.o  \ | 
|---|
| 68 |                build/kernel/drivers/soclib_hba.o  \ | 
|---|
| 69 |                build/kernel/drivers/soclib_mmc.o  \ | 
|---|
| 70 |                build/kernel/drivers/soclib_xcu.o  \ | 
|---|
| 71 |                build/kernel/drivers/soclib_pic.o  \ | 
|---|
| 72 |                build/kernel/drivers/soclib_nic.o  \ | 
|---|
| 73 |                build/kernel/drivers/soclib_dma.o  \ | 
|---|
| 74 |                build/kernel/drivers/soclib_iob.o | 
|---|
| 75 |  | 
|---|
| 76 | # Objects to be linked for kernel.elf generation  | 
|---|
| 77 | KERN_OBJS       = build/kernel/kern/kernel_init.o     \ | 
|---|
| 78 |               build/kernel/kern/printk.o          \ | 
|---|
| 79 |               build/kernel/kern/thread.o          \ | 
|---|
| 80 |               build/kernel/kern/process.o         \ | 
|---|
| 81 |               build/kernel/kern/chdev.o           \ | 
|---|
| 82 |               build/kernel/kern/cluster.o         \ | 
|---|
| 83 |               build/kernel/kern/scheduler.o       \ | 
|---|
| 84 |               build/kernel/kern/core.o            \ | 
|---|
| 85 |               build/kernel/kern/dqdt.o            \ | 
|---|
| 86 |               build/kernel/kern/do_syscall.o      \ | 
|---|
| 87 |               build/kernel/kern/do_interrupt.o    \ | 
|---|
| 88 |               build/kernel/kern/do_exception.o    \ | 
|---|
| 89 |               build/kernel/kern/rpc.o             \ | 
|---|
| 90 |               build/kernel/kern/signal.o | 
|---|
| 91 |  | 
|---|
| 92 | HAL_OBJS    = build/kernel/hal/hal_special.o      \ | 
|---|
| 93 |               build/kernel/hal/hal_context.o      \ | 
|---|
| 94 |               build/kernel/hal/hal_atomic.o       \ | 
|---|
| 95 |               build/kernel/hal/hal_remote.o       \ | 
|---|
| 96 |               build/kernel/hal/hal_uspace.o       \ | 
|---|
| 97 |               build/kernel/hal/hal_irqmask.o      \ | 
|---|
| 98 |               build/kernel/hal/hal_gpt.o          \ | 
|---|
| 99 |               build/kernel/hal/hal_exception.o    \ | 
|---|
| 100 |               build/kernel/hal/hal_interrupt.o    \ | 
|---|
| 101 |               build/kernel/hal/hal_syscall.o      \ | 
|---|
| 102 |               build/kernel/hal/hal_kentry.o | 
|---|
| 103 |  | 
|---|
| 104 | DEV_OBJS    = build/kernel/devices/dev_txt.o      \ | 
|---|
| 105 |               build/kernel/devices/dev_ioc.o      \ | 
|---|
| 106 |               build/kernel/devices/dev_icu.o      \ | 
|---|
| 107 |               build/kernel/devices/dev_mmc.o      \ | 
|---|
| 108 |               build/kernel/devices/dev_nic.o      \ | 
|---|
| 109 |               build/kernel/devices/dev_pic.o      \ | 
|---|
| 110 |               build/kernel/devices/dev_dma.o      \ | 
|---|
| 111 |               build/kernel/devices/dev_fbf.o      \ | 
|---|
| 112 |               build/kernel/devices/dev_iob.o  | 
|---|
| 113 |  | 
|---|
| 114 | MM_OBJS     = build/kernel/mm/ppm.o               \ | 
|---|
| 115 |               build/kernel/mm/vmm.o               \ | 
|---|
| 116 |               build/kernel/mm/vseg.o              \ | 
|---|
| 117 |               build/kernel/mm/page.o              \ | 
|---|
| 118 |               build/kernel/mm/kcm.o               \ | 
|---|
| 119 |               build/kernel/mm/khm.o               \ | 
|---|
| 120 |               build/kernel/mm/mapper.o            \ | 
|---|
| 121 |               build/kernel/mm/kmem.o | 
|---|
| 122 |  | 
|---|
| 123 | LIBK_OBJS   = build/kernel/libk/grdxt.o           \ | 
|---|
| 124 |               build/kernel/libk/bits.o            \ | 
|---|
| 125 |               build/kernel/libk/elf.o             \ | 
|---|
| 126 |               build/kernel/libk/string.o          \ | 
|---|
| 127 |               build/kernel/libk/ctype.o           \ | 
|---|
| 128 |               build/kernel/libk/rwlock.o          \ | 
|---|
| 129 |               build/kernel/libk/spinlock.o        \ | 
|---|
| 130 |               build/kernel/libk/barrier.o         \ | 
|---|
| 131 |               build/kernel/libk/remote_barrier.o  \ | 
|---|
| 132 |               build/kernel/libk/remote_spinlock.o \ | 
|---|
| 133 |               build/kernel/libk/remote_rwlock.o   \ | 
|---|
| 134 |               build/kernel/libk/remote_fifo.o     \ | 
|---|
| 135 |               build/kernel/libk/remote_mutex.o    \ | 
|---|
| 136 |               build/kernel/libk/remote_sem.o      \ | 
|---|
| 137 |               build/kernel/libk/remote_condvar.o  \ | 
|---|
| 138 |               build/kernel/libk/memcpy.o          \ | 
|---|
| 139 |               build/kernel/libk/htab.o            \ | 
|---|
| 140 |               build/kernel/libk/xhtab.o | 
|---|
| 141 |  | 
|---|
| 142 | SYS_OBJS_0  = build/kernel/syscalls/sys_thread_exit.o     \ | 
|---|
| 143 |               build/kernel/syscalls/sys_mmap.o            \ | 
|---|
| 144 |               build/kernel/syscalls/sys_thread_create.o   \ | 
|---|
| 145 |               build/kernel/syscalls/sys_thread_join.o     \ | 
|---|
| 146 |               build/kernel/syscalls/sys_thread_detach.o   \ | 
|---|
| 147 |               build/kernel/syscalls/sys_thread_yield.o    \ | 
|---|
| 148 |               build/kernel/syscalls/sys_sem.o             \ | 
|---|
| 149 |               build/kernel/syscalls/sys_condvar.o         \ | 
|---|
| 150 |               build/kernel/syscalls/sys_barrier.o         \ | 
|---|
| 151 |               build/kernel/syscalls/sys_mutex.o | 
|---|
| 152 |  | 
|---|
| 153 | SYS_OBJS_1  = build/kernel/syscalls/sys_thread_sleep.o    \ | 
|---|
| 154 |               build/kernel/syscalls/sys_thread_wakeup.o   \ | 
|---|
| 155 |               build/kernel/syscalls/sys_open.o            \ | 
|---|
| 156 |               build/kernel/syscalls/sys_creat.o           \ | 
|---|
| 157 |               build/kernel/syscalls/sys_read.o            \ | 
|---|
| 158 |               build/kernel/syscalls/sys_write.o           \ | 
|---|
| 159 |               build/kernel/syscalls/sys_lseek.o           \ | 
|---|
| 160 |               build/kernel/syscalls/sys_close.o           \ | 
|---|
| 161 |               build/kernel/syscalls/sys_unlink.o          \ | 
|---|
| 162 |               build/kernel/syscalls/sys_pipe.o | 
|---|
| 163 |  | 
|---|
| 164 | SYS_OBJS_2  = build/kernel/syscalls/sys_chdir.o           \ | 
|---|
| 165 |               build/kernel/syscalls/sys_mkdir.o           \ | 
|---|
| 166 |               build/kernel/syscalls/sys_mkfifo.o          \ | 
|---|
| 167 |               build/kernel/syscalls/sys_opendir.o         \ | 
|---|
| 168 |               build/kernel/syscalls/sys_readdir.o         \ | 
|---|
| 169 |               build/kernel/syscalls/sys_closedir.o        \ | 
|---|
| 170 |               build/kernel/syscalls/sys_getcwd.o          \ | 
|---|
| 171 |               build/kernel/syscalls/sys_clock.o           \ | 
|---|
| 172 |               build/kernel/syscalls/sys_alarm.o           \ | 
|---|
| 173 |               build/kernel/syscalls/sys_rmdir.o     | 
|---|
| 174 |  | 
|---|
| 175 | SYS_OBJS_3  = build/kernel/syscalls/sys_utls.o            \ | 
|---|
| 176 |               build/kernel/syscalls/sys_chmod.o           \ | 
|---|
| 177 |               build/kernel/syscalls/sys_signal.o          \ | 
|---|
| 178 |               build/kernel/syscalls/sys_gettimeofday.o    \ | 
|---|
| 179 |               build/kernel/syscalls/sys_kill.o            \ | 
|---|
| 180 |               build/kernel/syscalls/sys_getpid.o          \ | 
|---|
| 181 |               build/kernel/syscalls/sys_fork.o            \ | 
|---|
| 182 |               build/kernel/syscalls/sys_exec.o            \ | 
|---|
| 183 |               build/kernel/syscalls/sys_stat.o            \ | 
|---|
| 184 |               build/kernel/syscalls/sys_trace.o          | 
|---|
| 185 |  | 
|---|
| 186 | SYS_OBJS_4  = build/kernel/syscalls/sys_madvise.o         \ | 
|---|
| 187 |               build/kernel/syscalls/sys_mcntl.o           \ | 
|---|
| 188 |               build/kernel/syscalls/sys_stat.o            \ | 
|---|
| 189 |               build/kernel/syscalls/sys_thread_migrate.o  \ | 
|---|
| 190 |               build/kernel/syscalls/sys_sbrk.o            \ | 
|---|
| 191 |               build/kernel/syscalls/sys_rmdir.o           \ | 
|---|
| 192 |               build/kernel/syscalls/sys_ftime.o           \ | 
|---|
| 193 |               build/kernel/syscalls/sys_chmod.o           \ | 
|---|
| 194 |               build/kernel/syscalls/sys_fsync.o           \ | 
|---|
| 195 |               build/kernel/syscalls/sys_gettimeofday.o | 
|---|
| 196 |  | 
|---|
| 197 | SYS_OBJS_5  = build/kernel/syscalls/sys_times.o  | 
|---|
| 198 |  | 
|---|
| 199 |  | 
|---|
| 200 | VFS_OBJS    = build/kernel/vfs/vfs.o              \ | 
|---|
| 201 |               build/kernel/vfs/fatfs.o            \ | 
|---|
| 202 |               build/kernel/vfs/devfs.o            \ | 
|---|
| 203 |               build/kernel/vfs/ramfs.o | 
|---|
| 204 |  | 
|---|
| 205 | # List of directories to be searched for included files | 
|---|
| 206 | # when compiling for kernel.elf generation  | 
|---|
| 207 | KERNEL_INCLUDE = -Ikernel                \ | 
|---|
| 208 |                  -Ikernel/kern           \ | 
|---|
| 209 |                  -Ikernel/devices        \ | 
|---|
| 210 |                  -Ikernel/syscalls       \ | 
|---|
| 211 |                  -Ikernel/drivers/soclib \ | 
|---|
| 212 |                  -Ikernel/syscalls       \ | 
|---|
| 213 |                  -Ikernel/libk           \ | 
|---|
| 214 |                  -Ikernel/mm             \ | 
|---|
| 215 |                  -Ikernel/vfs            \ | 
|---|
| 216 |                  -Ikernel/fatfs          \ | 
|---|
| 217 |                  -Ikernel/sysfs          \ | 
|---|
| 218 |                  -Ikernel/ramfs          \ | 
|---|
| 219 |                  -Ikernel/devfs          \ | 
|---|
| 220 |                  -Itools/arch_info       \ | 
|---|
| 221 |                  -Ihal/generic           \ | 
|---|
| 222 |                  -Ihal/tsar_mips32       \ | 
|---|
| 223 |                  -I. | 
|---|
| 224 |  | 
|---|
| 225 | # Macros to be processed by the C preprocessor. | 
|---|
| 226 | MACROS           = -DARCHINFO_PATHNAME="\"arch_info.bin\""              \ | 
|---|
| 227 |                            -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\"" | 
|---|
| 228 |  | 
|---|
| 229 | # Virtual disk path | 
|---|
| 230 | DISK_IMAGE      := hdd/virt_hdd.dmg | 
|---|
| 231 |  | 
|---|
| 232 | # The Mtools used to build the FAT32 disk image perfom a few sanity checks, to | 
|---|
| 233 | # make sure that the disk is indeed an MS-DOS disk. However, the size of the | 
|---|
| 234 | # disk image used by ALMOS-VM is not MS-DOS compliant.  | 
|---|
| 235 | # Setting this variable prevents these checks. | 
|---|
| 236 | MTOOLS_SKIP_CHECK := 1 | 
|---|
| 237 |  | 
|---|
| 238 | # Rule to compile boot.elf, kernel.elf, and update virtual disk. | 
|---|
| 239 | compile: dirs                               \ | 
|---|
| 240 |                  hard_config.h              \ | 
|---|
| 241 |                  build/boot/boot.elf        \ | 
|---|
| 242 |          build/kernel/kernel.elf    \ | 
|---|
| 243 |          list | 
|---|
| 244 |  | 
|---|
| 245 | # Rule to create the build directories. | 
|---|
| 246 | dirs: | 
|---|
| 247 |         @mkdir -p build/boot | 
|---|
| 248 |         @mkdir -p build/kernel | 
|---|
| 249 |         @mkdir -p build/kernel/kern | 
|---|
| 250 |         @mkdir -p build/kernel/hal | 
|---|
| 251 |         @mkdir -p build/kernel/devices | 
|---|
| 252 |         @mkdir -p build/kernel/mm | 
|---|
| 253 |         @mkdir -p build/kernel/libk | 
|---|
| 254 |         @mkdir -p build/kernel/drivers | 
|---|
| 255 |         @mkdir -p build/kernel/vfs  | 
|---|
| 256 |         @mkdir -p build/kernel/syscalls | 
|---|
| 257 |         @mkdir -p hdd | 
|---|
| 258 |  | 
|---|
| 259 | # Rule to make a recursive list of the virtual disk content. | 
|---|
| 260 | list: | 
|---|
| 261 |         mdir -/ -w -i $(DISK_IMAGE) ::/ | 
|---|
| 262 |  | 
|---|
| 263 | # Rule to make a file system check for the virtual disk. | 
|---|
| 264 | fsck: | 
|---|
| 265 |         fsck.msdos $(DISK_IMAGE) | 
|---|
| 266 |  | 
|---|
| 267 | ############################################################## | 
|---|
| 268 | # Rule to copy the files generated by the virtual prototype  | 
|---|
| 269 | # from the virtual disk 'home' directory to the current directory. | 
|---|
| 270 | extract: | 
|---|
| 271 |         mcopy -o -i $(DISK_IMAGE) ::/home . | 
|---|
| 272 |  | 
|---|
| 273 | # Rules to delete all binary files from Unix File System  | 
|---|
| 274 | # without modifying the virtual disk. | 
|---|
| 275 | clean: | 
|---|
| 276 |         rm -f *.o *.elf *.bin *.txt core | 
|---|
| 277 |         rm -f hard_config.h arch_info.xml arch_info.bin | 
|---|
| 278 |         rm -rf build | 
|---|
| 279 |  | 
|---|
| 280 | ####################################################     | 
|---|
| 281 | # Rule for building a new virtual disk from scratch. | 
|---|
| 282 | # It creates the bin / home directories. | 
|---|
| 283 | # This requires the generic Linux/MacOS 'create_dmg' script, that should be | 
|---|
| 284 | # placed in the same directory as this Makefile. | 
|---|
| 285 | build-disk: | 
|---|
| 286 |         rm -f $(DISK_IMAGE) | 
|---|
| 287 |         ./create_dmg    create $(basename $(DISK_IMAGE)) | 
|---|
| 288 |         dd                              if=$(DISK_IMAGE) of=temp.dmg count=65536 | 
|---|
| 289 |         mv                              temp.dmg $(DISK_IMAGE) | 
|---|
| 290 |         mmd                     -o -i $(DISK_IMAGE) ::/bin         || true | 
|---|
| 291 |         mmd                     -o -i $(DISK_IMAGE) ::/bin/kernel  || true | 
|---|
| 292 |         mmd                     -o -i $(DISK_IMAGE) ::/home        || true | 
|---|
| 293 |         mdir             -/ -b -i $(DISK_IMAGE) ::/ | 
|---|
| 294 |          | 
|---|
| 295 | ############################################################## | 
|---|
| 296 | # Rules to generate hardware description files (hard_config.h, | 
|---|
| 297 | # arch_info.bin and arch_info.xml), and update the virtual disk. | 
|---|
| 298 | hard_config.h: $(ARCH)/arch_info.py | 
|---|
| 299 |         tools/arch_info/genarch.py      --arch=$(ARCH)                  \ | 
|---|
| 300 |                                                                 --x_size=$(X_SIZE)              \ | 
|---|
| 301 |                                                                 --y_size=$(Y_SIZE)              \ | 
|---|
| 302 |                                                                 --nb_cores=$(NB_PROCS)  \ | 
|---|
| 303 |                                                                 --nb_ttys=$(NB_TTYS)    \ | 
|---|
| 304 |                                                                 --fbf_size=$(FBF_WIDTH) \ | 
|---|
| 305 |                                                                 --ioc_type=$(IOC_TYPE)  \ | 
|---|
| 306 |                                                                 --hard=.                                \ | 
|---|
| 307 |                                                                 --bin=.                                 \ | 
|---|
| 308 |                                                                 --xml=.                                  | 
|---|
| 309 |         mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/   || true | 
|---|
| 310 |  | 
|---|
| 311 | ################################################ | 
|---|
| 312 | # Rules to compile boot drivers used by boot.elf | 
|---|
| 313 | build/boot/boot_tty_driver.o:   tools/bootloader_tsar/boot_tty_driver.c \ | 
|---|
| 314 |                                                                 tools/bootloader_tsar/boot_tty_driver.h \ | 
|---|
| 315 |                                                                 tools/bootloader_tsar/boot_utils.h      \ | 
|---|
| 316 |                                                                 tools/bootloader_tsar/boot_config.h     \ | 
|---|
| 317 |                                                                 hal/tsar_mips32/hal_types.h             \ | 
|---|
| 318 |                                                                 hard_config.h | 
|---|
| 319 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 320 |         $(DU) -D $@ > $@.txt | 
|---|
| 321 |  | 
|---|
| 322 | build/boot/boot_bdv_driver.o:   tools/bootloader_tsar/boot_bdv_driver.c \ | 
|---|
| 323 |                                                                 tools/bootloader_tsar/boot_bdv_driver.h \ | 
|---|
| 324 |                                                                 tools/bootloader_tsar/boot_utils.h      \ | 
|---|
| 325 |                                                                 tools/bootloader_tsar/boot_config.h     \ | 
|---|
| 326 |                                                                 hal/tsar_mips32/hal_types.h             \ | 
|---|
| 327 |                                                                 hard_config.h | 
|---|
| 328 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 329 |         $(DU) -D $@ > $@.txt | 
|---|
| 330 |  | 
|---|
| 331 | build/boot/boot_hba_driver.o:   tools/bootloader_tsar/boot_hba_driver.c \ | 
|---|
| 332 |                                                                 tools/bootloader_tsar/boot_hba_driver.h \ | 
|---|
| 333 |                                                                 tools/bootloader_tsar/boot_utils.h      \ | 
|---|
| 334 |                                                                 tools/bootloader_tsar/boot_config.h     \ | 
|---|
| 335 |                                                                 hal/tsar_mips32/hal_types.h             \ | 
|---|
| 336 |                                                                 hard_config.h | 
|---|
| 337 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 338 |         $(DU) -D $@ > $@.txt | 
|---|
| 339 |  | 
|---|
| 340 | build/boot/boot_mmc_driver.o:   tools/bootloader_tsar/boot_mmc_driver.c \ | 
|---|
| 341 |                                                                 tools/bootloader_tsar/boot_mmc_driver.h \ | 
|---|
| 342 |                                                                 tools/bootloader_tsar/boot_utils.h      \ | 
|---|
| 343 |                                                                 tools/bootloader_tsar/boot_config.h     \ | 
|---|
| 344 |                                                                 hal/tsar_mips32/hal_types.h             \ | 
|---|
| 345 |                                                                 hard_config.h | 
|---|
| 346 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 347 |         $(DU) -D $@ > $@.txt | 
|---|
| 348 |  | 
|---|
| 349 | ############################## | 
|---|
| 350 | # Rule to compile boot_fat32.o | 
|---|
| 351 | build/boot/boot_fat32.o:                tools/bootloader_tsar/boot_fat32.c      \ | 
|---|
| 352 |                                                                 tools/bootloader_tsar/boot_fat32.h      \ | 
|---|
| 353 |                                                                 tools/bootloader_tsar/boot_utils.h      \ | 
|---|
| 354 |                                                                 tools/bootloader_tsar/boot_config.h     \ | 
|---|
| 355 |                                                                 hal/tsar_mips32/hal_types.h             \ | 
|---|
| 356 |                                                                 hard_config.h                    | 
|---|
| 357 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 358 |         $(DU) -D $@ > $@.txt | 
|---|
| 359 |  | 
|---|
| 360 | ############################## | 
|---|
| 361 | # Rule to compile boot_utils.o  | 
|---|
| 362 | build/boot/boot_utils.o:                tools/bootloader_tsar/boot_utils.c       \ | 
|---|
| 363 |                                                                 tools/bootloader_tsar/boot_utils.h       \ | 
|---|
| 364 |                                                                 tools/bootloader_tsar/boot_tty_driver.h  \ | 
|---|
| 365 |                                                                 hal/tsar_mips32/hal_types.h              \ | 
|---|
| 366 |                                                                 hard_config.h | 
|---|
| 367 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 368 |         $(DU) -D $@ > $@.txt | 
|---|
| 369 |  | 
|---|
| 370 | ######################## | 
|---|
| 371 | # Rule to compile boot.o | 
|---|
| 372 | build/boot/boot.o:                              tools/bootloader_tsar/boot.c             \ | 
|---|
| 373 |                                                                 tools/bootloader_tsar/boot_utils.h       \ | 
|---|
| 374 |                                                                 tools/bootloader_tsar/boot_fat32.h       \ | 
|---|
| 375 |                                                                 tools/bootloader_tsar/boot_tty_driver.h  \ | 
|---|
| 376 |                                                                 tools/bootloader_tsar/boot_hba_driver.h  \ | 
|---|
| 377 |                                                                 tools/bootloader_tsar/boot_bdv_driver.h  \ | 
|---|
| 378 |                                                                 tools/bootloader_tsar/boot_mmc_driver.h  \ | 
|---|
| 379 |                                                                 tools/bootloader_tsar/boot_config.h      \ | 
|---|
| 380 |                                                                 hal/tsar_mips32/hal_types.h              \ | 
|---|
| 381 |                                                                 hard_config.h                            | 
|---|
| 382 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< | 
|---|
| 383 |         $(DU) -D $@ > $@.txt | 
|---|
| 384 |  | 
|---|
| 385 | ############################## | 
|---|
| 386 | # Rule to compile boot_entry.o | 
|---|
| 387 | build/boot/boot_entry.o:                tools/bootloader_tsar/boot_entry.S   \ | 
|---|
| 388 |                                                                 tools/bootloader_tsar/boot_config.h  \ | 
|---|
| 389 |                                                                 hard_config.h | 
|---|
| 390 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 391 |         $(DU) -D $@ > $@.txt | 
|---|
| 392 |  | 
|---|
| 393 | ##################################################################### | 
|---|
| 394 | # Rule to generate boot.elf and place it in sector #2 of virtual disk | 
|---|
| 395 | build/boot/boot.elf:                            $(BOOT_OBJS) \ | 
|---|
| 396 |                                                                         tools/bootloader_tsar/boot.ld                                    | 
|---|
| 397 |         $(LD) -o $@ -T tools/bootloader_tsar/boot.ld $(BOOT_OBJS)  | 
|---|
| 398 |         $(DU) -D $@ > $@.txt | 
|---|
| 399 |         dd if=build/boot/boot.elf of=$(DISK_IMAGE) seek=2 conv=notrunc | 
|---|
| 400 |  | 
|---|
| 401 |  | 
|---|
| 402 | ############################## | 
|---|
| 403 | # rules to compile the drivers  | 
|---|
| 404 | build/kernel/drivers/%.o:       kernel/drivers/soclib/%.c   \ | 
|---|
| 405 |                                 kernel/drivers/soclib/%.h   \ | 
|---|
| 406 |                                 kernel_config.h             \ | 
|---|
| 407 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 408 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS)  -c -o $@ $< | 
|---|
| 409 |         $(DU) -D $@ > $@.txt | 
|---|
| 410 |  | 
|---|
| 411 | ####################################### | 
|---|
| 412 | # Rules to generate kernel/kern objects | 
|---|
| 413 | build/kernel/kern/%.o:              kernel/kern/%.c             \ | 
|---|
| 414 |                                 kernel/kern/%.h             \ | 
|---|
| 415 |                                 kernel_config.h             \ | 
|---|
| 416 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 417 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 418 |         $(DU) -D $@ > $@.txt | 
|---|
| 419 |  | 
|---|
| 420 | ###################################### | 
|---|
| 421 | # Rules to generate kernel/hal objects | 
|---|
| 422 | build/kernel/hal/%.o:           hal/tsar_mips32/%.c         \ | 
|---|
| 423 |                                 hal/generic/%.h             \ | 
|---|
| 424 |                                 kernel_config.h             \ | 
|---|
| 425 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 426 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 427 |         $(DU) -D $@ > $@.txt | 
|---|
| 428 |  | 
|---|
| 429 | build/kernel/hal/hal_kentry.o:  hal/tsar_mips32/hal_kentry.S \ | 
|---|
| 430 |                                 hal/tsar_mips32/hal_kentry.h \ | 
|---|
| 431 |                                 kernel_config.h              \ | 
|---|
| 432 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 433 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 434 |         $(DU) -D $@ > $@.txt | 
|---|
| 435 |  | 
|---|
| 436 | ###################################### | 
|---|
| 437 | # Rules to generate kernel/dev objects | 
|---|
| 438 | build/kernel/devices/%.o:       kernel/devices/%.c          \ | 
|---|
| 439 |                                 kernel/devices/%.h          \ | 
|---|
| 440 |                                 kernel_config.h             \ | 
|---|
| 441 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 442 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 443 |         $(DU) -D $@ > $@.txt | 
|---|
| 444 |  | 
|---|
| 445 | ##################################### | 
|---|
| 446 | # Rules to generate kernel/mm objects | 
|---|
| 447 | build/kernel/mm/%.o:            kernel/mm/%.c               \ | 
|---|
| 448 |                                 kernel/mm/%.h               \ | 
|---|
| 449 |                                 kernel_config.h             \ | 
|---|
| 450 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 451 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 452 |         $(DU) -D $@ > $@.txt | 
|---|
| 453 |  | 
|---|
| 454 | ####################################### | 
|---|
| 455 | # Rules to generate kernel/libk objects | 
|---|
| 456 | build/kernel/libk/%.o:          kernel/libk/%.c             \ | 
|---|
| 457 |                                 kernel/libk/%.h             \ | 
|---|
| 458 |                                 kernel_config.h             \ | 
|---|
| 459 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 460 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 461 |         $(DU) -D $@ > $@.txt | 
|---|
| 462 |  | 
|---|
| 463 | ########################################### | 
|---|
| 464 | # Rules to generate kernel/syscalls objects | 
|---|
| 465 | build/kernel/syscalls/%.o:      kernel/syscalls/%.c         \ | 
|---|
| 466 |                                 kernel/syscalls/syscalls.h  \ | 
|---|
| 467 |                                 kernel_config.h             \ | 
|---|
| 468 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 469 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 470 |         $(DU) -D $@ > $@.txt | 
|---|
| 471 |  | 
|---|
| 472 | ####################################### | 
|---|
| 473 | # Rules to generate kernel/vfs objects | 
|---|
| 474 | build/kernel/vfs/%.o:           kernel/vfs/%.c              \ | 
|---|
| 475 |                                 kernel/vfs/%.h              \ | 
|---|
| 476 |                                 kernel_config.h             \ | 
|---|
| 477 |                                 hal/tsar_mips32/hal_types.h | 
|---|
| 478 |         $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
| 479 |         $(DU) -D $@ > $@.txt | 
|---|
| 480 |  | 
|---|
| 481 | ########################################################### | 
|---|
| 482 | # Rule to generate kernel.elf and place it on virtual disk | 
|---|
| 483 | build/kernel/kernel.elf:            $(KERN_OBJS)                \ | 
|---|
| 484 |                                 $(HAL_OBJS)                 \ | 
|---|
| 485 |                                 $(DEV_OBJS)                 \ | 
|---|
| 486 |                                 $(MM_OBJS)                  \ | 
|---|
| 487 |                                 $(LIBK_OBJS)                \ | 
|---|
| 488 |                                 $(DRIVERS_OBJS)             \ | 
|---|
| 489 |                                 $(VFS_OBJS)                 \ | 
|---|
| 490 |                                 $(SYS_OBJS_0)               \ | 
|---|
| 491 |                                 $(SYS_OBJS_1)               \ | 
|---|
| 492 |                                 $(SYS_OBJS_2)               \ | 
|---|
| 493 |                                 $(SYS_OBJS_3)               \ | 
|---|
| 494 |                                                                 kernel/kernel.ld             | 
|---|
| 495 |         $(LD) -o $@ -T kernel/kernel.ld                         \ | 
|---|
| 496 |           $(KERN_OBJS) $(HAL_OBJS) $(DEV_OBJS) $(MM_OBJS)   \ | 
|---|
| 497 |           $(LIBK_OBJS) $(DRIVERS_OBJS) $(VFS_OBJS)          \ | 
|---|
| 498 |           $(SYS_OBJS_0) $(SYS_OBJS_1) $(SYS_OBJS_2)         \ | 
|---|
| 499 |           $(SYS_OBJS_3) | 
|---|
| 500 |            | 
|---|
| 501 |  | 
|---|
| 502 | #   $(SYS_OBJS_4) $(SYS_OBJS_5) | 
|---|
| 503 |            | 
|---|
| 504 |         $(DU) -D $@ > $@.txt | 
|---|
| 505 |         mcopy -o -i $(DISK_IMAGE) build/kernel/kernel.elf ::/bin/kernel | 
|---|
| 506 |  | 
|---|