more changes on original files
[linux-2.4.git] / arch / ppc / boot / simple / Makefile
1 # This is far from simple, but I couldn't think of a good name.  This is
2 # for making the 'zImage' or 'zImage.initrd' on a number of targets.
3 #
4 # Author: Tom Rini <trini@mvista.com>
5 #
6 # 2001-2002 (c) MontaVista, Software, Inc.  This file is licensed under
7 # the terms of the GNU General Public License version 2.  This program
8 # is licensed "as is" without any warranty of any kind, whether express
9 # or implied.
10 #
11 # Notes:
12 # (1) All machines must set the END variable to the suffix of the preferred
13 # final image (i.e. would be copied in 'make znetboot'.
14 # (2) For machine targets which use the mktree program you can optionally
15 # set ENTRYPOINT which the image should be loaded at.  The optimal setting
16 # for ENTRYPOINT is the link address.
17
18 USE_STANDARD_AS_RULE            := true
19
20 # Normally, we use the 'misc-simple.c' file for decompress_kernel and
21 # whatnot.  Sometimes we need to override this however.
22 MISC                            := ../common/misc-simple.o
23 ifeq ($(CONFIG_EMBEDDEDBOOT),y)
24 ZIMAGE                          := zImage-EMBEDDED
25 ZIMAGEINITRD                    := zImage.initrd-EMBEDDED
26 MISC                            := misc-embedded.o
27 END                             := embedded
28 endif
29 ifeq ($(CONFIG_IBM_OPENBIOS),y)
30 ZIMAGE                          := zImage-TREE
31 ZIMAGEINITRD                    := zImage.initrd-TREE
32 END                             := treeboot
33 TFTPIMAGE                       := /tftpboot/zImage.embedded
34 MISC                            := misc-embedded.o
35 endif
36 ifeq ($(CONFIG_EBONY),y)
37 ZIMAGE                          := zImage-TREE
38 ZIMAGEINITRD                    := zImage.initrd-TREE
39 END                             := ebony
40 ENTRYPOINT                      := 0x00800000
41 EXTRA                           := misc-44x.o
42 endif
43 ifeq ($(CONFIG_OCOTEA),y)
44 ZIMAGE                          := zImage-TREE
45 ZIMAGEINITRD                    := zImage.initrd-TREE
46 END                             := ocotea
47 ENTRYPOINT                      := 0x00800000
48 EXTRA                           := misc-44x.o
49 endif
50 ifeq ($(CONFIG_GEMINI),y)
51 ZIMAGE                          := zImage-SMON
52 ZIMAGEINITRD                    := zImage.initrd-SMON
53 END                             := gemini
54 endif
55 # kbuild-2.4 'feature', only one of these will ever by 'y' at a time.
56 # The rest will be unset.
57 ifeq ($(CONFIG_LOPEC)$(CONFIG_PPLUS)$(CONFIG_PRPMC750),y)
58 ZIMAGE                          := zImage-PPLUS
59 ZIMAGEINITRD                    := zImage.initrd-PPLUS
60 EXTRA                           := ../common/mpc10x_memory.o
61 TFTPIMAGE                       := /tftpboot/zImage.pplus
62 END                             := pplus
63 endif
64 ifeq ($(CONFIG_PPLUS),y)
65 EXTRA                           := legacy.o
66 endif
67 ifeq ($(CONFIG_PAL4),y)
68 ZIMAGE                          := zImage-PAL4
69 ZIMAGEINITRD                    := zImage.initrd-PAL4
70 END                             := pal4
71 endif
72 ifeq ($(CONFIG_SANDPOINT),y)
73 ZIMAGE                          := zImage-SP
74 ZIMAGEINITRD                    := zImage.initrd-SP
75 CACHEFLAG                       := -include clear.S
76 TFTPIMAGE                       := /tftpboot/zImage.sandpoint
77 END                             := sandpoint
78 endif
79 ifeq ($(CONFIG_SPRUCE),y)
80 ZIMAGE                          := zImage-TREE
81 ZIMAGEINITRD                    := zImage.initrd-TREE
82 ENTRYPOINT                      := 0x00800000
83 MISC                            := misc-spruce.o
84 END                             := spruce
85 endif
86
87 TFTPIMAGE                       ?= /tftpboot/zImage.$(END)
88 ifeq ($(CONFIG_SMP),y)
89 TFTPIMAGE                       += .smp
90 endif
91
92
93 # Setup a default address to put ourselves, change it as needed.
94 LD_ARGS                         = -T ../ld.script -Ttext 0x00800000 -Bstatic
95 ifdef CONFIG_8xx
96 LD_ARGS                         := -T ../ld.script -Ttext 0x00180000 -Bstatic
97 endif
98 ifeq ($(CONFIG_8260)$(CONFIG_40x),y)
99 LD_ARGS                         := -T ../ld.script -Ttext 0x00400000 -Bstatic
100 endif
101 OBJCOPY_ARGS                    := -O elf32-powerpc
102
103 # head.o and ../common/relocate.o must be at the start.
104 obj-y                           := head.o ../common/relocate.o $(EXTRA) \
105                                 $(MISC) ../common/misc-common.o \
106                                 ../common/string.o ../common/util.o \
107                                 ../common/serial_stub.o
108 obj-$(CONFIG_40x)               += embed_config.o
109 obj-$(CONFIG_8xx)               += embed_config.o
110 obj-$(CONFIG_8260)              += embed_config.o
111 obj-$(CONFIG_BSEIP)             += iic.o
112 obj-$(CONFIG_MBX)               += iic.o
113 obj-$(CONFIG_RPXCLASSIC)        += iic.o
114 obj-$(CONFIG_RPXLITE)           += iic.o
115 # Different boards need different serial implementations.
116 ifeq ($(CONFIG_SERIAL_CONSOLE),y)
117 obj-$(CONFIG_8xx)               += m8xx_tty.o
118 obj-$(CONFIG_8260)              += m8260_tty.o
119 obj-$(CONFIG_SERIAL)            += ../common/ns16550.o
120 endif
121
122 LIBS                            := ../lib/zlib.a
123
124 # Tools
125 MKBUGBOOT                       := ../utils/mkbugboot
126 MKPREP                          := ../utils/mkprep
127 MKTREE                          := ../utils/mktree
128
129 zvmlinux: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o
130         $(OBJCOPY) $(OBJCOPY_ARGS) \
131                 --add-section=.image=../images/vmlinux.gz \
132                 --set-section-flags=.image=contents,alloc,load,readonly,data \
133                 ../common/dummy.o image.o
134         $(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
135         $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
136                 -R .ramdisk -R .sysmap
137
138 zvmlinux.initrd: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz \
139                 ../common/dummy.o
140         $(OBJCOPY) $(OBJCOPY_ARGS) \
141                 --add-section=.ramdisk=../images/ramdisk.image.gz \
142                 --set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
143                 --add-section=.image=../images/vmlinux.gz \
144                 --set-section-flags=.image=contents,alloc,load,readonly,data \
145                 ../common/dummy.o image.o
146         $(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
147         $(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
148                 -R .sysmap
149
150 # Sort-of dummy rules, that let us format the image we want.
151 zImage: $(ZIMAGE)
152         rm -f zvmlinux
153 zImage.initrd: $(ZIMAGEINITRD)
154         rm -f zvmlinux.initrd
155
156 znetboot: zImage
157         cp ../images/zImage.$(END) $(TFTPIMAGE)
158
159 znetboot.initrd: zImage.initrd
160         cp ../images/zImage.initrd.$(END) $(TFTPIMAGE)
161
162 zImage-EMBEDDED: zvmlinux
163         mv zvmlinux ../images/zImage.$(END)
164
165 zImage.initrd-EMBEDDED: zvmlinux.initrd
166         mv zvmlinux.initrd ../images/zImage.initrd.$(END)
167
168 zImage-PAL4: zvmlinux
169         mv zvmlinux ../images/zImage.$(END)
170
171 zImage.initrd-PAL4: zvmlinux.initrd
172         mv zvmlinux.initrd ../images/zImage.initrd.$(END)
173
174 zImage-PPLUS: zvmlinux $(MKPREP) $(MKBUGBOOT)
175         $(MKPREP) -pbp zvmlinux ../images/zImage.pplus
176         $(MKBUGBOOT) zvmlinux ../images/zImage.bugboot
177
178 zImage.initrd-PPLUS: zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
179         $(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.pplus
180         $(MKBUGBOOT) zvmlinux.initrd ../images/zImage.initrd.bugboot
181
182 zImage-SP: zvmlinux
183         mv zvmlinux ../images/zImage.sandpoint
184
185 zImage.initrd-SP: zvmlinux.initrd
186         mv zvmlinux.initrd ../images/zImage.initrd.sandpoint
187
188 zImage-SMON: zvmlinux
189         dd if=zvmlinux of=../images/zImage.$(END) skip=64 bs=1k
190
191 zImage.initrd-SMON: zvmlinux.initrd
192         dd if=zvmlinux.initrd of=../images/zImage.initrd.$(END) skip=64 bs=1k
193
194 zImage-TREE: zvmlinux
195         $(MKTREE) zvmlinux ../images/zImage.$(END) $(ENTRYPOINT)
196
197 zImage.initrd-TREE: zvmlinux.initrd
198         $(MKTREE) zvmlinux.initrd ../images/zImage.initrd.$(END) $(ENTRYPOINT)
199
200 include $(TOPDIR)/Rules.make