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.
4 # Author: Tom Rini <trini@mvista.com>
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
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.
18 USE_STANDARD_AS_RULE := true
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
29 ifeq ($(CONFIG_IBM_OPENBIOS),y)
31 ZIMAGEINITRD := zImage.initrd-TREE
33 TFTPIMAGE := /tftpboot/zImage.embedded
34 MISC := misc-embedded.o
36 ifeq ($(CONFIG_EBONY),y)
38 ZIMAGEINITRD := zImage.initrd-TREE
40 ENTRYPOINT := 0x00800000
43 ifeq ($(CONFIG_OCOTEA),y)
45 ZIMAGEINITRD := zImage.initrd-TREE
47 ENTRYPOINT := 0x00800000
50 ifeq ($(CONFIG_GEMINI),y)
52 ZIMAGEINITRD := zImage.initrd-SMON
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
64 ifeq ($(CONFIG_PPLUS),y)
67 ifeq ($(CONFIG_PAL4),y)
69 ZIMAGEINITRD := zImage.initrd-PAL4
72 ifeq ($(CONFIG_SANDPOINT),y)
74 ZIMAGEINITRD := zImage.initrd-SP
75 CACHEFLAG := -include clear.S
76 TFTPIMAGE := /tftpboot/zImage.sandpoint
79 ifeq ($(CONFIG_SPRUCE),y)
81 ZIMAGEINITRD := zImage.initrd-TREE
82 ENTRYPOINT := 0x00800000
87 TFTPIMAGE ?= /tftpboot/zImage.$(END)
88 ifeq ($(CONFIG_SMP),y)
93 # Setup a default address to put ourselves, change it as needed.
94 LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic
96 LD_ARGS := -T ../ld.script -Ttext 0x00180000 -Bstatic
98 ifeq ($(CONFIG_8260)$(CONFIG_40x),y)
99 LD_ARGS := -T ../ld.script -Ttext 0x00400000 -Bstatic
101 OBJCOPY_ARGS := -O elf32-powerpc
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
122 LIBS := ../lib/zlib.a
125 MKBUGBOOT := ../utils/mkbugboot
126 MKPREP := ../utils/mkprep
127 MKTREE := ../utils/mktree
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
138 zvmlinux.initrd: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz \
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 \
150 # Sort-of dummy rules, that let us format the image we want.
153 zImage.initrd: $(ZIMAGEINITRD)
154 rm -f zvmlinux.initrd
157 cp ../images/zImage.$(END) $(TFTPIMAGE)
159 znetboot.initrd: zImage.initrd
160 cp ../images/zImage.initrd.$(END) $(TFTPIMAGE)
162 zImage-EMBEDDED: zvmlinux
163 mv zvmlinux ../images/zImage.$(END)
165 zImage.initrd-EMBEDDED: zvmlinux.initrd
166 mv zvmlinux.initrd ../images/zImage.initrd.$(END)
168 zImage-PAL4: zvmlinux
169 mv zvmlinux ../images/zImage.$(END)
171 zImage.initrd-PAL4: zvmlinux.initrd
172 mv zvmlinux.initrd ../images/zImage.initrd.$(END)
174 zImage-PPLUS: zvmlinux $(MKPREP) $(MKBUGBOOT)
175 $(MKPREP) -pbp zvmlinux ../images/zImage.pplus
176 $(MKBUGBOOT) zvmlinux ../images/zImage.bugboot
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
183 mv zvmlinux ../images/zImage.sandpoint
185 zImage.initrd-SP: zvmlinux.initrd
186 mv zvmlinux.initrd ../images/zImage.initrd.sandpoint
188 zImage-SMON: zvmlinux
189 dd if=zvmlinux of=../images/zImage.$(END) skip=64 bs=1k
191 zImage.initrd-SMON: zvmlinux.initrd
192 dd if=zvmlinux.initrd of=../images/zImage.initrd.$(END) skip=64 bs=1k
194 zImage-TREE: zvmlinux
195 $(MKTREE) zvmlinux ../images/zImage.$(END) $(ENTRYPOINT)
197 zImage.initrd-TREE: zvmlinux.initrd
198 $(MKTREE) zvmlinux.initrd ../images/zImage.initrd.$(END) $(ENTRYPOINT)
200 include $(TOPDIR)/Rules.make