# Iris: micro-kernel for a capability-based operating system. # Makefile.am: build rules # Copyright 2009-2012 Bas Wijnen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . AUTOMAKE_OPTIONS = subdir-objects foreign # Define some variables. OBJDUMP = $(host_alias)-objdump OBJCOPY = $(host_alias)-objcopy SERIAL ?= /dev/ttyUSB0 junk = mdebug.abi32 gnu.attributes ctors eh_frame eh_frame_hdr MIPS.abiflags reginfo comment pdr note.gnu.build-id objcopyflags = -S $(addprefix --remove-section=.,$(junk)) start_load = 0x80100000 noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/sdram-setup.raw noinst_PROGRAMS = iris.elf mips/start.elf mips/board/sdram-setup.elf %.raw: %.elf $(OBJCOPY) $(objcopyflags) -Obinary $< $@ # Define boot_threads depending on selected mode. if UDC boot_threads = hardware/udc else if UNBRICK boot_threads = hardware/sdmmc glue/usbmassstorage else boot_threads = hardware/sdmmc glue/partition glue/fat noinst_DATA += iris.tar.gz endif endif # Threadlist must be the last file on the line below. 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 boot_sources = mips/init.cc mips/board/board.cc 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 iris_elf_DEPENDENCIES = mips/board/iris.ld iris_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 -DNANONOTE -DUSE_SERIAL iris_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common iris_elf_LDFLAGS = -Wl,--omagic -nostdlib -T mips/board/iris.ld iris_elf_SOURCES = mips/entry.S ${iris_sources} mips/boot.S ${boot_sources} ${headers} 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')" mips_start_elf_LDFLAGS = -Wl,--omagic -Wl,-Ttext -Wl,$(start_load) -nostdlib mips_start_elf_SOURCES = mips/start-hack.S iris.raw mips/start-hack.S: mips/start.S iris.raw cp $< $@ mips_board_sdram_setup_elf_DEPENDENCIES = mips/board/sdram-setup.ld mips_board_sdram_setup_elf_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 mips_board_sdram_setup_elf_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 -fno-exceptions -fno-common mips_board_sdram_setup_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/sdram-setup.ld -nostdlib mips_board_sdram_setup_elf_SOURCES = mips/board/sdram-setup.cc program_targets = \ userspace/bootinit.elf \ userspace/init.elf \ userspace/boot.elf \ userspace/gpio.elf \ userspace/lcd.elf \ userspace/nand.elf \ userspace/rtc.elf \ userspace/sdmmc.elf \ userspace/udc.elf \ userspace/elfrun.elf \ userspace/fat.elf \ userspace/font.elf \ userspace/gui.elf \ userspace/partition.elf \ userspace/usbmassstorage.elf \ userspace/alarm.elf \ userspace/ball.elf \ userspace/booter.elf \ userspace/bsquare.elf \ userspace/buzzer.elf \ userspace/metronome.elf \ userspace/test.elf fs_targets = \ fs/alarm.elf \ fs/ball.elf \ fs/boot.elf \ fs/booter.elf \ fs/bootinit.elf \ fs/bsquare.elf \ fs/buzzer.elf \ fs/elfrun.elf \ fs/fat.elf \ fs/font.elf \ fs/gpio.elf \ fs/gui.elf \ fs/init.elf \ fs/lcd.elf \ fs/metronome.elf \ fs/nand.elf \ fs/partition.elf \ fs/rtc.elf \ fs/sdmmc.elf \ fs/test.elf \ fs/udc.elf \ fs/usbmassstorage.elf noinst_PROGRAMS += $(program_targets) noinst_DATA += $(fs_targets) AM_CPPFLAGS = -fno-inline -Iinclude -Imips -Imips/board -mips32 -DNANONOTE AM_CXXFLAGS = -O5 -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3 AM_LDFLAGS = -nostdlib BUILT_SOURCES = $(headers) userspace/data/charset.data server userspace/boot/threadlist.S: userspace/boot/mkthreadlist Makefile $(addprefix fs/,$(addsuffix .elf,bootinit $(notdir $(boot_threads)))) $< bootinit $(boot_threads) > $@ PYPP = /usr/bin/pypp %.cc: %.ccp $(PYPP) --name $< < $< > $@ %.hh: %.hhp $(PYPP) --name $< < $< > $@ userspace/data/charset.data: userspace/data/charset $< > $@ fs/font.dat: userspace/data/courier-10+8+32.png userspace/data/makefont userspace/data/makefont $< > $@ fs/init.config: userspace/data/init.config ln -s ../$< $@ fs/%.elf: userspace/%.elf mkdir -p fs $(OBJCOPY) -S $< $@ userspace_bootinit_elf_SOURCES = userspace/boot/crt0.cc userspace/boot/bootinit.cc ${headers} userspace_init_elf_SOURCES = userspace/boot/crt0.cc userspace/boot/init.cc ${headers} userspace_boot_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/boot.cc ${headers} userspace_buzzer_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/buzzer.cc ${headers} userspace_gpio_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/gpio.cc ${headers} userspace_lcd_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/lcd.cc ${headers} userspace_nand_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/nand.cc ${headers} userspace_rtc_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/rtc.cc ${headers} userspace_sdmmc_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/sdmmc.cc ${headers} userspace_udc_elf_SOURCES = userspace/boot/crt0.cc userspace/hardware/udc.cc ${headers} #userspace_buffer_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/buffer.cc ${headers} userspace_elfrun_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/elfrun.cc ${headers} userspace_fat_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/fat.cc ${headers} userspace_font_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/font.cc ${headers} userspace_gui_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/gui.cc ${headers} userspace_partition_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/partition.cc ${headers} userspace_usbmassstorage_elf_SOURCES = userspace/boot/crt0.cc userspace/glue/usbmassstorage.cc ${headers} userspace_metronome_elf_SOURCES = userspace/boot/crt0.cc userspace/application/metronome.cc ${headers} userspace_test_elf_SOURCES = userspace/boot/crt0.cc userspace/application/test.cc ${headers} userspace_alarm_elf_SOURCES = userspace/boot/crt0.cc userspace/application/alarm.cc ${headers} userspace_ball_elf_SOURCES = userspace/boot/crt0.cc userspace/application/ball.cc ${headers} userspace_booter_elf_SOURCES = userspace/boot/crt0.cc userspace/application/booter.cc ${headers} userspace_bsquare_elf_SOURCES = userspace/boot/crt0.cc userspace/application/bsquare.cc ${headers} server: test -e native/Makefile || native/autogen.sh $(MAKE) -C native # This target is meaningless for SD boot mode. test: mips/start.raw mips/start.elf server mips/board/sdram-setup.raw fs/init.config fs/font.dat echo shutdown | nc localhost 5050 || true native/usb-server 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 # SD boot stuff iris.tar.gz: mips/start.raw.gz mips/start.elf $(fs_targets) fs/init.config fs/font.dat test -d fs/boot || mkdir fs/boot 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' cd fs && tar czvf ../$@ --dereference * %.gz: % gzip < $< > $@ sources = \ userspace/boot/bootinit.cc \ userspace/boot/init.cc \ userspace/hardware/boot.cc \ userspace/hardware/buzzer.cc \ userspace/hardware/gpio.cc \ userspace/hardware/lcd.cc \ userspace/hardware/nand.cc \ userspace/hardware/rtc.cc \ userspace/hardware/sdmmc.cc \ userspace/hardware/udc.cc \ userspace/glue/elfrun.cc \ userspace/glue/fat.cc \ userspace/glue/font.cc \ userspace/glue/gui.cc \ userspace/glue/partition.cc \ userspace/glue/usbmassstorage.cc \ userspace/application/alarm.cc \ userspace/application/ball.cc \ userspace/application/booter.cc \ userspace/application/bsquare.cc \ userspace/application/metronome.cc \ userspace/application/test.cc debug: stty -F $(SERIAL) 57600 raw cat $(SERIAL) autoclean: maintainer-clean $(MAKE) -C native autoclean rm -rf aclocal.m4 configure 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/sdram-setup.cc mips/board/sdram-setup.raw mips/board/sdram-setup.elf userspace/boot/crt0.cc