[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../.. \ |
---|
[557] | 41 | -I$(KERNEL) \ |
---|
| 42 | -I$(KERNEL)/kern |
---|
[439] | 43 | |
---|
| 44 | # Rule to generate boot.elf, kernel.elf, ksh.elf, sort.elf and update virtual disk. |
---|
| 45 | compile: dirs \ |
---|
| 46 | build/boot.elf |
---|
| 47 | |
---|
| 48 | # Rule to create the build directories. |
---|
| 49 | dirs: |
---|
| 50 | @mkdir -p build |
---|
| 51 | |
---|
| 52 | clean: |
---|
| 53 | rm -rf build |
---|
| 54 | |
---|
| 55 | ../../hard_config.h: |
---|
| 56 | $(MAKE) -C ../../ hard_config.h |
---|
| 57 | |
---|
| 58 | ################################################ |
---|
| 59 | # Rules to compile boot drivers used by boot.elf |
---|
| 60 | build/boot_tty_driver.o: boot_tty_driver.c \ |
---|
| 61 | boot_tty_driver.h \ |
---|
| 62 | boot_utils.h \ |
---|
| 63 | boot_config.h \ |
---|
[457] | 64 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 65 | ../../hard_config.h |
---|
| 66 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 67 | $(DU) -D $@ > $@.txt |
---|
| 68 | |
---|
| 69 | build/boot_bdv_driver.o: boot_bdv_driver.c \ |
---|
| 70 | boot_bdv_driver.h \ |
---|
| 71 | boot_utils.h \ |
---|
| 72 | boot_config.h \ |
---|
[457] | 73 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 74 | ../../hard_config.h |
---|
| 75 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 76 | $(DU) -D $@ > $@.txt |
---|
| 77 | |
---|
| 78 | build/boot_hba_driver.o: boot_hba_driver.c \ |
---|
| 79 | boot_hba_driver.h \ |
---|
| 80 | boot_utils.h \ |
---|
| 81 | boot_config.h \ |
---|
[457] | 82 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 83 | ../../hard_config.h |
---|
| 84 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 85 | $(DU) -D $@ > $@.txt |
---|
| 86 | |
---|
[547] | 87 | build/boot_spi_driver.o: boot_spi_driver.c \ |
---|
| 88 | boot_spi_driver.h \ |
---|
| 89 | boot_utils.h \ |
---|
| 90 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
| 91 | ../../hard_config.h |
---|
| 92 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 93 | $(DU) -D $@ > $@.txt |
---|
| 94 | |
---|
[439] | 95 | build/boot_mmc_driver.o: boot_mmc_driver.c \ |
---|
| 96 | boot_mmc_driver.h \ |
---|
| 97 | boot_utils.h \ |
---|
| 98 | boot_config.h \ |
---|
[457] | 99 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 100 | ../../hard_config.h |
---|
| 101 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 102 | $(DU) -D $@ > $@.txt |
---|
| 103 | |
---|
| 104 | ############################## |
---|
[547] | 105 | # Rule to compile boot_spi_utils.o |
---|
| 106 | build/boot_spi_utils.o: boot_spi_utils.c \ |
---|
| 107 | boot_spi_utils.h \ |
---|
| 108 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
| 109 | ../../hard_config.h |
---|
| 110 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 111 | $(DU) -D $@ > $@.txt |
---|
| 112 | |
---|
| 113 | ############################## |
---|
[439] | 114 | # Rule to compile boot_fat32.o |
---|
| 115 | build/boot_fat32.o: boot_fat32.c \ |
---|
| 116 | boot_fat32.h \ |
---|
| 117 | boot_utils.h \ |
---|
| 118 | boot_config.h \ |
---|
[457] | 119 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 120 | ../../hard_config.h |
---|
| 121 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 122 | $(DU) -D $@ > $@.txt |
---|
| 123 | |
---|
| 124 | ############################## |
---|
| 125 | # Rule to compile boot_utils.o |
---|
| 126 | build/boot_utils.o: boot_utils.c \ |
---|
| 127 | boot_utils.h \ |
---|
| 128 | boot_tty_driver.h \ |
---|
[457] | 129 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 130 | ../../hard_config.h |
---|
| 131 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 132 | $(DU) -D $@ > $@.txt |
---|
| 133 | |
---|
| 134 | ######################## |
---|
| 135 | # Rule to compile boot.o |
---|
| 136 | build/boot.o: boot.c \ |
---|
| 137 | boot_utils.h \ |
---|
[547] | 138 | boot_spi_utils.h \ |
---|
[439] | 139 | boot_fat32.h \ |
---|
| 140 | boot_tty_driver.h \ |
---|
| 141 | boot_hba_driver.h \ |
---|
| 142 | boot_bdv_driver.h \ |
---|
| 143 | boot_mmc_driver.h \ |
---|
[547] | 144 | boot_spi_driver.h \ |
---|
[439] | 145 | boot_config.h \ |
---|
[457] | 146 | $(HAL_ARCH)/core/hal_kernel_types.h \ |
---|
[439] | 147 | ../../hard_config.h |
---|
| 148 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) $(MACROS) -c -o $@ $< |
---|
| 149 | $(DU) -D $@ > $@.txt |
---|
| 150 | |
---|
| 151 | ############################## |
---|
| 152 | # Rule to compile boot_entry.o |
---|
| 153 | build/boot_entry.o: boot_entry.S \ |
---|
| 154 | boot_config.h \ |
---|
| 155 | ../../hard_config.h |
---|
| 156 | $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 157 | $(DU) -D $@ > $@.txt |
---|
| 158 | |
---|
| 159 | ##################################################################### |
---|
| 160 | # Rule to generate boot.elf |
---|
| 161 | build/boot.elf: $(BOOT_OBJS) boot.ld |
---|
| 162 | $(LD) -o $@ -T boot.ld $(BOOT_OBJS) |
---|
| 163 | $(DU) -D $@ > $@.txt |
---|