| [439] | 1 | ############################################################################# | 
|---|
 | 2 | #                  ALMOS-MKH Makefile for BOOTLOADER TSAR                   # | 
|---|
 | 3 | ############################################################################# | 
|---|
 | 4 |  | 
|---|
 | 5 | -include ../../params-soft.mk | 
|---|
 | 6 | ifeq ($(ARCH_NAME),) | 
|---|
 | 7 | $(error Please define in ARCH_NAME parameter in params-soft.mk!) | 
|---|
 | 8 | endif | 
|---|
 | 9 |  | 
|---|
 | 10 | -include ../../params-hard.mk | 
|---|
 | 11 |  | 
|---|
 | 12 | # Rules that don't build target files | 
|---|
 | 13 | # always out-of-date, need to be regenerated everytime they are called | 
|---|
 | 14 | .PHONY: compile                         \ | 
|---|
 | 15 |         ../../hard_config.h           \ | 
|---|
 | 16 |                 dirs                                \ | 
|---|
 | 17 |                 build/boot.elf      \ | 
|---|
 | 18 |  | 
|---|
 | 19 | # Macros to be processed by the C preprocessor. | 
|---|
 | 20 | MACROS           = -DARCHINFO_PATHNAME="\"arch_info.bin\""              \ | 
|---|
 | 21 |                            -DKERNEL_PATHNAME="\"/bin/kernel/kernel.elf\"" | 
|---|
 | 22 |  | 
|---|
 | 23 | # Objects to be linked for boot.elf generation | 
|---|
 | 24 | BOOT_OBJS       = build/boot.o            \ | 
|---|
 | 25 |                 build/boot_fat32.o      \ | 
|---|
 | 26 |                 build/boot_utils.o      \ | 
|---|
| [547] | 27 |                 build/boot_spi_utils.o \ | 
|---|
| [439] | 28 |                 build/boot_entry.o      \ | 
|---|
 | 29 |                 build/boot_tty_driver.o \ | 
|---|
 | 30 |                 build/boot_hba_driver.o \ | 
|---|
 | 31 |                 build/boot_bdv_driver.o \ | 
|---|
| [547] | 32 |                 build/boot_spi_driver.o \ | 
|---|
| [439] | 33 |                 build/boot_mmc_driver.o  | 
|---|
 | 34 |  | 
|---|
 | 35 | # List of directories to be searched for included files | 
|---|
 | 36 | # when compiling for boot.elf generation | 
|---|
 | 37 | BOOT_INCLUDE = -I.  \ | 
|---|
 | 38 |                 -I../../tools/arch_info/        \ | 
|---|
 | 39 |                 -I$(HAL_ARCH)/core   \ | 
|---|
 | 40 |                 -I../.. \ | 
|---|
 | 41 |                 -I$(KERNEL) | 
|---|
 | 42 |  | 
|---|
 | 43 | # Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk. | 
|---|
 | 44 | compile: dirs                     \ | 
|---|
 | 45 |          build/boot.elf | 
|---|
 | 46 |  | 
|---|
 | 47 | # Rule to create the build directories. | 
|---|
 | 48 | dirs: | 
|---|
 | 49 |         @mkdir -p build | 
|---|
 | 50 |  | 
|---|
 | 51 | clean: | 
|---|
 | 52 |         rm -rf build | 
|---|
 | 53 |  | 
|---|
 | 54 | ../../hard_config.h: | 
|---|
 | 55 |         $(MAKE) -C ../../ hard_config.h | 
|---|
 | 56 |  | 
|---|
 | 57 | ################################################ | 
|---|
 | 58 | # Rules to compile boot drivers used by boot.elf | 
|---|
 | 59 | build/boot_tty_driver.o:        boot_tty_driver.c \ | 
|---|
 | 60 |                                                                 boot_tty_driver.h \ | 
|---|
 | 61 |                                                                 boot_utils.h      \ | 
|---|
 | 62 |                                                                 boot_config.h     \ | 
|---|
| [457] | 63 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h        \ | 
|---|
| [439] | 64 |                                                                 ../../hard_config.h | 
|---|
 | 65 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 66 |         $(DU) -D $@ > $@.txt | 
|---|
 | 67 |  | 
|---|
 | 68 | build/boot_bdv_driver.o:        boot_bdv_driver.c \ | 
|---|
 | 69 |                                                                 boot_bdv_driver.h \ | 
|---|
 | 70 |                                                                 boot_utils.h      \ | 
|---|
 | 71 |                                                                 boot_config.h     \ | 
|---|
| [457] | 72 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h        \ | 
|---|
| [439] | 73 |                                                                 ../../hard_config.h | 
|---|
 | 74 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 75 |         $(DU) -D $@ > $@.txt | 
|---|
 | 76 |  | 
|---|
 | 77 | build/boot_hba_driver.o:        boot_hba_driver.c \ | 
|---|
 | 78 |                                                                 boot_hba_driver.h \ | 
|---|
 | 79 |                                                                 boot_utils.h      \ | 
|---|
 | 80 |                                                                 boot_config.h     \ | 
|---|
| [457] | 81 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h        \ | 
|---|
| [439] | 82 |                                                                 ../../hard_config.h | 
|---|
 | 83 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 84 |         $(DU) -D $@ > $@.txt | 
|---|
 | 85 |  | 
|---|
| [547] | 86 | build/boot_spi_driver.o:        boot_spi_driver.c \ | 
|---|
 | 87 |                                                                 boot_spi_driver.h \ | 
|---|
 | 88 |                                                                 boot_utils.h      \ | 
|---|
 | 89 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h        \ | 
|---|
 | 90 |                                                                 ../../hard_config.h | 
|---|
 | 91 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 92 |         $(DU) -D $@ > $@.txt | 
|---|
 | 93 |  | 
|---|
| [439] | 94 | build/boot_mmc_driver.o:        boot_mmc_driver.c \ | 
|---|
 | 95 |                                                                 boot_mmc_driver.h \ | 
|---|
 | 96 |                                                                 boot_utils.h      \ | 
|---|
 | 97 |                                                                 boot_config.h     \ | 
|---|
| [457] | 98 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h        \ | 
|---|
| [439] | 99 |                                                                 ../../hard_config.h | 
|---|
 | 100 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 101 |         $(DU) -D $@ > $@.txt | 
|---|
 | 102 |  | 
|---|
 | 103 | ############################## | 
|---|
| [547] | 104 | # Rule to compile boot_spi_utils.o | 
|---|
 | 105 | build/boot_spi_utils.o: boot_spi_utils.c       \ | 
|---|
 | 106 |                                                                 boot_spi_utils.h       \ | 
|---|
 | 107 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h         \ | 
|---|
 | 108 |                                                                 ../../hard_config.h | 
|---|
 | 109 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 110 |         $(DU) -D $@ > $@.txt | 
|---|
 | 111 |  | 
|---|
 | 112 | ############################## | 
|---|
| [439] | 113 | # Rule to compile boot_fat32.o | 
|---|
 | 114 | build/boot_fat32.o: boot_fat32.c      \ | 
|---|
 | 115 |                                                                 boot_fat32.h      \ | 
|---|
 | 116 |                                                                 boot_utils.h      \ | 
|---|
 | 117 |                                                                 boot_config.h     \ | 
|---|
| [457] | 118 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h        \ | 
|---|
| [439] | 119 |                                                                 ../../hard_config.h                      | 
|---|
 | 120 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 121 |         $(DU) -D $@ > $@.txt | 
|---|
 | 122 |  | 
|---|
 | 123 | ############################## | 
|---|
 | 124 | # Rule to compile boot_utils.o | 
|---|
 | 125 | build/boot_utils.o: boot_utils.c       \ | 
|---|
 | 126 |                                                                 boot_utils.h       \ | 
|---|
 | 127 |                                                                 boot_tty_driver.h  \ | 
|---|
| [457] | 128 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h         \ | 
|---|
| [439] | 129 |                                                                 ../../hard_config.h | 
|---|
 | 130 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 131 |         $(DU) -D $@ > $@.txt | 
|---|
 | 132 |  | 
|---|
 | 133 | ######################## | 
|---|
 | 134 | # Rule to compile boot.o | 
|---|
 | 135 | build/boot.o:                           boot.c             \ | 
|---|
 | 136 |                                                                 boot_utils.h       \ | 
|---|
| [547] | 137 |                                                                 boot_spi_utils.h   \ | 
|---|
| [439] | 138 |                                                                 boot_fat32.h       \ | 
|---|
 | 139 |                                                                 boot_tty_driver.h  \ | 
|---|
 | 140 |                                                                 boot_hba_driver.h  \ | 
|---|
 | 141 |                                                                 boot_bdv_driver.h  \ | 
|---|
 | 142 |                                                                 boot_mmc_driver.h  \ | 
|---|
| [547] | 143 |                                                                 boot_spi_driver.h  \ | 
|---|
| [439] | 144 |                                                                 boot_config.h      \ | 
|---|
| [457] | 145 |                                                                 $(HAL_ARCH)/core/hal_kernel_types.h         \ | 
|---|
| [439] | 146 |                                                                 ../../hard_config.h                              | 
|---|
 | 147 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< | 
|---|
 | 148 |         $(DU) -D $@ > $@.txt | 
|---|
 | 149 |  | 
|---|
 | 150 | ############################## | 
|---|
 | 151 | # Rule to compile boot_entry.o | 
|---|
 | 152 | build/boot_entry.o: boot_entry.S   \ | 
|---|
 | 153 |                                                                 boot_config.h  \ | 
|---|
 | 154 |                                                                 ../../hard_config.h | 
|---|
 | 155 |         $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< | 
|---|
 | 156 |         $(DU) -D $@ > $@.txt | 
|---|
 | 157 |  | 
|---|
 | 158 | ##################################################################### | 
|---|
 | 159 | # Rule to generate boot.elf | 
|---|
 | 160 | build/boot.elf: $(BOOT_OBJS) boot.ld | 
|---|
 | 161 |         $(LD) -o $@ -T boot.ld $(BOOT_OBJS) | 
|---|
 | 162 |         $(DU) -D $@ > $@.txt | 
|---|