[1] | 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 \ |
---|
[12] | 73 | build/kernel/drivers/soclib_dma.o \ |
---|
[1] | 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 \ |
---|
[12] | 81 | build/kernel/kern/chdev.o \ |
---|
[1] | 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/remote_sem.o \ |
---|
[16] | 87 | build/kernel/kern/do_syscall.o \ |
---|
| 88 | build/kernel/kern/do_interrupt.o \ |
---|
| 89 | build/kernel/kern/do_exception.o \ |
---|
[1] | 90 | build/kernel/kern/rpc.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 \ |
---|
[16] | 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 |
---|
[1] | 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 \ |
---|
[12] | 110 | build/kernel/devices/dev_dma.o \ |
---|
| 111 | build/kernel/devices/dev_fbf.o \ |
---|
| 112 | build/kernel/devices/dev_iob.o |
---|
[1] | 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 \ |
---|
[16] | 130 | build/kernel/libk/barrier.o \ |
---|
[1] | 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/memcpy.o \ |
---|
| 136 | build/kernel/libk/xhtab.o |
---|
| 137 | |
---|
[16] | 138 | SYS_OBJS_0 = build/kernel/syscalls/sys_thread_exit.o \ |
---|
| 139 | build/kernel/syscalls/sys_thread_mmap.o \ |
---|
| 140 | build/kernel/syscalls/sys_thread_create.o \ |
---|
| 141 | build/kernel/syscalls/sys_thread_join.o \ |
---|
| 142 | build/kernel/syscalls/sys_thread_detach.o \ |
---|
| 143 | build/kernel/syscalls/sys_thread_yield.o \ |
---|
| 144 | build/kernel/syscalls/sys_sem.o \ |
---|
| 145 | build/kernel/syscalls/sys_cond_var.o \ |
---|
| 146 | build/kernel/syscalls/sys_barrier.o \ |
---|
| 147 | build/kernel/syscalls/sys_rwlock.o |
---|
[1] | 148 | |
---|
[16] | 149 | SYS_OBJS_1 = build/kernel/syscalls/sys_thread_sleep.o \ |
---|
| 150 | build/kernel/syscalls/sys_thread_wakup.o \ |
---|
| 151 | build/kernel/syscalls/sys_open.o \ |
---|
| 152 | build/kernel/syscalls/sys_creat.o \ |
---|
| 153 | build/kernel/syscalls/sys_read.o \ |
---|
| 154 | build/kernel/syscalls/sys_write.o \ |
---|
| 155 | build/kernel/syscalls/sys_lseek.o \ |
---|
| 156 | build/kernel/syscalls/sys_close.o \ |
---|
| 157 | build/kernel/syscalls/sys_unlink.o \ |
---|
| 158 | build/kernel/syscalls/sys_pipe.o |
---|
| 159 | |
---|
| 160 | SYS_OBJS_2 = build/kernel/syscalls/sys_chdir.o \ |
---|
| 161 | build/kernel/syscalls/sys_mkdir.o \ |
---|
| 162 | build/kernel/syscalls/sys_mkfifo.o \ |
---|
| 163 | build/kernel/syscalls/sys_opendir.o \ |
---|
| 164 | build/kernel/syscalls/sys_readdir.o \ |
---|
| 165 | build/kernel/syscalls/sys_closedir.o \ |
---|
| 166 | build/kernel/syscalls/sys_getcwd.o \ |
---|
| 167 | build/kernel/syscalls/sys_clock.o \ |
---|
| 168 | build/kernel/syscalls/sys_alarm.o \ |
---|
| 169 | build/kernel/syscalls/sys_dma_memcpy.o |
---|
| 170 | |
---|
| 171 | SYS_OBJS_3 = build/kernel/syscalls/sys_utls.o \ |
---|
| 172 | build/kernel/syscalls/sys_notAvailable.o \ |
---|
| 173 | build/kernel/syscalls/sys_signal.o \ |
---|
| 174 | build/kernel/syscalls/sys_sigreturn_setup.o \ |
---|
| 175 | build/kernel/syscalls/sys_sigkill.o \ |
---|
| 176 | build/kernel/syscalls/sys_getpid.o \ |
---|
| 177 | build/kernel/syscalls/sys_fork.o \ |
---|
| 178 | build/kernel/syscalls/sys_exec.o \ |
---|
| 179 | build/kernel/syscalls/sys_thread_getattr.o \ |
---|
| 180 | build/kernel/syscalls/sys_ps.o |
---|
| 181 | |
---|
| 182 | SYS_OBJS_4 = build/kernel/syscalls/sys_madvise.o \ |
---|
| 183 | build/kernel/syscalls/sys_mcntl.o \ |
---|
| 184 | build/kernel/syscalls/sys_stat.o \ |
---|
| 185 | build/kernel/syscalls/sys_thread_migrate.o \ |
---|
| 186 | build/kernel/syscalls/sys_sbrk.o \ |
---|
| 187 | build/kernel/syscalls/sys_rmdir.o \ |
---|
| 188 | build/kernel/syscalls/sys_ftime.o \ |
---|
| 189 | build/kernel/syscalls/sys_chmod.o \ |
---|
| 190 | build/kernel/syscalls/sys_fsync.o \ |
---|
| 191 | build/kernel/syscalls/sys_gettimeofday.o |
---|
| 192 | |
---|
| 193 | SYS_OBJS_5 = build/kernel/syscalls/sys_times.o |
---|
| 194 | |
---|
| 195 | |
---|
[1] | 196 | VFS_OBJS = build/kernel/vfs/vfs.o \ |
---|
| 197 | build/kernel/vfs/fatfs.o \ |
---|
| 198 | build/kernel/vfs/ramfs.o |
---|
| 199 | |
---|
| 200 | # List of directories to be searched for included files |
---|
| 201 | # when compiling for kernel.elf generation |
---|
| 202 | KERNEL_INCLUDE = -Ikernel \ |
---|
| 203 | -Ikernel/kern \ |
---|
| 204 | -Ikernel/devices \ |
---|
[16] | 205 | -Ikernel/syscalls \ |
---|
[1] | 206 | -Ikernel/drivers/soclib \ |
---|
| 207 | -Ikernel/syscalls \ |
---|
| 208 | -Ikernel/libk \ |
---|
| 209 | -Ikernel/mm \ |
---|
| 210 | -Ikernel/vfs \ |
---|
| 211 | -Ikernel/fs/fatfs \ |
---|
| 212 | -Ikernel/fs/sysfs \ |
---|
| 213 | -Ikernel/fs/ramfs \ |
---|
| 214 | -Ikernel/fs/devfs \ |
---|
| 215 | -Itools/arch_info \ |
---|
[16] | 216 | -Ihal/generic \ |
---|
[1] | 217 | -Ihal/tsar_mips32 \ |
---|
| 218 | -I. |
---|
| 219 | |
---|
| 220 | # Macros to be processed by the C preprocessor. |
---|
| 221 | MACROS = -DARCHINFO_PATHNAME="\"arch_info.bin\"" \ |
---|
| 222 | -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\"" |
---|
| 223 | |
---|
| 224 | # Virtual disk path |
---|
| 225 | DISK_IMAGE := hdd/virt_hdd.dmg |
---|
| 226 | |
---|
| 227 | # The Mtools used to build the FAT32 disk image perfom a few sanity checks, to |
---|
| 228 | # make sure that the disk is indeed an MS-DOS disk. However, the size of the |
---|
| 229 | # disk image used by ALMOS-VM is not MS-DOS compliant. |
---|
| 230 | # Setting this variable prevents these checks. |
---|
| 231 | MTOOLS_SKIP_CHECK := 1 |
---|
| 232 | |
---|
| 233 | # Rule to compile boot.elf, kernel.elf, and update virtual disk. |
---|
| 234 | compile: dirs \ |
---|
| 235 | hard_config.h \ |
---|
| 236 | build/boot/boot.elf \ |
---|
| 237 | build/kernel/kernel.elf \ |
---|
| 238 | list |
---|
| 239 | |
---|
| 240 | # Rule to create the build directories. |
---|
| 241 | dirs: |
---|
| 242 | @mkdir -p build/boot |
---|
| 243 | @mkdir -p build/kernel |
---|
| 244 | @mkdir -p build/kernel/kern |
---|
| 245 | @mkdir -p build/kernel/hal |
---|
| 246 | @mkdir -p build/kernel/devices |
---|
| 247 | @mkdir -p build/kernel/mm |
---|
| 248 | @mkdir -p build/kernel/libk |
---|
| 249 | @mkdir -p build/kernel/drivers |
---|
| 250 | @mkdir -p build/kernel/vfs |
---|
[16] | 251 | @mkdir -p build/kernel/syscalls |
---|
[1] | 252 | @mkdir -p hdd |
---|
| 253 | |
---|
| 254 | # Rule to make a recursive list of the virtual disk content. |
---|
| 255 | list: |
---|
| 256 | mdir -/ -w -i $(DISK_IMAGE) ::/ |
---|
| 257 | |
---|
| 258 | # Rule to make a file system check for the virtual disk. |
---|
| 259 | fsck: |
---|
| 260 | fsck.msdos $(DISK_IMAGE) |
---|
| 261 | |
---|
| 262 | ############################################################## |
---|
| 263 | # Rule to copy the files generated by the virtual prototype |
---|
| 264 | # from the virtual disk 'home' directory to the current directory. |
---|
| 265 | extract: |
---|
| 266 | mcopy -o -i $(DISK_IMAGE) ::/home . |
---|
| 267 | |
---|
| 268 | # Rules to delete all binary files from Unix File System |
---|
| 269 | # without modifying the virtual disk. |
---|
| 270 | clean: |
---|
| 271 | rm -f *.o *.elf *.bin *.txt core |
---|
| 272 | rm -f hard_config.h arch_info.xml arch_info.bin |
---|
| 273 | rm -rf build |
---|
| 274 | |
---|
| 275 | #################################################### |
---|
| 276 | # Rule for building a new virtual disk from scratch. |
---|
| 277 | # It creates the bin / home directories. |
---|
| 278 | # This requires the generic Linux/MacOS 'create_dmg' script, that should be |
---|
| 279 | # placed in the same directory as this Makefile. |
---|
| 280 | build-disk: |
---|
| 281 | rm -f $(DISK_IMAGE) |
---|
| 282 | ./create_dmg create $(basename $(DISK_IMAGE)) |
---|
| 283 | dd if=$(DISK_IMAGE) of=temp.dmg count=65536 |
---|
| 284 | mv temp.dmg $(DISK_IMAGE) |
---|
| 285 | mmd -o -i $(DISK_IMAGE) ::/bin || true |
---|
| 286 | mmd -o -i $(DISK_IMAGE) ::/bin/kernel || true |
---|
| 287 | mmd -o -i $(DISK_IMAGE) ::/home || true |
---|
| 288 | mdir -/ -b -i $(DISK_IMAGE) ::/ |
---|
| 289 | |
---|
| 290 | ############################################################## |
---|
| 291 | # Rules to generate hardware description files (hard_config.h, |
---|
| 292 | # arch_info.bin and arch_info.xml), and update the virtual disk. |
---|
| 293 | hard_config.h: $(ARCH)/arch_info.py |
---|
| 294 | tools/arch_info/genarch.py --arch=$(ARCH) \ |
---|
| 295 | --x_size=$(X_SIZE) \ |
---|
| 296 | --y_size=$(Y_SIZE) \ |
---|
| 297 | --nb_cores=$(NB_PROCS) \ |
---|
| 298 | --nb_ttys=$(NB_TTYS) \ |
---|
| 299 | --fbf_size=$(FBF_WIDTH) \ |
---|
| 300 | --ioc_type=$(IOC_TYPE) \ |
---|
| 301 | --hard=. \ |
---|
| 302 | --bin=. \ |
---|
| 303 | --xml=. |
---|
| 304 | mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/ || true |
---|
| 305 | |
---|
| 306 | ################################################ |
---|
| 307 | # Rules to compile boot drivers used by boot.elf |
---|
| 308 | build/boot/boot_tty_driver.o: tools/bootloader_tsar/boot_tty_driver.c \ |
---|
| 309 | tools/bootloader_tsar/boot_tty_driver.h \ |
---|
| 310 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 311 | tools/bootloader_tsar/boot_config.h \ |
---|
| 312 | hal/tsar_mips32/hal_types.h \ |
---|
| 313 | hard_config.h |
---|
| 314 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 315 | $(DU) -D $@ > $@.txt |
---|
| 316 | |
---|
| 317 | build/boot/boot_bdv_driver.o: tools/bootloader_tsar/boot_bdv_driver.c \ |
---|
| 318 | tools/bootloader_tsar/boot_bdv_driver.h \ |
---|
| 319 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 320 | tools/bootloader_tsar/boot_config.h \ |
---|
| 321 | hal/tsar_mips32/hal_types.h \ |
---|
| 322 | hard_config.h |
---|
| 323 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 324 | $(DU) -D $@ > $@.txt |
---|
| 325 | |
---|
| 326 | build/boot/boot_hba_driver.o: tools/bootloader_tsar/boot_hba_driver.c \ |
---|
| 327 | tools/bootloader_tsar/boot_hba_driver.h \ |
---|
| 328 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 329 | tools/bootloader_tsar/boot_config.h \ |
---|
| 330 | hal/tsar_mips32/hal_types.h \ |
---|
| 331 | hard_config.h |
---|
| 332 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 333 | $(DU) -D $@ > $@.txt |
---|
| 334 | |
---|
| 335 | build/boot/boot_mmc_driver.o: tools/bootloader_tsar/boot_mmc_driver.c \ |
---|
| 336 | tools/bootloader_tsar/boot_mmc_driver.h \ |
---|
| 337 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 338 | tools/bootloader_tsar/boot_config.h \ |
---|
| 339 | hal/tsar_mips32/hal_types.h \ |
---|
| 340 | hard_config.h |
---|
| 341 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 342 | $(DU) -D $@ > $@.txt |
---|
| 343 | |
---|
| 344 | ############################## |
---|
| 345 | # Rule to compile boot_fat32.o |
---|
| 346 | build/boot/boot_fat32.o: tools/bootloader_tsar/boot_fat32.c \ |
---|
| 347 | tools/bootloader_tsar/boot_fat32.h \ |
---|
| 348 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 349 | tools/bootloader_tsar/boot_config.h \ |
---|
| 350 | hal/tsar_mips32/hal_types.h \ |
---|
| 351 | hard_config.h |
---|
| 352 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 353 | $(DU) -D $@ > $@.txt |
---|
| 354 | |
---|
| 355 | ############################## |
---|
| 356 | # Rule to compile boot_utils.o |
---|
| 357 | build/boot/boot_utils.o: tools/bootloader_tsar/boot_utils.c \ |
---|
| 358 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 359 | tools/bootloader_tsar/boot_tty_driver.h \ |
---|
| 360 | hal/tsar_mips32/hal_types.h \ |
---|
| 361 | hard_config.h |
---|
| 362 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 363 | $(DU) -D $@ > $@.txt |
---|
| 364 | |
---|
| 365 | ######################## |
---|
| 366 | # Rule to compile boot.o |
---|
| 367 | build/boot/boot.o: tools/bootloader_tsar/boot.c \ |
---|
| 368 | tools/bootloader_tsar/boot_utils.h \ |
---|
| 369 | tools/bootloader_tsar/boot_fat32.h \ |
---|
| 370 | tools/bootloader_tsar/boot_tty_driver.h \ |
---|
| 371 | tools/bootloader_tsar/boot_hba_driver.h \ |
---|
| 372 | tools/bootloader_tsar/boot_bdv_driver.h \ |
---|
| 373 | tools/bootloader_tsar/boot_mmc_driver.h \ |
---|
| 374 | tools/bootloader_tsar/boot_config.h \ |
---|
| 375 | hal/tsar_mips32/hal_types.h \ |
---|
| 376 | hard_config.h |
---|
| 377 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< |
---|
| 378 | $(DU) -D $@ > $@.txt |
---|
| 379 | |
---|
| 380 | ############################## |
---|
| 381 | # Rule to compile boot_entry.o |
---|
| 382 | build/boot/boot_entry.o: tools/bootloader_tsar/boot_entry.S \ |
---|
| 383 | tools/bootloader_tsar/boot_config.h \ |
---|
| 384 | hard_config.h |
---|
| 385 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 386 | $(DU) -D $@ > $@.txt |
---|
| 387 | |
---|
| 388 | ##################################################################### |
---|
| 389 | # Rule to generate boot.elf and place it in sector #2 of virtual disk |
---|
| 390 | build/boot/boot.elf: $(BOOT_OBJS) \ |
---|
| 391 | tools/bootloader_tsar/boot.ld |
---|
| 392 | $(LD) -o $@ -T tools/bootloader_tsar/boot.ld $(BOOT_OBJS) |
---|
| 393 | $(DU) -D $@ > $@.txt |
---|
| 394 | dd if=build/boot/boot.elf of=$(DISK_IMAGE) seek=2 conv=notrunc |
---|
| 395 | |
---|
| 396 | |
---|
| 397 | ############################## |
---|
| 398 | # rules to compile the drivers |
---|
| 399 | build/kernel/drivers/%.o: kernel/drivers/soclib/%.c \ |
---|
| 400 | kernel/drivers/soclib/%.h \ |
---|
[16] | 401 | kernel_config.h \ |
---|
[1] | 402 | hal/tsar_mips32/hal_types.h |
---|
| 403 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 404 | $(DU) -D $@ > $@.txt |
---|
| 405 | |
---|
| 406 | ####################################### |
---|
| 407 | # Rules to generate kernel/kern objects |
---|
| 408 | build/kernel/kern/%.o: kernel/kern/%.c \ |
---|
| 409 | kernel/kern/%.h \ |
---|
[16] | 410 | kernel_config.h \ |
---|
[1] | 411 | hal/tsar_mips32/hal_types.h |
---|
| 412 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 413 | $(DU) -D $@ > $@.txt |
---|
| 414 | |
---|
| 415 | ###################################### |
---|
| 416 | # Rules to generate kernel/hal objects |
---|
| 417 | build/kernel/hal/%.o: hal/tsar_mips32/%.c \ |
---|
[16] | 418 | hal/generic/%.h \ |
---|
| 419 | kernel_config.h \ |
---|
[1] | 420 | hal/tsar_mips32/hal_types.h |
---|
| 421 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 422 | $(DU) -D $@ > $@.txt |
---|
| 423 | |
---|
[16] | 424 | build/kernel/hal/hal_kentry.o: hal/tsar_mips32/hal_kentry.S \ |
---|
| 425 | hal/tsar_mips32/hal_kentry.h \ |
---|
| 426 | kernel_config.h \ |
---|
| 427 | hal/tsar_mips32/hal_types.h |
---|
| 428 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 429 | $(DU) -D $@ > $@.txt |
---|
| 430 | |
---|
[1] | 431 | ###################################### |
---|
| 432 | # Rules to generate kernel/dev objects |
---|
| 433 | build/kernel/devices/%.o: kernel/devices/%.c \ |
---|
| 434 | kernel/devices/%.h \ |
---|
[16] | 435 | kernel_config.h \ |
---|
[1] | 436 | hal/tsar_mips32/hal_types.h |
---|
| 437 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 438 | $(DU) -D $@ > $@.txt |
---|
| 439 | |
---|
| 440 | ##################################### |
---|
| 441 | # Rules to generate kernel/mm objects |
---|
| 442 | build/kernel/mm/%.o: kernel/mm/%.c \ |
---|
| 443 | kernel/mm/%.h \ |
---|
[16] | 444 | kernel_config.h \ |
---|
[1] | 445 | hal/tsar_mips32/hal_types.h |
---|
| 446 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 447 | $(DU) -D $@ > $@.txt |
---|
| 448 | |
---|
| 449 | ####################################### |
---|
| 450 | # Rules to generate kernel/libk objects |
---|
| 451 | build/kernel/libk/%.o: kernel/libk/%.c \ |
---|
| 452 | kernel/libk/%.h \ |
---|
[16] | 453 | kernel_config.h \ |
---|
[1] | 454 | hal/tsar_mips32/hal_types.h |
---|
| 455 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 456 | $(DU) -D $@ > $@.txt |
---|
| 457 | |
---|
[16] | 458 | ########################################### |
---|
| 459 | # Rules to generate kernel/syscalls objects |
---|
| 460 | build/kernel/syscalls/%.o: kernel/syscalls/%.c \ |
---|
| 461 | kernel/syscalls/syscalls.h \ |
---|
| 462 | kernel_config.h \ |
---|
| 463 | hal/tsar_mips32/hal_types.h |
---|
| 464 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 465 | $(DU) -D $@ > $@.txt |
---|
| 466 | |
---|
[1] | 467 | ####################################### |
---|
| 468 | # Rules to generate kernel/vfs objects |
---|
| 469 | build/kernel/vfs/%.o: kernel/vfs/%.c \ |
---|
| 470 | kernel/vfs/vfs.h \ |
---|
[16] | 471 | kernel_config.h \ |
---|
[1] | 472 | hal/tsar_mips32/hal_types.h |
---|
| 473 | $(CC) $(KERNEL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 474 | $(DU) -D $@ > $@.txt |
---|
| 475 | |
---|
| 476 | ########################################################### |
---|
| 477 | # Rule to generate kernel.elf and place it on virtual disk |
---|
| 478 | build/kernel/kernel.elf: $(KERN_OBJS) \ |
---|
| 479 | $(HAL_OBJS) \ |
---|
| 480 | $(DEV_OBJS) \ |
---|
| 481 | $(MM_OBJS) \ |
---|
| 482 | $(LIBK_OBJS) \ |
---|
| 483 | $(DRIVERS_OBJS) \ |
---|
| 484 | $(VFS_OBJS) \ |
---|
| 485 | kernel/kernel.ld |
---|
| 486 | $(LD) -o $@ -T kernel/kernel.ld \ |
---|
| 487 | $(KERN_OBJS) $(HAL_OBJS) $(DEV_OBJS) $(MM_OBJS) \ |
---|
[16] | 488 | $(LIBK_OBJS) $(DRIVERS_OBJS) $(VFS_OBJS) \ |
---|
| 489 | $(SYS_OBJS_0) $(SYS_OBJS_1) $(SYS_OBJS_2) \ |
---|
| 490 | $(SYS_OBJS_3) $(SYS_OBJS_4) $(SYS_OBJS_5) |
---|
| 491 | |
---|
[1] | 492 | $(DU) -D $@ > $@.txt |
---|
| 493 | mcopy -o -i $(DISK_IMAGE) build/kernel/kernel.elf ::/bin/kernel |
---|
| 494 | |
---|