| 1 | ############################################################################# |
|---|
| 2 | # ALMOS-MKH 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 |
|---|
| 13 | CC = mipsel-unknown-elf-gcc |
|---|
| 14 | AS = mipsel-unknown-elf-as |
|---|
| 15 | LD = mipsel-unknown-elf-ld |
|---|
| 16 | DU = mipsel-unknown-elf-objdump |
|---|
| 17 | AR = mipsel-unknown-elf-ar |
|---|
| 18 | |
|---|
| 19 | LIBGCC = -L$(shell $(CC) -print-libgcc-file-name | sed 's/libgcc.a//') |
|---|
| 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 ?= 3 |
|---|
| 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/core \ |
|---|
| 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_pic.o \ |
|---|
| 71 | build/kernel/drivers/soclib_nic.o \ |
|---|
| 72 | build/kernel/drivers/soclib_dma.o \ |
|---|
| 73 | build/kernel/drivers/soclib_iob.o |
|---|
| 74 | |
|---|
| 75 | # Objects to be linked for kernel.elf generation |
|---|
| 76 | KERN_OBJS = build/kernel/kern/kernel_init.o \ |
|---|
| 77 | build/kernel/kern/printk.o \ |
|---|
| 78 | build/kernel/kern/thread.o \ |
|---|
| 79 | build/kernel/kern/process.o \ |
|---|
| 80 | build/kernel/kern/chdev.o \ |
|---|
| 81 | build/kernel/kern/cluster.o \ |
|---|
| 82 | build/kernel/kern/scheduler.o \ |
|---|
| 83 | build/kernel/kern/core.o \ |
|---|
| 84 | build/kernel/kern/dqdt.o \ |
|---|
| 85 | build/kernel/kern/do_syscall.o \ |
|---|
| 86 | build/kernel/kern/do_interrupt.o \ |
|---|
| 87 | build/kernel/kern/do_exception.o \ |
|---|
| 88 | build/kernel/kern/rpc.o \ |
|---|
| 89 | build/kernel/kern/signal.o |
|---|
| 90 | |
|---|
| 91 | HAL_OBJS = build/kernel/hal/hal_special.o \ |
|---|
| 92 | build/kernel/hal/hal_context.o \ |
|---|
| 93 | build/kernel/hal/hal_atomic.o \ |
|---|
| 94 | build/kernel/hal/hal_remote.o \ |
|---|
| 95 | build/kernel/hal/hal_uspace.o \ |
|---|
| 96 | build/kernel/hal/hal_irqmask.o \ |
|---|
| 97 | build/kernel/hal/hal_gpt.o \ |
|---|
| 98 | build/kernel/hal/hal_ppm.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_drivers.o \ |
|---|
| 103 | build/kernel/hal/hal_kentry.o |
|---|
| 104 | |
|---|
| 105 | DEV_OBJS = build/kernel/devices/dev_txt.o \ |
|---|
| 106 | build/kernel/devices/dev_ioc.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_timeofday.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 | VFS_OBJS = build/kernel/vfs/vfs.o \ |
|---|
| 187 | build/kernel/vfs/fatfs.o \ |
|---|
| 188 | build/kernel/vfs/devfs.o \ |
|---|
| 189 | build/kernel/vfs/ramfs.o |
|---|
| 190 | |
|---|
| 191 | # List of directories to be searched for included files |
|---|
| 192 | # when compiling for kernel.elf generation |
|---|
| 193 | KERNEL_INCLUDE = -Ikernel \ |
|---|
| 194 | -Ikernel/kern \ |
|---|
| 195 | -Ikernel/devices \ |
|---|
| 196 | -Ikernel/syscalls \ |
|---|
| 197 | -Ihal/tsar_mips32/drivers \ |
|---|
| 198 | -Ikernel/syscalls \ |
|---|
| 199 | -Ikernel/libk \ |
|---|
| 200 | -Ikernel/mm \ |
|---|
| 201 | -Ikernel/vfs \ |
|---|
| 202 | -Ikernel/fatfs \ |
|---|
| 203 | -Ikernel/sysfs \ |
|---|
| 204 | -Ikernel/ramfs \ |
|---|
| 205 | -Ikernel/devfs \ |
|---|
| 206 | -Itools/arch_info \ |
|---|
| 207 | -Ihal/generic \ |
|---|
| 208 | -Ihal/tsar_mips32/core \ |
|---|
| 209 | -I. |
|---|
| 210 | |
|---|
| 211 | # Macros to be processed by the C preprocessor. |
|---|
| 212 | MACROS = -DARCHINFO_PATHNAME="\"arch_info.bin\"" \ |
|---|
| 213 | -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\"" |
|---|
| 214 | |
|---|
| 215 | # Virtual disk path |
|---|
| 216 | DISK_IMAGE := hdd/virt_hdd.dmg |
|---|
| 217 | |
|---|
| 218 | # The Mtools used to build the FAT32 disk image perfom a few sanity checks, to |
|---|
| 219 | # make sure that the disk is indeed an MS-DOS disk. However, the size of the |
|---|
| 220 | # disk image used by ALMOS-VM is not MS-DOS compliant. |
|---|
| 221 | # Setting this variable prevents these checks. |
|---|
| 222 | MTOOLS_SKIP_CHECK := 1 |
|---|
| 223 | |
|---|
| 224 | # Rule to generate compile boot.elf, kernel.elf, init.elf and update virtual disk. |
|---|
| 225 | compile: dirs \ |
|---|
| 226 | build_disk \ |
|---|
| 227 | hard_config.h \ |
|---|
| 228 | build/boot/boot.elf \ |
|---|
| 229 | build/kernel/kernel.elf \ |
|---|
| 230 | build/user/init/init.elf \ |
|---|
| 231 | list |
|---|
| 232 | |
|---|
| 233 | # Rule to create the build directories. |
|---|
| 234 | dirs: |
|---|
| 235 | @mkdir -p build/boot |
|---|
| 236 | @mkdir -p build/kernel |
|---|
| 237 | @mkdir -p build/kernel/kern |
|---|
| 238 | @mkdir -p build/kernel/hal |
|---|
| 239 | @mkdir -p build/kernel/devices |
|---|
| 240 | @mkdir -p build/kernel/mm |
|---|
| 241 | @mkdir -p build/kernel/libk |
|---|
| 242 | @mkdir -p build/kernel/drivers |
|---|
| 243 | @mkdir -p build/kernel/vfs |
|---|
| 244 | @mkdir -p build/kernel/syscalls |
|---|
| 245 | @mkdir -p build/user |
|---|
| 246 | @mkdir -p build/user/init |
|---|
| 247 | @mkdir -p build/user/ksh |
|---|
| 248 | @mkdir -p hdd |
|---|
| 249 | |
|---|
| 250 | # Rule to make a recursive list of the virtual disk content. |
|---|
| 251 | list: |
|---|
| 252 | mdir -/ -b -i $(DISK_IMAGE) ::/ |
|---|
| 253 | |
|---|
| 254 | ############################################################## |
|---|
| 255 | # Rule to copy the files generated by the virtual prototype |
|---|
| 256 | # from the virtual disk 'home' directory to the current directory. |
|---|
| 257 | extract: |
|---|
| 258 | mcopy -o -i $(DISK_IMAGE) ::/home . |
|---|
| 259 | |
|---|
| 260 | # Rules to delete all binary files from Unix File System |
|---|
| 261 | # without modifying the virtual disk. |
|---|
| 262 | clean: |
|---|
| 263 | rm -f *.o *.elf *.bin *.txt core |
|---|
| 264 | rm -f hard_config.h arch_info.xml arch_info.bin |
|---|
| 265 | rm -rf build |
|---|
| 266 | cd user/init && $(MAKE) clean && cd ../.. |
|---|
| 267 | |
|---|
| 268 | #################################################### |
|---|
| 269 | # Rule for building a new virtual disk from scratch. |
|---|
| 270 | # It creates the bin, bin/kernel, bin/init, and home directories. |
|---|
| 271 | # This requires the generic Linux/MacOS 'create_dmg' script, that should be |
|---|
| 272 | # placed in the same directory as this Makefile. |
|---|
| 273 | build_disk: |
|---|
| 274 | rm -f $(DISK_IMAGE) |
|---|
| 275 | ./create_dmg create $(basename $(DISK_IMAGE)) |
|---|
| 276 | dd if=$(DISK_IMAGE) of=temp.dmg count=65536 |
|---|
| 277 | mv temp.dmg $(DISK_IMAGE) |
|---|
| 278 | mmd -o -i $(DISK_IMAGE) ::/bin || true |
|---|
| 279 | mmd -o -i $(DISK_IMAGE) ::/bin/kernel || true |
|---|
| 280 | mmd -o -i $(DISK_IMAGE) ::/bin/init || true |
|---|
| 281 | mmd -o -i $(DISK_IMAGE) ::/home || true |
|---|
| 282 | mdir -/ -b -i $(DISK_IMAGE) ::/ |
|---|
| 283 | |
|---|
| 284 | ############################################################## |
|---|
| 285 | # Rules to generate hardware description files (hard_config.h, |
|---|
| 286 | # arch_info.bin and arch_info.xml), and update the virtual disk. |
|---|
| 287 | hard_config.h: $(ARCH)/arch_info.py |
|---|
| 288 | tools/arch_info/genarch.py --arch=$(ARCH) \ |
|---|
| 289 | --x_size=$(X_SIZE) \ |
|---|
| 290 | --y_size=$(Y_SIZE) \ |
|---|
| 291 | --nb_cores=$(NB_PROCS) \ |
|---|
| 292 | --nb_ttys=$(NB_TTYS) \ |
|---|
| 293 | --fbf_size=$(FBF_WIDTH) \ |
|---|
| 294 | --ioc_type=$(IOC_TYPE) \ |
|---|
| 295 | --hard=. \ |
|---|
| 296 | --bin=. \ |
|---|
| 297 | --xml=. |
|---|
| 298 | mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/ || true |
|---|
| 299 | mdir -/ -b -i $(DISK_IMAGE) ::/ |
|---|
| 300 | |
|---|
| 301 | ################################################ |
|---|
| 302 | # Rules to compile boot drivers used by boot.elf |
|---|
| 303 | build/boot/boot_tty_driver.o: tools/bootloader_tsar/boot_tty_driver.c \ |
|---|
| 304 | tools/bootloader_tsar/boot_tty_driver.h \ |
|---|
| 305 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 306 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 307 | hal/tsar_mips32/core/hal_types.h \ |
|---|
| 308 | hard_config.h |
|---|
| 309 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 310 | $(DU) -D $@ > $@.txt |
|---|
| 311 | |
|---|
| 312 | build/boot/boot_bdv_driver.o: tools/bootloader_tsar/boot_bdv_driver.c \ |
|---|
| 313 | tools/bootloader_tsar/boot_bdv_driver.h \ |
|---|
| 314 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 315 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 316 | hal/tsar_mips32/core/hal_types.h \ |
|---|
| 317 | hard_config.h |
|---|
| 318 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 319 | $(DU) -D $@ > $@.txt |
|---|
| 320 | |
|---|
| 321 | build/boot/boot_hba_driver.o: tools/bootloader_tsar/boot_hba_driver.c \ |
|---|
| 322 | tools/bootloader_tsar/boot_hba_driver.h \ |
|---|
| 323 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 324 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 325 | hal/tsar_mips32/core/hal_types.h \ |
|---|
| 326 | hard_config.h |
|---|
| 327 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 328 | $(DU) -D $@ > $@.txt |
|---|
| 329 | |
|---|
| 330 | build/boot/boot_mmc_driver.o: tools/bootloader_tsar/boot_mmc_driver.c \ |
|---|
| 331 | tools/bootloader_tsar/boot_mmc_driver.h \ |
|---|
| 332 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 333 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 334 | hal/tsar_mips32/core/hal_types.h \ |
|---|
| 335 | hard_config.h |
|---|
| 336 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 337 | $(DU) -D $@ > $@.txt |
|---|
| 338 | |
|---|
| 339 | ############################## |
|---|
| 340 | # Rule to compile boot_fat32.o |
|---|
| 341 | build/boot/boot_fat32.o: tools/bootloader_tsar/boot_fat32.c \ |
|---|
| 342 | tools/bootloader_tsar/boot_fat32.h \ |
|---|
| 343 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 344 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 345 | hal/tsar_mips32/core/hal_types.h \ |
|---|
| 346 | hard_config.h |
|---|
| 347 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 348 | $(DU) -D $@ > $@.txt |
|---|
| 349 | |
|---|
| 350 | ############################## |
|---|
| 351 | # Rule to compile boot_utils.o |
|---|
| 352 | build/boot/boot_utils.o: tools/bootloader_tsar/boot_utils.c \ |
|---|
| 353 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 354 | tools/bootloader_tsar/boot_tty_driver.h \ |
|---|
| 355 | hal/tsar_mips32/core/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.o |
|---|
| 362 | build/boot/boot.o: tools/bootloader_tsar/boot.c \ |
|---|
| 363 | tools/bootloader_tsar/boot_utils.h \ |
|---|
| 364 | tools/bootloader_tsar/boot_fat32.h \ |
|---|
| 365 | tools/bootloader_tsar/boot_tty_driver.h \ |
|---|
| 366 | tools/bootloader_tsar/boot_hba_driver.h \ |
|---|
| 367 | tools/bootloader_tsar/boot_bdv_driver.h \ |
|---|
| 368 | tools/bootloader_tsar/boot_mmc_driver.h \ |
|---|
| 369 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 370 | hal/tsar_mips32/core/hal_types.h \ |
|---|
| 371 | hard_config.h |
|---|
| 372 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< |
|---|
| 373 | $(DU) -D $@ > $@.txt |
|---|
| 374 | |
|---|
| 375 | ############################## |
|---|
| 376 | # Rule to compile boot_entry.o |
|---|
| 377 | build/boot/boot_entry.o: tools/bootloader_tsar/boot_entry.S \ |
|---|
| 378 | tools/bootloader_tsar/boot_config.h \ |
|---|
| 379 | hard_config.h |
|---|
| 380 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 381 | $(DU) -D $@ > $@.txt |
|---|
| 382 | |
|---|
| 383 | ##################################################################### |
|---|
| 384 | # Rule to generate boot.elf and place it in sector #2 of virtual disk |
|---|
| 385 | build/boot/boot.elf: $(BOOT_OBJS) \ |
|---|
| 386 | tools/bootloader_tsar/boot.ld |
|---|
| 387 | $(LD) -o $@ -T tools/bootloader_tsar/boot.ld $(BOOT_OBJS) |
|---|
| 388 | $(DU) -D $@ > $@.txt |
|---|
| 389 | dd if=build/boot/boot.elf of=$(DISK_IMAGE) seek=2 conv=notrunc |
|---|
| 390 | |
|---|
| 391 | |
|---|
| 392 | ############################## |
|---|
| 393 | # rules to compile the drivers |
|---|
| 394 | build/kernel/drivers/%.o: hal/tsar_mips32/drivers/%.c \ |
|---|
| 395 | hal/tsar_mips32/drivers/%.h \ |
|---|
| 396 | kernel_config.h \ |
|---|
| 397 | hal/tsar_mips32/core/hal_types.h |
|---|
| 398 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 399 | $(DU) -D $@ > $@.txt |
|---|
| 400 | |
|---|
| 401 | ####################################### |
|---|
| 402 | # Rules to generate kernel/kern objects |
|---|
| 403 | build/kernel/kern/%.o: kernel/kern/%.c \ |
|---|
| 404 | kernel/kern/%.h \ |
|---|
| 405 | kernel_config.h \ |
|---|
| 406 | hal/tsar_mips32/core/hal_types.h |
|---|
| 407 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 408 | $(DU) -D $@ > $@.txt |
|---|
| 409 | |
|---|
| 410 | ###################################### |
|---|
| 411 | # Rules to generate kernel/hal objects |
|---|
| 412 | build/kernel/hal/%.o: hal/tsar_mips32/core/%.c \ |
|---|
| 413 | hal/generic/%.h \ |
|---|
| 414 | kernel_config.h \ |
|---|
| 415 | hal/tsar_mips32/core/hal_types.h |
|---|
| 416 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 417 | $(DU) -D $@ > $@.txt |
|---|
| 418 | |
|---|
| 419 | build/kernel/hal/hal_kentry.o: hal/tsar_mips32/core/hal_kentry.S \ |
|---|
| 420 | hal/tsar_mips32/core/hal_kentry.h \ |
|---|
| 421 | kernel_config.h \ |
|---|
| 422 | hal/tsar_mips32/core/hal_types.h |
|---|
| 423 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 424 | $(DU) -D $@ > $@.txt |
|---|
| 425 | |
|---|
| 426 | ###################################### |
|---|
| 427 | # Rules to generate kernel/dev objects |
|---|
| 428 | build/kernel/devices/%.o: kernel/devices/%.c \ |
|---|
| 429 | kernel/devices/%.h \ |
|---|
| 430 | kernel_config.h \ |
|---|
| 431 | hal/tsar_mips32/core/hal_types.h |
|---|
| 432 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 433 | $(DU) -D $@ > $@.txt |
|---|
| 434 | |
|---|
| 435 | ##################################### |
|---|
| 436 | # Rules to generate kernel/mm objects |
|---|
| 437 | build/kernel/mm/%.o: kernel/mm/%.c \ |
|---|
| 438 | kernel/mm/%.h \ |
|---|
| 439 | kernel_config.h \ |
|---|
| 440 | hal/tsar_mips32/core/hal_types.h |
|---|
| 441 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 442 | $(DU) -D $@ > $@.txt |
|---|
| 443 | |
|---|
| 444 | ####################################### |
|---|
| 445 | # Rules to generate kernel/libk objects |
|---|
| 446 | build/kernel/libk/%.o: kernel/libk/%.c \ |
|---|
| 447 | kernel/libk/%.h \ |
|---|
| 448 | kernel_config.h \ |
|---|
| 449 | hal/tsar_mips32/core/hal_types.h |
|---|
| 450 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 451 | $(DU) -D $@ > $@.txt |
|---|
| 452 | |
|---|
| 453 | ########################################### |
|---|
| 454 | # Rules to generate kernel/syscalls objects |
|---|
| 455 | build/kernel/syscalls/%.o: kernel/syscalls/%.c \ |
|---|
| 456 | kernel/syscalls/syscalls.h \ |
|---|
| 457 | kernel_config.h \ |
|---|
| 458 | hal/tsar_mips32/core/hal_types.h |
|---|
| 459 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 460 | $(DU) -D $@ > $@.txt |
|---|
| 461 | |
|---|
| 462 | ####################################### |
|---|
| 463 | # Rules to generate kernel/vfs objects |
|---|
| 464 | build/kernel/vfs/%.o: kernel/vfs/%.c \ |
|---|
| 465 | kernel/vfs/%.h \ |
|---|
| 466 | kernel_config.h \ |
|---|
| 467 | hal/tsar_mips32/core/hal_types.h |
|---|
| 468 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
|---|
| 469 | $(DU) -D $@ > $@.txt |
|---|
| 470 | |
|---|
| 471 | ########################################################### |
|---|
| 472 | # Rule to generate kernel.elf and place it on virtual disk |
|---|
| 473 | build/kernel/kernel.elf: $(KERN_OBJS) \ |
|---|
| 474 | $(HAL_OBJS) \ |
|---|
| 475 | $(DEV_OBJS) \ |
|---|
| 476 | $(MM_OBJS) \ |
|---|
| 477 | $(LIBK_OBJS) \ |
|---|
| 478 | $(DRIVERS_OBJS) \ |
|---|
| 479 | $(VFS_OBJS) \ |
|---|
| 480 | $(SYS_OBJS_0) \ |
|---|
| 481 | $(SYS_OBJS_1) \ |
|---|
| 482 | $(SYS_OBJS_2) \ |
|---|
| 483 | $(SYS_OBJS_3) \ |
|---|
| 484 | hal/tsar_mips32/kernel.ld |
|---|
| 485 | $(LD) -o $@ -T hal/tsar_mips32/kernel.ld $(LIBGCC) \ |
|---|
| 486 | $(KERN_OBJS) $(HAL_OBJS) $(DEV_OBJS) $(MM_OBJS) \ |
|---|
| 487 | $(LIBK_OBJS) $(DRIVERS_OBJS) $(VFS_OBJS) \ |
|---|
| 488 | $(SYS_OBJS_0) $(SYS_OBJS_1) $(SYS_OBJS_2) \ |
|---|
| 489 | $(SYS_OBJS_3) -lgcc |
|---|
| 490 | |
|---|
| 491 | $(DU) -D $@ > $@.txt |
|---|
| 492 | mcopy -o -i $(DISK_IMAGE) build/kernel/kernel.elf ::/bin/kernel |
|---|
| 493 | |
|---|
| 494 | ############################################################ |
|---|
| 495 | # Rule to generate the init.elf and place it on virtual disk |
|---|
| 496 | build/user/init/init.elf : user/init/init.c |
|---|
| 497 | $(MAKE) -C user/init |
|---|
| 498 | mcopy -o -i $(DISK_IMAGE) user/init/init.elf ::/bin/init |
|---|
| 499 | |
|---|
| 500 | |
|---|