1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-17 13:50:38 +02:00
iris/mips/nanonote/Makefile.arch

141 lines
5.7 KiB
Makefile
Raw Normal View History

# Iris: micro-kernel for a capability-based operating system.
# mips/nanonote/Makefile.arch: nanonote-specific parts of the build rules
# Copyright 2009 Bas Wijnen <wijnen@debian.org>
#
# 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 <http://www.gnu.org/licenses/>.
2011-01-15 03:10:46 +02:00
start_load = 0x80400000
load = 0x80000000
2010-10-10 11:46:12 +03:00
# Uncomment one of these to select the boot method for the image.
#UDC_BOOT = yes
#SD_BOOT = yes
UNBRICK = yes
2010-08-22 23:03:06 +03:00
arch_iris_sources = mips/interrupts.cc mips/arch.cc
boot_sources = mips/init.cc mips/nanonote/board.cc
arch_headers = mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh mips/nand.hh
udc_boot_programs = udc
sd_boot_programs = sd+mmc partition fat
2011-01-15 03:10:46 +02:00
unbrick_boot_programs = nand sd+mmc usb-mass-storage
2010-08-22 23:03:06 +03:00
standard_boot_programs = bootinit
2011-01-15 03:10:46 +02:00
# use sort to remove duplicates.
programs = $(sort init gpio lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs))
2010-08-22 23:03:06 +03:00
ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
CROSS = mipsel-linux-gnu-
OBJDUMP = $(CROSS)objdump
junk = mdebug.abi32 reginfo comment pdr
OBJCOPYFLAGS = $(addprefix --remove-section=.,$(junk))
2010-08-10 11:09:50 +03:00
2010-10-10 11:46:12 +03:00
ifneq ($(UDC_BOOT),)
2010-08-10 11:09:50 +03:00
boot_threads = $(standard_boot_programs) $(udc_boot_programs)
ARCH_CXXFLAGS = -DNUM_THREADS=2
2010-10-10 11:46:12 +03:00
BOOT_CPPFLAGS = -DUDCBOOT
2010-08-10 11:09:50 +03:00
all: mips/nanonote/nand-boot.raw test
2010-08-22 23:03:06 +03:00
mips/start.o: TARGET =
2010-08-10 11:09:50 +03:00
else
2010-10-10 11:46:12 +03:00
ifneq ($(SD_BOOT),)
2010-08-10 11:09:50 +03:00
boot_threads = $(standard_boot_programs) $(sd_boot_programs)
ARCH_CXXFLAGS = -DNUM_THREADS=4
2010-10-10 11:46:12 +03:00
BOOT_CPPFLAGS = -DSDBOOT
2010-08-10 11:09:50 +03:00
all: mips/nanonote/nand-boot.raw iris-sd.tar
2010-08-22 23:03:06 +03:00
mips/start.o: TARGET = -DWRAPPED
2010-08-10 11:09:50 +03:00
iris-sd.tar: $(addprefix fs/,$(addsuffix .elf,$(programs))) mips/start.raw.gz fs/init.config
2010-08-22 23:03:06 +03:00
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/uimage | sed -e 's/:/;/g'
2010-08-10 11:09:50 +03:00
cd fs && tar cvf ../$@ uimage init.config $(addsuffix .elf,$(programs)) --dereference
2010-10-10 11:46:12 +03:00
else
ifneq ($(UNBRICK),)
2011-01-15 03:10:46 +02:00
boot_threads = $(standard_boot_programs) $(unbrick_boot_programs) sd+mmc
2010-10-10 11:46:12 +03:00
ARCH_CXXFLAGS = -DNUM_THREADS=3
BOOT_CPPFLAGS = -DUNBRICK
all: mips/start.raw
2010-10-10 11:46:12 +03:00
mips/start.o: TARGET =
else
error Please define your boot method.
endif
endif
2010-08-10 11:09:50 +03:00
endif
iris.elf: LDFLAGS = --omagic -Ttext $(load)
mips/start.elf: LDFLAGS = --omagic -Ttext $(start_load)
2010-08-10 11:09:50 +03:00
mips/nanonote/nand-boot.elf: LDFLAGS = --omagic -Ttext 0x80000000
2010-08-22 23:03:06 +03:00
mips/nanonote/nand-boot.o: mips/nand.hh
2010-10-10 21:26:23 +03:00
source/nand.o: mips/nand.hh
mips/start.o:mips/start.S Makefile Makefile.arch iris.raw
2010-08-22 23:03:06 +03:00
$(CC) $(CPPFLAGS) $(TARGET) -DSTART=0x$(shell /bin/sh -c '$(OBJDUMP) -t iris.elf | grep __start$$ | cut -b1-8') -c $< -o $@
test: mips/start.raw mips/start.elf mips/nanonote/server/usb-server mips/nanonote/sdram-setup.raw $(addsuffix .elf,$(addprefix fs/,$(programs))) fs/init.config
2010-08-22 23:03:06 +03:00
echo "reboot $(start_load) 0x$(shell /bin/sh -c '$(OBJDUMP) -t mips/start.elf | grep __start$$ | cut -b1-8') $<" | nc localhost 5050
2010-01-18 07:45:52 +02:00
mips/nanonote/server/usb-server: mips/nanonote/server/usb-server.ccp mips/nanonote/server/Makefile.am mips/nanonote/server/configure.ac devices.hh
2009-12-18 23:27:26 +02:00
$(MAKE) -C mips/nanonote/server
2009-12-26 15:17:06 +02:00
echo "shutdown" | nc localhost 5050
sleep 1
2009-12-18 23:27:26 +02:00
%.elf: %.o
$(LD) $(LDFLAGS) -o $@ $<
%.raw: %.elf
$(OBJCOPY) -S $(OBJCOPYFLAGS) -Obinary $< $@
%.raw.gz: %.raw
gzip < $< > $@
nanonote-boot: mips/nanonote/nanonote-boot.cc mips/nanonote/sdram-setup.raw
g++ `pkg-config --cflags --libs shevek` $< -o $@ -D'STAGE1="$<"' -lusb
mips/nanonote/sdram-setup.elf: mips/nanonote/sdram-setup.ld
mips/nanonote/sdram-setup.elf: LDFLAGS = --omagic -T mips/nanonote/sdram-setup.ld
2010-10-10 11:46:12 +03:00
mips/nanonote/threadlist.o: $(addprefix fs/,$(addsuffix .elf,$(boot_threads)))
mips/boot.o: TARGET_FLAGS = -DMEMORY_SIZE="32 << 20"
2010-06-22 21:55:02 +03:00
mips/init.o: TARGET_FLAGS = -I/usr/include
2010-06-07 00:03:25 +03:00
source/bootinit.o: TARGET_FLAGS = -I/usr/include
source/elfrun.o: TARGET_FLAGS = -I/usr/include
source/gpio.ccp: source/nanonote-gpio.ccp
ln -s $(subst source/,,$<) $@
2010-06-07 00:03:25 +03:00
$(addprefix fs/,$(addsuffix .elf,$(boot_threads))): TARGET_FLAGS = -I.
$(addprefix fs/,$(addsuffix .elf,$(boot_threads))): LDFLAGS = -EL
2010-01-16 17:13:54 +02:00
$(addprefix fs/,$(addsuffix .elf,$(programs))): LDFLAGS = -EL
source/lcd.o: source/charset.data
2010-01-16 17:13:54 +02:00
source/charset.data: source/charset
$< > $@
%.o:%.S Makefile Makefile.arch mips/arch.hh
2010-10-10 11:46:12 +03:00
$(CC) $(CPPFLAGS) $(BOOT_CPPFLAGS) $(TARGET_FLAGS) -DKERNEL_STACK_SIZE=0x1000 -c $< -o $@
# entry.o must be the first file. threadlist.o must be the first of the init objects (which can be freed after loading).
2010-10-10 11:46:12 +03:00
iris.elf: mips/entry.o $(subst .cc,.o,$(iris_sources)) mips/nanonote/threadlist.o mips/boot.o $(subst .cc,.o,$(boot_sources))
$(LD) $(LDFLAGS) $^ -o $@
mips/start.elf: mips/start.o
$(LD) $(LDFLAGS) $^ -o $@
2009-12-26 15:17:06 +02:00
server:
while mips/nanonote/server/usb-server ; do : ; done
2009-12-31 12:22:25 +02:00
servers:
while : ; do $(MAKE) server ; done
2010-01-16 17:13:54 +02:00
setup:
x-terminal-emulator -e make debug &
x-terminal-emulator -e make servers &
2010-01-16 17:13:54 +02:00
ARCH_CLEAN_FILES = $(boot_sources) $(addsuffix .elf,$(boot_threads)) $(arch_headers) devices.hh keys.hh mips/*.o mips/nanonote/*.o source/charset.data iris.elf iris.raw mips/nanonote/sdram-setup.elf mips/nanonote/sdram-setup.raw mips/start.elf mips/start.raw
2009-12-11 10:43:42 +02:00
.PRECIOUS: mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh
2010-01-16 17:13:54 +02:00
.PHONY: test all monitor server servers setup