1 # $Id: Makefile,v 1.28 2005/03/17 10:44:37 larsv Exp $
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 # A bug in ld prevents us from having a (constant-value) symbol in a
14 # "ORIGIN =" or "LENGTH =" expression.
17 arch-$(CONFIG_ETRAX_ARCH_V10) := v10
18 arch-$(CONFIG_ETRAX_ARCH_V32) := v32
20 # No config avaiable for make clean etc
22 SARCH := arch-$(arch-y)
27 LD = $(CROSS_COMPILE)ld -mcrislinux
29 OBJCOPYFLAGS := -O binary -R .note -R .comment -S
31 CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
34 CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe
36 ifdef CONFIG_FRAME_POINTER
37 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
38 CFLAGS += -fno-omit-frame-pointer
41 head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
43 LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a)
45 core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
46 core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
47 drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
48 libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
51 SRC_ARCH = $(srctree)/arch/$(ARCH)
52 # cris object files path
53 OBJ_ARCH = $(objtree)/arch/$(ARCH)
55 target_boot_arch_dir = $(OBJ_ARCH)/$(SARCH)/boot
56 target_boot_dir = $(OBJ_ARCH)/boot
57 src_boot_dir = $(SRC_ARCH)/boot
58 target_compressed_dir = $(OBJ_ARCH)/boot/compressed
59 src_compressed_dir = $(SRC_ARCH)/boot/compressed
60 target_rescue_dir = $(OBJ_ARCH)/boot/rescue
61 src_rescue_dir = $(SRC_ARCH)/boot/rescue
63 export target_boot_arch_dir target_boot_dir src_boot_dir target_compressed_dir src_compressed_dir target_rescue_dir src_rescue_dir
66 $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
69 cat vmlinux.bin cramfs.img >timage
72 cp vmlinux.bin simvmlinux.bin
74 # the following will remake timage without compiling the kernel
75 # it does of course require that all object files exist...
78 ## cramfs - Creates a cramfs image
79 mkcramfs -b 8192 -m romfs_meta.txt root cramfs.img
80 cat vmlinux.bin cramfs.img >timage
82 clinux: vmlinux.bin decompress.bin rescue.bin
84 decompress.bin: $(target_boot_dir)
85 @$(MAKE) -f $(src_compressed_dir)/Makefile $(target_compressed_dir)/decompress.bin
87 $(target_rescue_dir)/rescue.bin: $(target_boot_dir)
88 @$(MAKE) -f $(src_rescue_dir)/Makefile $(target_rescue_dir)/rescue.bin
90 zImage: $(target_boot_dir) vmlinux.bin $(target_rescue_dir)/rescue.bin
91 ## zImage - Compressed kernel (gzip)
92 @$(MAKE) -f $(src_boot_dir)/Makefile zImage
94 $(target_boot_dir): $(target_boot_arch_dir)
97 $(target_boot_arch_dir):
104 @if [ -d arch/$(ARCH)/boot ]; then \
105 $(MAKE) $(clean)=arch/$(ARCH)/boot ; \
107 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img
108 rm -rf $(LD_SCRIPT).tmp
110 prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch \
111 include/asm-$(ARCH)/$(SARCH)/offset.h
113 # Create some links to make all tools happy
115 @rm -rf $(SRC_ARCH)/drivers
116 @ln -sfn $(SRC_ARCH)/$(SARCH)/drivers $(SRC_ARCH)/drivers
117 @rm -rf $(SRC_ARCH)/boot
118 @ln -sfn $(SRC_ARCH)/$(SARCH)/boot $(SRC_ARCH)/boot
119 @rm -rf $(SRC_ARCH)/lib
120 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
121 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
122 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
125 # Create link to sub arch includes
126 $(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
127 @echo ' Making $(srctree)/include/asm-$(ARCH)/arch -> $(srctree)/include/asm-$(ARCH)/$(SARCH) symlink'
128 @rm -f include/asm-$(ARCH)/arch
129 @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch
132 arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
133 include/config/MARKER
135 include/asm-$(ARCH)/$(SARCH)/offset.h: arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s
136 $(call filechk,gen-asm-offsets)