X-Loader: Add SignGP support
[pandora-x-loader.git] / Makefile
1 #
2 # (C) Copyright 2004-2006, Texas Instruments, <www.ti.com>
3 # Jian Zhang <jzhang@ti.com>
4 #
5 # (C) Copyright 2000-2004
6 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 #
8 # See file CREDITS for list of people who contributed to this
9 # project.
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation; either version 2 of
14 # the License, or (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 # MA 02111-1307 USA
25 #
26
27 HOSTARCH := $(shell uname -m | \
28         sed -e s/i.86/i386/ \
29             -e s/sun4u/sparc64/ \
30             -e s/arm.*/arm/ \
31             -e s/sa110/arm/ \
32             -e s/powerpc/ppc/ \
33             -e s/macppc/ppc/)
34
35 HOSTOS := $(shell uname -s | tr A-Z a-z | \
36             sed -e 's/\(cygwin\).*/cygwin/')
37
38 export  HOSTARCH
39
40 # Deal with colliding definitions from tcsh etc.
41 VENDOR=
42
43 #########################################################################
44
45 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
46 export  TOPDIR
47
48 ifeq (include/config.mk,$(wildcard include/config.mk))
49 # load ARCH, BOARD, and CPU configuration
50 include include/config.mk
51 export  ARCH CPU BOARD VENDOR
52 # load other configuration
53 include $(TOPDIR)/config.mk
54
55 ifndef CROSS_COMPILE
56 CROSS_COMPILE = arm-none-linux-gnueabi-
57 #CROSS_COMPILE = arm-linux-
58 export  CROSS_COMPILE
59 endif
60
61 #########################################################################
62 # X-LOAD objects....order is important (i.e. start must be first)
63
64 OBJS  = cpu/$(CPU)/start.o
65  
66
67 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
68 LIBS += cpu/$(CPU)/lib$(CPU).a
69 LIBS += lib/lib$(ARCH).a
70 LIBS += fs/fat/libfat.a
71 LIBS += disk/libdisk.a
72 LIBS += drivers/libdrivers.a
73 LIBS += common/libcommon.a
74 .PHONY : $(LIBS)
75
76 # Add GCC lib
77 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
78
79 SUBDIRS =  
80 #########################################################################
81 #########################################################################
82
83 ALL = x-load.bin System.map
84
85 all:            $(ALL)
86
87 ift:    $(ALL) x-load.bin.ift
88
89 x-load.bin.ift: signGP System.map x-load.bin
90         TEXT_BASE=`grep -w _start System.map|cut -d ' ' -f1`
91         ./signGP x-load.bin $(TEXT_BASE)
92  
93 x-load.bin:     x-load
94                 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
95  
96 x-load: $(OBJS) $(LIBS) $(LDSCRIPT)
97                 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
98                 $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
99                         --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
100                         -Map x-load.map -o x-load
101  
102 $(LIBS):
103                 $(MAKE) -C `dirname $@`
104
105   
106 System.map:     x-load
107                 @$(NM) $< | \
108                 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
109                 sort > System.map
110
111 oneboot:        x-load.bin
112                 scripts/mkoneboot.sh
113
114 signGP:         scripts/signGP.c
115                 gcc -O3 -o signGP  $<
116
117 #########################################################################
118 else
119 all install x-load x-load.srec oneboot depend dep:
120         @echo "System not configured - see README" >&2
121         @ exit 1
122 endif
123
124 #########################################################################
125
126 unconfig:
127         rm -f include/config.h include/config.mk
128
129 #========================================================================
130 # ARM
131 #========================================================================
132 #########################################################################
133 ## OMAP1 (ARM92xT) Systems
134 #########################################################################
135
136 omap1710h3_config :    unconfig
137         @./mkconfig $(@:_config=) arm arm926ejs omap1710h3
138
139 #########################################################################
140 ## OMAP2 (ARM1136) Systems
141 #########################################################################
142
143 omap2420h4_config :    unconfig
144         @./mkconfig $(@:_config=) arm arm1136 omap2420h4
145
146 omap2430sdp_config :    unconfig
147         @./mkconfig $(@:_config=) arm arm1136 omap2430sdp
148
149 #########################################################################
150 ## OMAP3 (ARM-CortexA8) Systems
151 #########################################################################
152 omap3430sdp_config :    unconfig
153         @./mkconfig $(@:_config=) arm omap3 omap3430sdp
154
155 omap3430labrador_config :    unconfig
156         @./mkconfig $(@:_config=) arm omap3 omap3430labrador
157
158 omap3evm_config :       unconfig
159         @./mkconfig $(@:_config=) arm omap3 omap3evm
160
161 overo_config :  unconfig
162         @./mkconfig $(@:_config=) arm omap3 overo
163
164 omap3530beagle_config :    unconfig
165         @./mkconfig $(@:_config=) arm omap3 omap3530beagle
166
167 #########################################################################
168 ## OMAP4 (ARM-CortexA9) Systems
169 #########################################################################
170 omap4430panda_config :    unconfig
171         @./mkconfig $(@:_config=) arm omap4 omap4430panda
172
173 #########################################################################
174
175 clean:
176         find . -type f \
177                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
178                 -o -name '*.o'  -o -name '*.a'  \) -print \
179                 | xargs rm -f
180  
181 clobber:        clean
182         find . -type f \
183                 \( -name .depend -o -name '*.srec' -o -name '*.bin' \) \
184                 -print \
185                 | xargs rm -f
186         rm -f $(OBJS) *.bak tags TAGS
187         rm -fr *.*~
188         rm -f x-load x-load.map $(ALL) x-load.bin.ift signGP
189         rm -f include/asm/proc include/asm/arch
190
191 mrproper \
192 distclean:      clobber unconfig
193
194 backup:
195         F=`basename $(TOPDIR)` ; cd .. ; \
196         gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
197
198 #########################################################################