# 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>
#
# Notes:
# (1) For machines that do not want to use the ELF image directly (including
# stripping just the ELF header off), they must set the variables
# zimage-$(CONFIG_MACHINE) and zimagerd-$(CONFIG_MACHINE) to the target
# that produces the desired image and they must set end-$(CONFIG_MACHINE)
# to what will be suffixed to the image filename.
# (2) Regardless of (1), to have the resulting image be something other
# than 'zImage.elf', set end-$(CONFIG_MACHINE) to be the suffix used for
# the zImage, znetboot, and znetbootrd targets.
# (3) For machine targets which use the mktree program, you can optionally
# set entrypoint-$(CONFIG_MACHINE) to the location which the image should be
# loaded at.  The optimal setting for entrypoint-$(CONFIG_MACHINE) is the link
# address.
# (4) It is advisable to pass in the memory size using BI_MEMSIZE and
# get_mem_size(), which is memory controller dependent.  Add in the correct
# XXX_memory.o file for this to work, as well as editing the
# misc-$(CONFIG_MACHINE) variable.

boot				:= arch/ppc/boot
common				:= $(boot)/common
utils				:= $(boot)/utils
bootlib				:= $(boot)/lib
images				:= $(boot)/images
of1275				:= $(boot)/of1275
tftpboot			:= /tftpboot

# Normally, we use the 'misc.c' file for decompress_kernel and
# whatnot.  Sometimes we need to override this however.
misc-y	:= misc.o

# Normally, we have our images end in .elf, but something we want to
# change this.
end-y := elf

# Additionally, we normally don't need to mess with the L2 / L3 caches
# if present on 'classic' PPC.
cacheflag-y	:= -DCLEAR_CACHES=""
# This file will flush / disable the L2, and L3 if present.
clear_L2_L3	:= $(boot)/simple/clear.S

#
# See arch/ppc/kconfig and arch/ppc/platforms/Kconfig
# for definition of what platform each config option refer to.
#----------------------------------------------------------------------------
      zimage-$(CONFIG_IBM_OPENBIOS)	:= zImage-TREE
zimageinitrd-$(CONFIG_IBM_OPENBIOS)	:= zImage.initrd-TREE
         end-$(CONFIG_IBM_OPENBIOS)	:= treeboot
        misc-$(CONFIG_IBM_OPENBIOS)	:= misc-embedded.o

         end-$(CONFIG_EMBEDDEDBOOT)	:= embedded
        misc-$(CONFIG_EMBEDDEDBOOT)	:= misc-embedded.o

      zimage-$(CONFIG_EBONY)		:= zImage-TREE
zimageinitrd-$(CONFIG_EBONY)		:= zImage.initrd-TREE
         end-$(CONFIG_EBONY)		:= ebony
  entrypoint-$(CONFIG_EBONY)		:= 0x01000000

      zimage-$(CONFIG_OCOTEA)		:= zImage-TREE
zimageinitrd-$(CONFIG_OCOTEA)		:= zImage.initrd-TREE
         end-$(CONFIG_OCOTEA)		:= ocotea
  entrypoint-$(CONFIG_OCOTEA)		:= 0x01000000

     extra.o-$(CONFIG_EV64260)		:= direct.o misc-ev64260.o
         end-$(CONFIG_EV64260)		:= ev64260
   cacheflag-$(CONFIG_EV64260)		:= -include $(clear_L2_L3)

      zimage-$(CONFIG_GEMINI)		:= zImage-STRIPELF
zimageinitrd-$(CONFIG_GEMINI)		:= zImage.initrd-STRIPELF
         end-$(CONFIG_GEMINI)		:= gemini

     extra.o-$(CONFIG_K2)		:= legacy.o
         end-$(CONFIG_K2)		:= k2
   cacheflag-$(CONFIG_K2)		:= -include $(clear_L2_L3)

# kconfig 'feature', only one of these will ever be 'y' at a time.
# The rest will be unset.
motorola := $(CONFIG_MCPN765)$(CONFIG_MVME5100)$(CONFIG_PRPMC750) \
$(CONFIG_PRPMC800)$(CONFIG_LOPEC)$(CONFIG_PPLUS)
motorola := $(strip $(motorola))
pcore := $(CONFIG_PCORE)$(CONFIG_POWERPMC250)

      zimage-$(motorola)		:= zImage-PPLUS
zimageinitrd-$(motorola)		:= zImage.initrd-PPLUS
         end-$(motorola)		:= pplus

# Overrides previous assingment
     extra.o-$(CONFIG_PPLUS)		:= legacy.o
     extra.o-$(CONFIG_LOPEC)		:= mpc10x_memory.o

      zimage-$(pcore)			:= zImage-STRIPELF
zimageinitrd-$(pcore)			:= zImage.initrd-STRIPELF
     extra.o-$(pcore)			:= chrpmap.o
         end-$(pcore)			:= pcore
   cacheflag-$(pcore)			:= -include $(clear_L2_L3)

      zimage-$(CONFIG_PPC_PREP)		:= zImage-PPLUS
zimageinitrd-$(CONFIG_PPC_PREP)		:= zImage.initrd-PPLUS
     extra.o-$(CONFIG_PPC_PREP)		:= legacy.o
        misc-$(CONFIG_PPC_PREP)		+= misc-prep.o mpc10x_memory.o
         end-$(CONFIG_PPC_PREP)		:= prep

         end-$(CONFIG_SANDPOINT)	:= sandpoint
   cacheflag-$(CONFIG_SANDPOINT)	:= -include $(clear_L2_L3)

      zimage-$(CONFIG_SPRUCE)		:= zImage-TREE
zimageinitrd-$(CONFIG_SPRUCE)		:= zImage.initrd-TREE
         end-$(CONFIG_SPRUCE)		:= spruce
  entrypoint-$(CONFIG_SPRUCE)		:= 0x00800000
        misc-$(CONFIG_SPRUCE)		+= misc-spruce.o

# SMP images should have a '.smp' suffix.
         end-$(CONFIG_SMP)             := $(end-y).smp

# This is a treeboot that needs init functions until the
# boot rom is sorted out (i.e. this is short lived)
extra-aflags-$(CONFIG_REDWOOD_4)	:= -Wa,-m405
extra.o-$(CONFIG_REDWOOD_4)		:= rw4/rw4_init.o rw4/rw4_init_brd.o
EXTRA_AFLAGS := $(extra-aflags-y)
# head.o needs to get the camage.elpT(_IBMclude/laC
subdirage. PPC.
cacar_L2D
	hhis rgser taskstectures rou say Y h kernel image TH) a beic
CHRP_s
of127_ARGS:= -T $(srctree)/$(boot)/ld$(LIBS) \inux	:= -tra.o-$ing" if BRNELLOAD) -images

OBJCO	OPY_ARGnd-32-.o	:= -Upowgs-y)
#L_PATece
	  isc- image ak, reboBJS	:t)/ut)


head-htdio.o ree
	  iscLAGS :=05
jcpx(owever)t)/ut)drivers-$(0ONFIG_4:= mi_j-y		:= t)/ut)drivers-$(CONFIG_8:= mi_j-y		:= t)/ut)drivers-$(FIG_EVG_8:= mi_j-y		:= t)/ut)drivers-$BSEI_PPC_PRiic= t)/ut)drivers-$MBXPPC_PRiic= re)i= rqspan_e)i= t)/ut)drivers-$RPXCLASSIC)C_PRiic= re)i= rqspan_e)i= t)/ut)drivers-$RPXLITEPPC_PRiic= t# Dih th if re onsome l260h th if ts over(bootile:Documangifdif

io
lib-$(CONFIGFIG_VGA_,r)t)/ut)drivers-$(CONFIG_8mrch/tty= t)/ut)drivers-$(FIG_EVG_8mrch/ptty= t)/ut)drivers-$ 4xx ||IAL_8250_CONSgtxx ||Itty= t += .64OBJS))of1275	lib.a $(commoib/lib.a $(bootligifdif

io
lib-$(CONFIG_P,r)tOBJS 
subdiraglib.a $(of127t += .64NEWWO)of1275	) \
		$(addprefix $()/ut)
)t,initools
MKBUGing")of1275	note: $(ukprep m
MKFIG_	)of1275	note: $(uEP)		MK.ini	)of1275	note: $(u-T $y) $< $@

6426DOBJS) t.initrdzimages):OBJCOP(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ldd.coff		\
		$(images)/gzt.image: $(obj)
	iboot = $(OBJCOPY) $(OBJCOPY_AR     \
	--add-section=.image=$(images)/vmlinuux.gz \
	--set-section-flags=.image=contents,alloc,load,readonly,	.image: $(obj)/duchrp: $(obj)
	ibhrp =  $(CHRP_LD_ARGS) COP(COFFchrp: $(obj)/imOBJS)
	iboot = $(OBJCOPY) $(OBJCOPBJCOPY) $@ $@ -R .-rs6000 -inuux .stab -R .stabace the x .stflags t.initrdzimages)coffboot.inCOP(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ldd.coff		\
		$(images)/gzt.image: $(obj)
	iboot = $(OBJCOPY) $(OBJCOPY_AR     \
	--add-section=.ramdisk=$(images)/ramdisk.imagge.gz \
	--set-section-flags=.ramdisk=contents,alloc,load,readoPY_AR     \
	--add-section=.image=$(images)/vmlinuux.gz \
	--set-section-flags=.image=contents,alloc,load,readonly,	.image: $(obj)/duchrp: $(obj)
	ibhrp =  $(CHRP_LD_ARGS) COP(COFFchrp: $(obj)/imOBJS)
	iboot = $(OBJCOPY) $(OBJCOPBJCOPY) $@ $@ -R .-rs6000 -inuux .stab -R .stabtflags trucis -me s$(ob p the memoryling le iamak, reb kernelething.e.initrd.elf
	cp $($(

     yCOFFchrp:zuImage: vcp -fOFFchrp:zuImage:.elf
	cp $(images)c$(ENrm -fOFFchrp:zuImage:#	rules.

zImagd.elf
	cp $($(

     zImageyCOFFchrp:zuImage:coffboot.cp -fOFFchrp:zuImage:k
zImageelf
	cp $(images)/zImagec$(ENrm -fOFFchrp:zuImage:trd		:= ..initrd
zbzImage: zImelf
	cp $(images)     := melt			:= /$(images)     := 
dy ($<)'
znetboot: zImage zImageND).elf
	cp $(images)/zImage     := melt			:= /$(images)/zImage     := isk-sec)

$(imagese.initrd-:OFFchrp:zuImage: vdentf=FFchrp:zuImage:.of=elf
	cp $(images)     := mskip=64 bs=1k
en-chrp)
$(images)/zImage.initrd-:OFFchrp:zuImage:e zImageNdentf=FFchrp:zuImage:k
zImageof=elf
	cp $(images)/zImage     := minuuskip=64 bs=1k
en-chrp)
$(imagese.ini:OFFchrp:zuImage:.elMK.ini)
	ibMK.ini)OFFchrp:zuImage:.elf
	cp $(images)     := melENTRYFIG_SA
en-chrp)
$(images)/zImage.ini:OFFchrp:zuImage:k
zImageelMK.ini)
	ibMK.ini)OFFchrp:zuImage:k
zImageelf
	cp $(images)/zImage     := minuuelENTRYFIG_SA
en-chrp)
$(imagese.init:OFFchrp:zuImage:.elMKFIG_P.elMKBUGing")
	ibMKFIG_P.-pbpOFFchrp:zuImage:.elf
	cp $(images)     := 
	ibMKBUGing")OFFchrp:zuImage:.elf
	cp $(images)kprep m
en-chrp)
$(images)/zImage.init:OFFchrp:zuImage:k
zImageelMKFIG_P.elMKBUGing")
	ibMKFIG_P.-pbpOFFchrp:zuImage:k
zImageelf
	cp $(images)/zImage     := 
	ibMKBUGing")OFFchrp:zuImage:k
zImageelf
	cp $(images)/zImagekprep m
pc/amiga