2009-06-01 15:26:42 +03:00
|
|
|
# Iris: micro-kernel for a capability-based operating system.
|
|
|
|
# mips/Makefile.arch: mips-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/>.
|
|
|
|
|
|
|
|
load = 0x80000000
|
|
|
|
|
2009-06-08 14:46:13 +03:00
|
|
|
ARCH_CXXFLAGS = -DNUM_THREADS=1
|
2009-06-01 15:26:42 +03:00
|
|
|
ARCH_CPPFLAGS = -Imips -Wa,-mips32
|
|
|
|
CROSS = mipsel-linux-gnu-
|
|
|
|
OBJDUMP = $(CROSS)objdump
|
|
|
|
junk = mdebug.abi32 reginfo comment pdr
|
|
|
|
OBJCOPYFLAGS = $(addprefix --remove-section=.,$(junk))
|
|
|
|
|
|
|
|
arch_kernel_sources = mips/interrupts.cc mips/test.cc mips/arch.cc
|
|
|
|
boot_sources = mips/init.cc
|
|
|
|
BUILT_SOURCES = $(kernel_sources) $(boot_sources)
|
|
|
|
arch_headers = mips/arch.hh
|
2009-06-10 22:42:01 +03:00
|
|
|
boot_threads = keyboard lcd
|
2009-06-01 15:26:42 +03:00
|
|
|
|
|
|
|
uimage:
|
|
|
|
|
|
|
|
mips/entry.o: $(boot_threads)
|
|
|
|
mips/init.o: TARGET_FLAGS = -I/usr/include
|
|
|
|
$(boot_threads): TARGET_FLAGS = -I.
|
2009-06-22 18:48:05 +03:00
|
|
|
$(boot_threads): mips/jz4730.hh boot-programs/devices.hh
|
2009-06-01 15:26:42 +03:00
|
|
|
|
|
|
|
# Transform ':' into ';' so vim doesn't think there are errors.
|
|
|
|
uimage: kernel.raw.gz Makefile mips/Makefile.arch
|
|
|
|
mkimage -A MIPS -O Linux -C gzip -a $(load) -e 0x$(shell /bin/sh -c '$(OBJDUMP) -t kernel | grep __start$$ | cut -b-8') -n "Shevek's kernel" -d $< $@ | sed -e 's/:/;/g'
|
|
|
|
|
|
|
|
%.o:%.S Makefile mips/Makefile.arch mips/arch.hh
|
|
|
|
$(CC) $(CPPFLAGS) $(TARGET_FLAGS) -DKERNEL_STACK_SIZE=0x2000 -c $< -o $@
|
|
|
|
|
|
|
|
# entry.o must be the first file. boot.o must be the first of the init objects (which can be freed after loading).
|
|
|
|
kernel: mips/entry.o $(subst .cc,.o,$(kernel_sources)) mips/boot.o $(subst .cc,.o,$(boot_sources))
|
|
|
|
$(LD) --omagic -Ttext $(load) $^ -o $@
|
|
|
|
|
|
|
|
%.raw: %
|
|
|
|
$(OBJCOPY) -S $(addprefix --remove-section=.,$(junk)) -Obinary $< $@
|
|
|
|
|
|
|
|
%.gz: %
|
|
|
|
gzip < $< > $@
|
|
|
|
|
2009-06-08 14:46:13 +03:00
|
|
|
ARCH_CLEAN_FILES = uimage kernel kernel.raw kernel.raw.gz $(boot_threads) mips/*.o
|