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>
7 # (1) For machines that do not want to use the ELF image directly (including
8 # stripping just the ELF header off), they must set the variables
9 # zimage-$(CONFIG_MACHINE) and zimagerd-$(CONFIG_MACHINE) to the target
10 # that produces the desired image and they must set end-$(CONFIG_MACHINE)
11 # to what will be suffixed to the image filename.
12 # (2) Regardless of (1), to have the resulting image be something other
13 # than 'zImage.elf', set end-$(CONFIG_MACHINE) to be the suffix used for
14 # the zImage, znetboot, and znetbootrd targets.
15 # (3) For machine targets which use the mktree program, you can optionally
16 # set entrypoint-$(CONFIG_MACHINE) to the location which the image should be
17 # loaded at. The optimal setting for entrypoint-$(CONFIG_MACHINE) is the link
19 # (4) It is advisable to pass in the memory size using BI_MEMSIZE and
20 # get_mem_size(), which is memory controller dependent. Add in the correct
21 # XXX_memory.o file for this to work, as well as editing the
22 # misc-$(CONFIG_MACHINE) variable.
25 common
:= $(boot
)/common
26 utils
:= $(boot
)/utils
27 bootlib
:= $(boot
)/lib
28 images
:= $(boot
)/images
29 of1275
:= $(boot
)/of1275
32 # Normally, we use the 'misc.c' file for decompress_kernel and
33 # whatnot. Sometimes we need to override this however.
36 # Normally, we have our images end in .elf, but something we want to
40 # Additionally, we normally don't need to mess with the L2 / L3 caches
41 # if present on 'classic' PPC.
42 cacheflag-y
:= -DCLEAR_CACHES
=""
43 # This file will flush / disable the L2, and L3 if present.
44 clear_L2_L3
:= $(srctree
)/$(boot
)/simple
/clear.S
47 # See arch/ppc/kconfig and arch/ppc/platforms/Kconfig
48 # for definition of what platform each config option refer to.
49 #----------------------------------------------------------------------------
50 zimage-
$(CONFIG_CPCI690
) := zImage-STRIPELF
51 zimageinitrd-
$(CONFIG_CPCI690
) := zImage.initrd-STRIPELF
52 extra.o-
$(CONFIG_CPCI690
) := misc-cpci690.o
53 end-
$(CONFIG_CPCI690
) := cpci690
54 cacheflag-
$(CONFIG_CPCI690
) := -include $(clear_L2_L3
)
56 zimage-
$(CONFIG_IBM_OPENBIOS
) := zImage-TREE
57 zimageinitrd-
$(CONFIG_IBM_OPENBIOS
) := zImage.initrd-TREE
58 end-
$(CONFIG_IBM_OPENBIOS
) := treeboot
59 misc-
$(CONFIG_IBM_OPENBIOS
) := misc-embedded.o
61 end-
$(CONFIG_EMBEDDEDBOOT
) := embedded
62 misc-
$(CONFIG_EMBEDDEDBOOT
) := misc-embedded.o
64 zimage-
$(CONFIG_BAMBOO
) := zImage-TREE
65 zimageinitrd-
$(CONFIG_BAMBOO
) := zImage.initrd-TREE
66 end-
$(CONFIG_BAMBOO
) := bamboo
67 entrypoint-
$(CONFIG_BAMBOO
) := 0x01000000
68 extra.o-
$(CONFIG_BAMBOO
) := pibs.o
70 zimage-
$(CONFIG_EBONY
) := zImage-TREE
71 zimageinitrd-
$(CONFIG_EBONY
) := zImage.initrd-TREE
72 end-
$(CONFIG_EBONY
) := ebony
73 entrypoint-
$(CONFIG_EBONY
) := 0x01000000
74 extra.o-
$(CONFIG_EBONY
) := openbios.o
76 zimage-
$(CONFIG_LUAN
) := zImage-TREE
77 zimageinitrd-
$(CONFIG_LUAN
) := zImage.initrd-TREE
78 end-
$(CONFIG_LUAN
) := luan
79 entrypoint-
$(CONFIG_LUAN
) := 0x01000000
80 extra.o-
$(CONFIG_LUAN
) := pibs.o
82 zimage-
$(CONFIG_YUCCA
) := zImage-TREE
83 zimageinitrd-
$(CONFIG_YUCCA
) := zImage.initrd-TREE
84 end-
$(CONFIG_YUCCA
) := yucca
85 entrypoint-
$(CONFIG_YUCCA
) := 0x01000000
86 extra.o-
$(CONFIG_YUCCA
) := pibs.o
88 zimage-
$(CONFIG_OCOTEA
) := zImage-TREE
89 zimageinitrd-
$(CONFIG_OCOTEA
) := zImage.initrd-TREE
90 end-
$(CONFIG_OCOTEA
) := ocotea
91 entrypoint-
$(CONFIG_OCOTEA
) := 0x01000000
92 extra.o-
$(CONFIG_OCOTEA
) := pibs.o
94 extra.o-
$(CONFIG_EV64260
) := misc-ev64260.o
95 end-
$(CONFIG_EV64260
) := ev64260
96 cacheflag-
$(CONFIG_EV64260
) := -include $(clear_L2_L3
)
98 extra.o-
$(CONFIG_CHESTNUT
) := misc-chestnut.o
99 end-
$(CONFIG_CHESTNUT
) := chestnut
101 zimage-
$(CONFIG_GEMINI
) := zImage-STRIPELF
102 zimageinitrd-
$(CONFIG_GEMINI
) := zImage.initrd-STRIPELF
103 end-
$(CONFIG_GEMINI
) := gemini
105 extra.o-
$(CONFIG_KATANA
) := misc-katana.o
106 end-
$(CONFIG_KATANA
) := katana
107 cacheflag-
$(CONFIG_KATANA
) := -include $(clear_L2_L3
)
109 extra.o-
$(CONFIG_RADSTONE_PPC7D
) := misc-radstone_ppc7d.o
110 end-
$(CONFIG_RADSTONE_PPC7D
) := radstone_ppc7d
111 cacheflag-
$(CONFIG_RADSTONE_PPC7D
) := -include $(clear_L2_L3
)
113 extra.o-
$(CONFIG_EV64360
) := misc-ev64360.o
114 end-
$(CONFIG_EV64360
) := ev64360
115 cacheflag-
$(CONFIG_EV64360
) := -include $(clear_L2_L3
)
117 # kconfig 'feature', only one of these will ever be 'y' at a time.
118 # The rest will be unset.
119 motorola
:= $(CONFIG_MVME5100
)$(CONFIG_PRPMC750
) \
120 $(CONFIG_PRPMC800
)$(CONFIG_LOPEC
)$(CONFIG_PPLUS
)
121 motorola
:= $(strip $(motorola
))
123 zimage-
$(motorola
) := zImage-PPLUS
124 zimageinitrd-
$(motorola
) := zImage.initrd-PPLUS
125 end-
$(motorola
) := pplus
127 # Overrides previous assingment
128 extra.o-
$(CONFIG_PPLUS
) := prepmap.o
129 extra.o-
$(CONFIG_LOPEC
) := mpc10x_memory.o
131 # Really only valid if CONFIG_6xx=y
132 zimage-
$(CONFIG_PPC_PREP
) := zImage-PPLUS
133 zimageinitrd-
$(CONFIG_PPC_PREP
) := zImage.initrd-PPLUS
134 ifeq ($(CONFIG_6xx
),y
)
135 extra.o-
$(CONFIG_PPC_PREP
) := prepmap.o
136 misc-
$(CONFIG_PPC_PREP
) += misc-prep.o mpc10x_memory.o
138 end-
$(CONFIG_PPC_PREP
) := prep
140 end-
$(CONFIG_SANDPOINT
) := sandpoint
141 cacheflag-
$(CONFIG_SANDPOINT
) := -include $(clear_L2_L3
)
143 zimage-
$(CONFIG_SPRUCE
) := zImage-TREE
144 zimageinitrd-
$(CONFIG_SPRUCE
) := zImage.initrd-TREE
145 end-
$(CONFIG_SPRUCE
) := spruce
146 entrypoint-
$(CONFIG_SPRUCE
) := 0x00800000
147 misc-
$(CONFIG_SPRUCE
) += misc-spruce.o
149 zimage-
$(CONFIG_LITE5200
) := zImage-STRIPELF
150 zimageinitrd-
$(CONFIG_LITE5200
) := zImage.initrd-STRIPELF
151 end-
$(CONFIG_LITE5200
) := lite5200
152 cacheflag-
$(CONFIG_LITE5200
) := -include $(clear_L2_L3
)
155 # SMP images should have a '.smp' suffix.
156 end-
$(CONFIG_SMP
) := $(end-y
).smp
158 # This is a treeboot that needs init functions until the
159 # boot rom is sorted out (i.e. this is short lived)
160 EXTRA_AFLAGS
:= $(extra-aflags-y
)
161 # head.o needs to get the cacheflags defined.
162 AFLAGS_head.o
+= $(cacheflag-y
)
164 # Linker args. This specifies where the image will be run at.
165 LD_ARGS
:= -T
$(srctree
)/$(boot
)/ld.script \
166 -Ttext
$(CONFIG_BOOT_LOAD
) -Bstatic
167 OBJCOPY_ARGS
:= -O elf32-powerpc
169 # head.o and relocate.o must be at the start.
170 boot-y
:= head.o relocate.o
$(extra.o-y
) $(misc-y
)
171 boot-
$(CONFIG_40x
) += embed_config.o
172 boot-
$(CONFIG_8xx
) += embed_config.o
173 boot-
$(CONFIG_8260
) += embed_config.o
174 boot-
$(CONFIG_BSEIP
) += iic.o
175 boot-
$(CONFIG_MBX
) += iic.o pci.o qspan_pci.o
176 boot-
$(CONFIG_MV64X60
) += misc-mv64x60.o
177 boot-
$(CONFIG_RPXCLASSIC
) += iic.o pci.o qspan_pci.o
178 boot-
$(CONFIG_RPXLITE
) += iic.o
179 # Different boards need different serial implementations.
180 ifeq ($(CONFIG_SERIAL_CPM_CONSOLE
),y
)
181 boot-
$(CONFIG_8xx
) += m8xx_tty.o
182 boot-
$(CONFIG_8260
) += m8260_tty.o
184 boot-
$(CONFIG_SERIAL_MPC52xx_CONSOLE
) += mpc52xx_tty.o
185 boot-
$(CONFIG_SERIAL_MPSC_CONSOLE
) += mv64x60_tty.o
187 LIBS
:= $(common
)/lib.a
$(bootlib
)/lib.a
188 ifeq ($(CONFIG_PPC_PREP
),y
)
189 LIBS
+= $(of1275
)/lib.a
192 OBJS
:= $(addprefix $(obj
)/,$(boot-y
))
195 MKBUGBOOT
:= $(utils
)/mkbugboot
196 MKPREP
:= $(utils
)/mkprep
197 MKTREE
:= $(utils
)/mktree
201 $(obj
)/zvmlinux
: $(OBJS
) $(LIBS
) $(srctree
)/$(boot
)/ld.script \
202 $(images
)/vmlinux.gz
$(obj
)/dummy.o
203 $(OBJCOPY
) $(OBJCOPY_ARGS
) \
204 --add-section
=.image
=$(images
)/vmlinux.gz \
205 --set-section-flags
=.image
=contents
,alloc
,load
,readonly
,data \
206 $(obj
)/dummy.o
$(obj
)/image.o
207 $(LD
) $(LD_ARGS
) -o
$@
$(OBJS
) $(obj
)/image.o
$(LIBS
)
208 $(OBJCOPY
) $(OBJCOPY_ARGS
) $@
$@
-R .comment
-R .stab \
209 -R .stabstr
-R .ramdisk
211 $(obj
)/zvmlinux.initrd
: $(OBJS
) $(LIBS
) $(srctree
)/$(boot
)/ld.script \
212 $(images
)/vmlinux.gz
$(obj
)/dummy.o
213 $(OBJCOPY
) $(OBJCOPY_ARGS
) \
214 --add-section
=.ramdisk
=$(images
)/ramdisk.image.gz \
215 --set-section-flags
=.ramdisk
=contents
,alloc
,load
,readonly
,data \
216 --add-section
=.image
=$(images
)/vmlinux.gz \
217 --set-section-flags
=.image
=contents
,alloc
,load
,readonly
,data \
218 $(obj
)/dummy.o
$(obj
)/image.o
219 $(LD
) $(LD_ARGS
) -o
$@
$(OBJS
) $(obj
)/image.o
$(LIBS
)
220 $(OBJCOPY
) $(OBJCOPY_ARGS
) $@
$@
-R .comment
-R .stab \
223 # Sort-of dummy rules, that let us format the image we want.
224 zImage
: $(images
)/$(zimage-y
) $(obj
)/zvmlinux
225 cp
-f
$(obj
)/zvmlinux
$(images
)/zImage.elf
226 rm -f
$(obj
)/zvmlinux
228 zImage.initrd
: $(images
)/$(zimageinitrd-y
) $(obj
)/zvmlinux.initrd
229 cp
-f
$(obj
)/zvmlinux.initrd
$(images
)/zImage.initrd.elf
230 rm -f
$(obj
)/zvmlinux.initrd
233 cp
$(images
)/zImage.
$(end-y
) $(tftpboot
)/zImage.
$(end-y
)
235 znetboot.initrd
: zImage.initrd
236 cp
$(images
)/zImage.initrd.
$(end-y
) $(tftpboot
)/zImage.initrd.
$(end-y
)
238 $(images
)/zImage-STRIPELF
: $(obj
)/zvmlinux
239 dd if
=$(obj
)/zvmlinux of
=$(images
)/zImage.
$(end-y
) skip
=64 bs
=1k
241 $(images
)/zImage.initrd-STRIPELF
: $(obj
)/zvmlinux.initrd
242 dd if
=$(obj
)/zvmlinux.initrd of
=$(images
)/zImage.initrd.
$(end-y
) \
245 $(images
)/zImage-TREE
: $(obj
)/zvmlinux
$(MKTREE
)
246 $(MKTREE
) $(obj
)/zvmlinux
$(images
)/zImage.
$(end-y
) $(ENTRYPOINT
)
248 $(images
)/zImage.initrd-TREE
: $(obj
)/zvmlinux.initrd
$(MKTREE
)
249 $(MKTREE
) $(obj
)/zvmlinux.initrd
$(images
)/zImage.initrd.
$(end-y
) \
252 $(images
)/zImage-PPLUS
: $(obj
)/zvmlinux
$(MKPREP
) $(MKBUGBOOT
)
253 $(MKPREP
) -pbp
$(obj
)/zvmlinux
$(images
)/zImage.
$(end-y
)
254 $(MKBUGBOOT
) $(obj
)/zvmlinux
$(images
)/zImage.bugboot
256 $(images
)/zImage.initrd-PPLUS
: $(obj
)/zvmlinux.initrd
$(MKPREP
) $(MKBUGBOOT
)
257 $(MKPREP
) -pbp
$(obj
)/zvmlinux.initrd
$(images
)/zImage.initrd.
$(end-y
)
258 $(MKBUGBOOT
) $(obj
)/zvmlinux.initrd
$(images
)/zImage.initrd.bugboot