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