Root/
| 1 | # Iris: micro-kernel for a capability-based operating system. |
| 2 | # Makefile.am: build rules |
| 3 | # Copyright 2009-2012 Bas Wijnen <wijnen@debian.org> |
| 4 | # |
| 5 | # This program is free software: you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation, either version 3 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | AUTOMAKE_OPTIONS = subdir-objects foreign |
| 19 | |
| 20 | # Define some variables. |
| 21 | OBJDUMP = $(host_alias)-objdump |
| 22 | OBJCOPY = $(host_alias)-objcopy |
| 23 | SERIAL ?= /dev/ttyUSB0 |
| 24 | junk = mdebug.abi32 gnu.attributes ctors eh_frame eh_frame_hdr MIPS.abiflags reginfo comment pdr note.gnu.build-id |
| 25 | objcopyflags = -S $(addprefix --remove-section=.,$(junk)) |
| 26 | |
| 27 | start_load = 0x80100000 |
| 28 | |
| 29 | noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/stage1.raw |
| 30 | noinst_PROGRAMS = iris.elf mips/start.elf mips/board/stage1.elf |
| 31 | |
| 32 | %.raw: %.elf |
| 33 | $(OBJCOPY) $(objcopyflags) -Obinary $< $@ |
| 34 | |
| 35 | # Define boot_threads depending on selected mode. |
| 36 | if UDC |
| 37 | boot_threads = hardware/udc |
| 38 | else |
| 39 | if UNBRICK |
| 40 | boot_threads = hardware/sdmmc glue/usbmassstorage |
| 41 | else |
| 42 | boot_threads = hardware/sdmmc glue/partition glue/fat |
| 43 | noinst_DATA += iris.tar.gz |
| 44 | endif |
| 45 | endif |
| 46 | |
| 47 | # Threadlist must be the last file on the line below. |
| 48 | iris_sources = kernel/panic.cc kernel/data.cc kernel/alloc.cc kernel/memory.cc kernel/invoke.cc kernel/schedule.cc mips/interrupts.cc mips/arch.cc userspace/boot/threadlist.S |
| 49 | boot_sources = mips/init.cc mips/board/board.cc |
| 50 | headers = include/kernel.hh include/iris.hh include/devices.hh include/keys.hh mips/arch.hh mips/board/jz4740.hh mips/board/board.hh mips/nand.hh |
| 51 | iris_elf_DEPENDENCIES = mips/board/iris.ld |
| 52 | iris_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 -DNANONOTE -DUSE_SERIAL |
| 53 | iris_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common |
| 54 | iris_elf_LDFLAGS = -Wl,--omagic -nostdlib -T mips/board/iris.ld |
| 55 | iris_elf_SOURCES = mips/entry.S ${iris_sources} mips/boot.S ${boot_sources} ${headers} |
| 56 | |
| 57 | mips_start_elf_CPPFLAGS = -fno-inline -mips32 -DSTART="0x$(shell /bin/sh -c '$(OBJDUMP) -t iris.elf | grep __start$$ | cut -b1-8')" -DADDR0="0x$(shell /bin/sh -c '$(OBJDUMP) -t iris.elf | grep addr000$$ | cut -b1-8')" |
| 58 | mips_start_elf_LDFLAGS = -Wl,--omagic -Wl,-Ttext -Wl,$(start_load) -nostdlib |
| 59 | mips_start_elf_SOURCES = mips/start-hack.S iris.raw |
| 60 | |
| 61 | mips/start-hack.S: mips/start.S iris.raw |
| 62 | cp $< $@ |
| 63 | |
| 64 | mips_board_stage1_elf_DEPENDENCIES = mips/board/stage1.ld |
| 65 | mips_board_stage1_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 |
| 66 | mips_board_stage1_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common |
| 67 | mips_board_stage1_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/stage1.ld -nostdlib |
| 68 | mips_board_stage1_elf_SOURCES = mips/board/stage1.cc |
| 69 | |
| 70 | program_targets = \ |
| 71 | userspace/bootinit.elf \ |
| 72 | userspace/init.elf \ |
| 73 | userspace/boot.elf \ |
| 74 | userspace/gpio.elf \ |
| 75 | userspace/lcd.elf \ |
| 76 | userspace/nand.elf \ |
| 77 | userspace/rtc.elf \ |
| 78 | userspace/sdmmc.elf \ |
| 79 | userspace/udc.elf \ |
| 80 | userspace/elfrun.elf \ |
| 81 | userspace/fat.elf \ |
| 82 | userspace/font.elf \ |
| 83 | userspace/gui.elf \ |
| 84 | userspace/partition.elf \ |
| 85 | userspace/usbmassstorage.elf \ |
| 86 | userspace/alarm.elf \ |
| 87 | userspace/ball.elf \ |
| 88 | userspace/booter.elf \ |
| 89 | userspace/bsquare.elf \ |
| 90 | userspace/buzzer.elf \ |
| 91 | userspace/metronome.elf \ |
| 92 | userspace/test.elf |
| 93 | |
| 94 | fs_targets = \ |
| 95 | fs/alarm.elf \ |
| 96 | fs/ball.elf \ |
| 97 | fs/boot.elf \ |
| 98 | fs/booter.elf \ |
| 99 | fs/bootinit.elf \ |
| 100 | fs/bsquare.elf \ |
| 101 | fs/buzzer.elf \ |
| 102 | fs/elfrun.elf \ |
| 103 | fs/fat.elf \ |
| 104 | fs/font.elf \ |
| 105 | fs/gpio.elf \ |
| 106 | fs/gui.elf \ |
| 107 | fs/init.elf \ |
| 108 | fs/lcd.elf \ |
| 109 | fs/metronome.elf \ |
| 110 | fs/nand.elf \ |
| 111 | fs/partition.elf \ |
| 112 | fs/rtc.elf \ |
| 113 | fs/sdmmc.elf \ |
| 114 | fs/test.elf \ |
| 115 | fs/udc.elf \ |
| 116 | fs/usbmassstorage.elf |
| 117 | |
| 118 | noinst_PROGRAMS += $(program_targets) |
| 119 | noinst_DATA += $(fs_targets) |
| 120 | AM_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 -DNANONOTE |
| 121 | AM_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 |
| 122 | AM_LDFLAGS = -nostdlib |
| 123 | |
| 124 | BUILT_SOURCES = $(headers) userspace/data/charset.data server |
| 125 | |
| 126 | userspace/boot/threadlist.S: userspace/boot/mkthreadlist Makefile $(addprefix fs/,$(addsuffix .elf,bootinit $(notdir $(boot_threads)))) |
| 127 | $< bootinit $(boot_threads) > $@ |
| 128 | |
| 129 | PYPP = /usr/bin/pypp |
| 130 | %.cc: %.ccp |
| 131 | $(PYPP) --name $< < $< > $@ |
| 132 | %.hh: %.hhp |
| 133 | $(PYPP) --name $< < $< > $@ |
| 134 | |
| 135 | userspace/data/charset.data: userspace/data/charset |
| 136 | $< > $@ |
| 137 | fs/font.dat: userspace/data/courier-10+8+32.png userspace/data/makefont |
| 138 | userspace/data/makefont $< > $@ |
| 139 | fs/init.config: userspace/data/init.config |
| 140 | ln -s ../$< $@ |
| 141 | |
| 142 | fs/%.elf: userspace/%.elf |
| 143 | mkdir -p fs |
| 144 | $(OBJCOPY) -S $< $@ |
| 145 | |
| 146 | userspace_bootinit_elf_SOURCES = userspace/boot/crt0.cc userspace/boot/bootinit.cc ${headers} |
| 147 | userspace_init_elf_SOURCES = userspace/boot/crt0.cc userspace/boot/init.cc ${headers} |
| 148 | |
| 149 | userspace_boot_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/boot.cc ${headers} |
| 150 | userspace_buzzer_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/buzzer.cc ${headers} |
| 151 | userspace_gpio_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/gpio.cc ${headers} |
| 152 | userspace_lcd_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/lcd.cc ${headers} |
| 153 | userspace_nand_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/nand.cc ${headers} |
| 154 | userspace_rtc_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/rtc.cc ${headers} |
| 155 | userspace_sdmmc_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/sdmmc.cc ${headers} |
| 156 | userspace_udc_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/udc.cc ${headers} |
| 157 | |
| 158 | #userspace_buffer_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/buffer.cc ${headers} |
| 159 | userspace_elfrun_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/elfrun.cc ${headers} |
| 160 | userspace_fat_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/fat.cc ${headers} |
| 161 | userspace_font_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/font.cc ${headers} |
| 162 | userspace_gui_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/gui.cc ${headers} |
| 163 | userspace_partition_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/partition.cc ${headers} |
| 164 | userspace_usbmassstorage_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/usbmassstorage.cc ${headers} |
| 165 | |
| 166 | userspace_metronome_elf_SOURCES = userspace/boot/crt0.cc userspace/application/metronome.cc ${headers} |
| 167 | userspace_test_elf_SOURCES = userspace/boot/crt0.cc userspace/application/test.cc ${headers} |
| 168 | userspace_alarm_elf_SOURCES = userspace/boot/crt0.cc userspace/application/alarm.cc ${headers} |
| 169 | userspace_ball_elf_SOURCES = userspace/boot/crt0.cc userspace/application/ball.cc ${headers} |
| 170 | userspace_booter_elf_SOURCES = userspace/boot/crt0.cc userspace/application/booter.cc ${headers} |
| 171 | userspace_bsquare_elf_SOURCES = userspace/boot/crt0.cc userspace/application/bsquare.cc ${headers} |
| 172 | |
| 173 | server: |
| 174 | test -e native/Makefile || native/autogen.sh |
| 175 | $(MAKE) -C native |
| 176 | |
| 177 | # This target is meaningless for SD boot mode. |
| 178 | test: mips/start.raw mips/start.elf server mips/board/stage1.raw fs/init.config fs/font.dat |
| 179 | echo shutdown | nc localhost 5050 || true |
| 180 | native/usb-server |
| 181 | echo 'reboot $(start_load) 0x$(shell /bin/sh -c '$(OBJDUMP) -t mips/start.elf | grep __start$$ | cut -b1-8') mips/start.raw' | nc localhost 5050 |
| 182 | |
| 183 | # SD boot stuff |
| 184 | iris.tar.gz: mips/start.raw.gz mips/start.elf $(fs_targets) fs/init.config fs/font.dat |
| 185 | test -d fs/boot || mkdir fs/boot |
| 186 | mkimage -A mips -T kernel -a $(start_load) -e $(shell /bin/sh -c '$(OBJDUMP) -t mips/start.elf | grep __start$$ | cut -b1-8') -n Iris -d mips/start.raw.gz fs/boot/uImage | sed -e 's/:/;/g' |
| 187 | cd fs && tar czvf ../$@ --dereference * |
| 188 | %.gz: % |
| 189 | gzip < $< > $@ |
| 190 | |
| 191 | sources = \ |
| 192 | userspace/boot/bootinit.cc \ |
| 193 | userspace/boot/init.cc \ |
| 194 | userspace/hardware/boot.cc \ |
| 195 | userspace/hardware/buzzer.cc \ |
| 196 | userspace/hardware/gpio.cc \ |
| 197 | userspace/hardware/lcd.cc \ |
| 198 | userspace/hardware/nand.cc \ |
| 199 | userspace/hardware/rtc.cc \ |
| 200 | userspace/hardware/sdmmc.cc \ |
| 201 | userspace/hardware/udc.cc \ |
| 202 | userspace/glue/elfrun.cc \ |
| 203 | userspace/glue/fat.cc \ |
| 204 | userspace/glue/font.cc \ |
| 205 | userspace/glue/gui.cc \ |
| 206 | userspace/glue/partition.cc \ |
| 207 | userspace/glue/usbmassstorage.cc \ |
| 208 | userspace/application/alarm.cc \ |
| 209 | userspace/application/ball.cc \ |
| 210 | userspace/application/booter.cc \ |
| 211 | userspace/application/bsquare.cc \ |
| 212 | userspace/application/metronome.cc \ |
| 213 | userspace/application/test.cc |
| 214 | |
| 215 | debug: |
| 216 | stty -F $(SERIAL) 57600 raw |
| 217 | cat $(SERIAL) |
| 218 | |
| 219 | autoclean: maintainer-clean |
| 220 | test ! -f native/Makefile || $(MAKE) -C native autoclean |
| 221 | rm -rf aclocal.m4 configure compile depcomp fs install-sh iris.raw iris-sd.tar Makefile.in missing $(iris_sources) $(boot_sources) $(sources) $(headers) mips/start-hack.S mips/start.raw mips/start.raw.gz userspace/data/charset.data iris.tar.gz mips/board/stage1.cc mips/board/stage1.elf mips/board/stage1.raw mips/board/stage1.elf userspace/boot/crt0.cc |
| 222 |
Branches:
master
