4 # This file is included by the global makefile so that you can add your own
5 # architecture-specific flags and dependencies. Remember to do have actions
6 # for "archclean" and "archdep" for cleaning up and making dependencies for
9 # This file is subject to the terms and conditions of the GNU General Public
10 # License. See the file "COPYING" in the main directory of this archive
13 LD_SCRIPT=$(TOPDIR)/arch/cris/cris.ld
15 # A bug in ld prevents us from having a (constant-value) symbol in a
16 # "ORIGIN =" or "LENGTH =" expression. We fix that by generating a
17 # linker file with the symbolic part of those expressions evaluated.
18 # Unfortunately, there is trouble making vmlinux depend on anything we
19 # generate here, so we *always* regenerate the final linker script and
20 # replace the LD macro to get what we want. Thankfully(?) vmlinux is
21 # always rebuilt (due to calling make recursively and not knowing if
22 # anything was rebuilt).
23 # The shell script to build in some kind of dependency is really not
24 # necessary for reasons of speed. It's there because always
25 # regenerating stuff (even for incremental linking of subsystems!) is
26 # even more nauseating.
27 LD = if [ ! -e $(LD_SCRIPT).tmp -o $(LD_SCRIPT) -nt $(LD_SCRIPT).tmp ]; then \
28 sed -e s/@CONFIG_ETRAX_DRAM_VIRTUAL_BASE@/0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)/ \
29 -e s/@CONFIG_ETRAX_DRAM_SIZE_M@/$(CONFIG_ETRAX_DRAM_SIZE)/ \
30 < $(LD_SCRIPT) > $(LD_SCRIPT).tmp; \
32 fi && $(CROSS_COMPILE)ld -mcrislinux
34 LINKFLAGS = -T $(LD_SCRIPT).tmp
36 # objcopy is used to make binary images from the resulting linked file
38 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
40 # -mlinux enables -march=v10, -fno-underscores, -D__linux__ among others
42 CFLAGS := $(CFLAGS) -mlinux -pipe
44 ifdef CONFIG_ETRAX_KGDB
45 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
46 CFLAGS += -fno-omit-frame-pointer
51 HEAD := arch/cris/kernel/head.o
53 SUBDIRS += arch/cris/kernel arch/cris/mm arch/cris/lib arch/cris/drivers
54 ifdef CONFIG_ETRAX_AXISFLASHMAP
55 # only build this if axis flash map is used, because they depend on
56 # each others config options
57 SUBDIRS += arch/cris/boot/rescue
60 # Note that the order of .o files below is important is some cases
61 # (because initcalls are executed in the order they are linked)
62 # Never add any driver before mm.o!
63 CORE_FILES += arch/cris/kernel/kernel.o arch/cris/mm/mm.o
64 DRIVERS += arch/cris/drivers/drivers.o
65 LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a)
66 LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LIBGCC)
68 arch/cris/kernel: dummy
69 $(MAKE) linuxsubdirs SUBDIRS=arch/cris/kernel
72 $(MAKE) linuxsubdirs SUBDIRS=arch/cris/mm
74 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
77 $(OBJCOPY) vmlinux vmlinux.bin
80 cat vmlinux.bin cramfs.img >timage
83 cp vmlinux.bin simvmlinux.bin
85 # the following will remake timage without compiling the kernel
86 # it does of course require that all object files exist...
89 ## cramfs - Creates a cramfs image
90 mkcramfs -b 8192 -m romfs_meta.txt root cramfs.img
91 cat vmlinux.bin cramfs.img >timage
93 clinux: vmlinux.bin decompress.bin rescue.bin
96 @make -C arch/cris/boot/compressed decompress.bin
99 @make -C arch/cris/boot/rescue rescue.bin
102 ## zImage - Compressed kernel (gzip)
109 rm -f timage vmlinux.bin cramfs.img
110 rm -rf $(LD_SCRIPT).tmp