Makefile 7.89 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
# This is far from simple, but I couldn't think of a good name.  This is
# for making the 'zImage' or 'zImage.initrd' on a number of targets.
#
# Author: Tom Rini <trini@mvista.com>
#
# Copyright 2001 MontaVista Software Inc.
#
# Notes: For machine targets which produce more than one image, define
# ZNETBOOT and ZNETBOOTRD to the image which should be available for
# 'znetboot' and 'znetboot.initrd`
#
# This program is free software; you can redistribute  it and/or modify it
# under  the terms of  the GNU General  Public License as published by the
# Free Software Foundation;  either version 2 of the  License, or (at your
# option) any later version.

USE_STANDARD_AS_RULE		:= true

# Normally, we use the 'misc-simple.c' file for decompress_kernel and
# whatnot.  Sometimes we need to override this however.
MISC				:= ../common/misc-simple.o
ifeq ($(CONFIG_TREEBOOT),y)
ZIMAGE				:= zImage-TREE
ZIMAGEINITRD			:= zImage.initrd-TREE
TFTPIMAGE			:= /tftpboot/zImage.embedded
MISC				:= misc-embedded.o
endif
ifeq ($(CONFIG_EMBEDDEDBOOT),y)
ZIMAGE				:= zImage-EMBEDDED
ZIMAGEINITRD			:= zImage.initrd-EMBEDDED
TFTPIMAGE			:= /tftpboot/zImage.embedded
MISC				:= misc-embedded.o
endif
ifeq ($(CONFIG_EV64260),y)
ZIMAGE				:= zImage-EV64260
ZIMAGEINITRD			:= zImage.initrd-EV64260
HEADHELP			:= direct.o misc-ev64260.o
TFTPIMAGE			:= /tftpboot/zImage.ev64260
endif
ifeq ($(CONFIG_GEMINI),y)
ZIMAGE				:= zImage-SMON
ZIMAGEINITRD			:= zImage.initrd-SMON
HEADHELP			:= direct.o
TFTPIMAGE			:= /tftpboot/zImage.gemini
endif
ifeq ($(CONFIG_MENF1),y)
ZIMAGE				:= zImage-MENF1
ZIMAGEINITRD			:= zImage.initrd-MENF1
HEADHELP			:= chrpmap.o
TFTPIMAGE			:= /tftpboot/zImage.menf1
endif
ifeq ($(CONFIG_K2),y)
ZIMAGE				:= zImage-K2
ZIMAGEINITRD			:= zImage.initrd-K2
HEADHELP			:= legacy.o
TFTPIMAGE			:= /tftpboot/zImage.k2
endif
# kbuild-2.4 'feature', only one of these will ever by 'y' at a time.
# The rest will be unset.
ifeq ($(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750)$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS),y)
ZIMAGE				:= zImage-PPLUS
ZIMAGEINITRD			:= zImage.initrd-PPLUS
HEADHELP			:= direct.o
TFTPIMAGE			:= /tftpboot/zImage.pplus
ZNETBOOT			:= zImage.pplus
ZNETBOOTRD			:= zImage.initrd.pplus
endif
ifeq ($(CONFIG_PPLUS),y)
HEADHELP			:= legacy.o
endif
ifeq ($(CONFIG_PCORE),y)
ZIMAGE				:= zImage-PCORE
ZIMAGEINITRD			:= zImage.initrd-PCORE
HEADHELP			:= chrpmap.o
TFTPIMAGE			:= /tftpboot/zImage.pcore
endif
#Ugh, should come up with a better nameing convention..
ifeq ($(CONFIG_POWERPMC250),y)
ZIMAGE				:= zImage-PCORE
ZIMAGEINITRD			:= zImage.initrd-PCORE
HEADHELP			:= direct.o
TFTPIMAGE			:= /tftpboot/zImage.pcore
endif
ifeq ($(CONFIG_SANDPOINT),y)
ZIMAGE				:= zImage-SP
ZIMAGEINITRD			:= zImage.initrd-SP
HEADHELP			:= direct.o
TFTPIMAGE			:= /tftpboot/zImage.sandpoint
endif
ifeq ($(CONFIG_SPRUCE),y)
ZIMAGE				:= zImage-SPRUCE
ZIMAGEINITRD			:= zImage.initrd-SPRUCE
HEADHELP			:= direct.o
MISC				:= misc-spruce.o
TFTPIMAGE			:= /tftpboot/zImage.spruce
endif
ifeq ($(CONFIG_ZX4500),y)
ZIMAGE				:= zImage-ZX4500
ZIMAGEINITRD			:= zImage.initrd-ZX4500
HEADHELP			:= direct.o
TFTPIMAGE			:= /tftpboot/zImage.zx4500
endif
ifeq ($(CONFIG_SMP),y)
TFTPIMAGE			+= .smp
endif
ifeq ($(CONFIG_REDWOOD_4),y)
# This is a treeboot that needs init functions until the
# boot rom is sorted out (i.e. this is short lived)
EXTRA_AFLAGS			:= -Wa,-m405
HEADHELP			:= rw4/rw4_init.o rw4/rw4_init_brd.o
endif

# Default linker args.  Link at 0x00800000 or 0x00400000 by default, but
# allow it to be overridden.
ifeq ($(CONFIG_BOOT_LOAD_BOOL),y)
LD_ARGS				:= -T ../ld.script -Ttext $(CONFIG_BOOT_LOAD) \
					-Bstatic
else
LD_ARGS				= -T ../ld.script -Ttext 0x00800000 -Bstatic
ifeq ($(CONFIG_8260)$(CONFIG_4xx)$(CONFIG_8xx),y)
LD_ARGS				:= -T ../ld.script -Ttext 0x00400000 -Bstatic
endif
endif
OBJCOPY_ARGS			:= -O elf32-powerpc

# head.o and ../common/relocate.o must be at the start.
obj-y				:= head.o ../common/relocate.o $(HEADHELP) \
				$(MISC) ../common/misc-common.o \
				../common/string.o ../common/util.o
obj-$(CONFIG_4xx)		+= embed_config.o
obj-$(CONFIG_8xx)		+= embed_config.o
obj-$(CONFIG_8260)		+= embed_config.o
obj-$(CONFIG_BSEIP)		+= iic.o
obj-$(CONFIG_MBX)		+= iic.o pci.o qspan_pci.o
obj-$(CONFIG_RPXCLASSIC)	+= iic.o pci.o qspan_pci.o
obj-$(CONFIG_RPXLITE)		+= iic.o
# Different boards need different serial implementations.
ifeq ($(CONFIG_SERIAL_CONSOLE),y)
obj-$(CONFIG_8xx)		+= m8xx_tty.o
obj-$(CONFIG_8260)		+= m8260_tty.o
obj-$(CONFIG_GT64260_CONSOLE)   += gt64260_tty.o
obj-$(CONFIG_SERIAL)		+= ../common/ns16550.o
endif

LIBS				:= ../lib/zlib.a

# Tools
MKBUGBOOT			:= ../utils/mkbugboot
MKPREP				:= ../utils/mkprep
MKTREE				:= ../utils/mktree

zvmlinux: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o
	$(OBJCOPY) $(OBJCOPY_ARGS) \
		--add-section=.image=../images/vmlinux.gz \
		--set-section-flags=.image=contents,alloc,load,readonly,data \
		../common/dummy.o image.o
	$(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
	$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
		-R .ramdisk -R .sysmap

zvmlinux.initrd: $(obj-y) $(LIBS) ../ld.script ../images/vmlinux.gz \
		../common/dummy.o
	$(OBJCOPY) $(OBJCOPY_ARGS) \
		--add-section=.ramdisk=../images/ramdisk.image.gz \
		--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
		--add-section=.image=../images/vmlinux.gz \
		--set-section-flags=.image=contents,alloc,load,readonly,data \
		../common/dummy.o image.o
	$(LD) $(LD_ARGS) -o $@ $(obj-y) image.o $(LIBS)
	$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
		-R .sysmap

# Sort-of dummy rules, that let us format the image we want.
zImage: $(ZIMAGE)
	rm -f zvmlinux
zImage.initrd: $(ZIMAGEINITRD)
	rm -f zvmlinux.initrd

znetboot: zImage
ifneq ($(ZNETBOOT),)
	cp ../images/$(ZNETBOOT) $(TFTPIMAGE)
else
	cp ../images/zImage.* $(TFTPIMAGE)
endif

znetboot.initrd: zImage.initrd
ifneq ($(ZNETBOOTRD),)
	cp ../images/$(ZNETBOOTRD) $(TFTPIMAGE)
else
	cp ../images/zImage.* $(TFTPIMAGE)
endif

zImage-EMBEDDED: zvmlinux
	mv zvmlinux ../images/zImage.embedded

zImage.initrd-EMBEDDED: zvmlinux.initrd
	mv zvmlinux.initrd ../images/zImage.initrd.embedded

zImage-K2: zvmlinux 
	mv zvmlinux ../images/zImage.k2

zImage.initrd-K2: zvmlinux.initrd 
	mv zvmlinux.initrd ../images/zImage.initrd.k2

zImage-EV64260: zvmlinux
	mv zvmlinux ../images/zImage.ev64260

zImage.initrd-EV64260: zvmlinux.initrd
	mv zvmlinux.initrd ../images/zImage.initrd.ev64260

zImage-MENF1: zvmlinux
	$(MKPREP) -pbp zvmlinux ../images/zImage.menf1

zImage.initrd-MENF1: zvmlinux.initrd
	$(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.menf1

zImage-PCORE: zvmlinux
	dd if=zvmlinux of=../images/zImage.pcore skip=64 bs=1k

zImage.initrd-PCORE: zvmlinux.initrd
	dd if=zvmlinux.initrd of=../images/zImage.initrd.pcore skip=64 bs=1k

zImage-PPLUS: zvmlinux $(MKPREP) $(MKBUGBOOT)
	$(MKPREP) -pbp zvmlinux ../images/zImage.pplus
	$(MKBUGBOOT) zvmlinux ../images/zImage.bugboot

zImage.initrd-PPLUS: zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
	$(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.pplus
	$(MKBUGBOOT) zvmlinux.initrd ../images/zImage.initrd.bugboot

zImage-SMON: zvmlinux
	dd if=zvmlinux of=../images/zImage.gemini skip=64 bs=1k

zImage.initrd-SMON: zvmlinux.initrd
	dd if=zvmlinux.initrd of=../images/zImage.initrd.gemini skip=64 bs=1k

zImage-SP: zvmlinux
	mv zvmlinux ../images/zImage.sandpoint

zImage.initrd-SP: zvmlinux.initrd
	mv zvmlinux.initrd ../images/zImage.initrd.sandpoint

zImage-SPRUCE: zvmlinux
	$(MKTREE) zvmlinux ../images/zImage.spruce 0x800000

zImage.initrd-SPRUCE: zvmlinux.initrd
	$(MKTREE) zvmlinux.initrd ../images/zImage.initrd.spruce 0x800000

zImage-TREE: zvmlinux
	$(MKTREE) zvmlinux ../images/zImage.treeboot

zImage.initrd-TREE: zvmlinux.initrd
	$(MKTREE) zvmlinux.initrd ../images/zImage.initrd.treeboot

zImage-ZX4500: zvmlinux
	dd if=zvmlinux of=../images/zImage.zx4500 skip=64 bs=1k

zImage.initrd-ZX4500: zvmlinux.initrd
	dd if=zvmlinux.initrd of=../images/zImage.initrd.zx4500 skip=64 bs=1k

include $(TOPDIR)/Rules.make