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 18USE_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. 22MISC := ../common/misc-simple.o 23ifeq ($(CONFIG_EMBEDDEDBOOT),y) 24ZIMAGE := zImage-EMBEDDED 25ZIMAGEINITRD := zImage.initrd-EMBEDDED 26MISC := misc-embedded.o 27END := embedded 28endif 29ifeq ($(CONFIG_IBM_OPENBIOS),y) 30ZIMAGE := zImage-TREE 31ZIMAGEINITRD := zImage.initrd-TREE 32END := treeboot 33TFTPIMAGE := /tftpboot/zImage.embedded 34MISC := misc-embedded.o 35endif 36ifeq ($(CONFIG_EBONY),y) 37ZIMAGE := zImage-TREE 38ZIMAGEINITRD := zImage.initrd-TREE 39END := ebony 40ENTRYPOINT := 0x00800000 41EXTRA := misc-44x.o 42endif 43ifeq ($(CONFIG_OCOTEA),y) 44ZIMAGE := zImage-TREE 45ZIMAGEINITRD := zImage.initrd-TREE 46END := ocotea 47ENTRYPOINT := 0x00800000 48EXTRA := misc-44x.o 49endif 50ifeq ($(CONFIG_GEMINI),y) 51ZIMAGE := zImage-SMON 52ZIMAGEINITRD := zImage.initrd-SMON 53END := gemini 54endif 55# kbuild-2.4 'feature', only one of these will ever by 'y' at a time. 56# The rest will be unset. 57ifeq ($(CONFIG_LOPEC)$(CONFIG_PPLUS)$(CONFIG_PRPMC750),y) 58ZIMAGE := zImage-PPLUS 59ZIMAGEINITRD := zImage.initrd-PPLUS 60EXTRA := ../common/mpc10x_memory.o 61TFTPIMAGE := /tftpboot/zImage.pplus 62END := pplus 63endif 64ifeq ($(CONFIG_PPLUS),y) 65EXTRA := legacy.o 66endif 67ifeq ($(CONFIG_PAL4),y) 68ZIMAGE := zImage-PAL4 69ZIMAGEINITRD := zImage.initrd-PAL4 70END := pal4 71endif 72ifeq ($(CONFIG_SANDPOINT),y) 73ZIMAGE := zImage-SP 74ZIMAGEINITRD := zImage.initrd-SP 75CACHEFLAG := -include clear.S 76TFTPIMAGE := /tftpboot/zImage.sandpoint 77END := sandpoint 78endif 79ifeq ($(CONFIG_SPRUCE),y) 80ZIMAGE := zImage-TREE 81ZIMAGEINITRD := zImage.initrd-TREE 82ENTRYPOINT := 0x00800000 83MISC := misc-spruce.o 84END := spruce 85endif 86 87TFTPIMAGE ?= /tftpboot/zImage.$(END) 88ifeq ($(CONFIG_SMP),y) 89TFTPIMAGE += .smp 90endif 91 92 93# Setup a default address to put ourselves, change it as needed. 94LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic 95ifdef CONFIG_8xx 96LD_ARGS := -T ../ld.script -Ttext 0x00180000 -Bstatic 97endif 98ifeq ($(CONFIG_8260)$(CONFIG_40x),y) 99LD_ARGS := -T ../ld.script -Ttext 0x00400000 -Bstatic 100endif 101OBJCOPY_ARGS := -O elf32-powerpc 102 103# head.o and ../common/relocate.o must be at the start. 104obj-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 108obj-$(CONFIG_40x) += embed_config.o 109obj-$(CONFIG_8xx) += embed_config.o 110obj-$(CONFIG_8260) += embed_config.o 111obj-$(CONFIG_BSEIP) += iic.o 112obj-$(CONFIG_MBX) += iic.o 113obj-$(CONFIG_RPXCLASSIC) += iic.o 114obj-$(CONFIG_RPXLITE) += iic.o 115# Different boards need different serial implementations. 116ifeq ($(CONFIG_SERIAL_CONSOLE),y) 117obj-$(CONFIG_8xx) += m8xx_tty.o 118obj-$(CONFIG_8260) += m8260_tty.o 119obj-$(CONFIG_SERIAL) += ../common/ns16550.o 120endif 121 122LIBS := ../lib/zlib.a 123 124# Tools 125MKBUGBOOT := ../utils/mkbugboot 126MKPREP := ../utils/mkprep 127MKTREE := ../utils/mktree 128 129zvmlinux: $(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 138zvmlinux.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. 151zImage: $(ZIMAGE) 152 rm -f zvmlinux 153zImage.initrd: $(ZIMAGEINITRD) 154 rm -f zvmlinux.initrd 155 156znetboot: zImage 157 cp ../images/zImage.$(END) $(TFTPIMAGE) 158 159znetboot.initrd: zImage.initrd 160 cp ../images/zImage.initrd.$(END) $(TFTPIMAGE) 161 162zImage-EMBEDDED: zvmlinux 163 mv zvmlinux ../images/zImage.$(END) 164 165zImage.initrd-EMBEDDED: zvmlinux.initrd 166 mv zvmlinux.initrd ../images/zImage.initrd.$(END) 167 168zImage-PAL4: zvmlinux 169 mv zvmlinux ../images/zImage.$(END) 170 171zImage.initrd-PAL4: zvmlinux.initrd 172 mv zvmlinux.initrd ../images/zImage.initrd.$(END) 173 174zImage-PPLUS: zvmlinux $(MKPREP) $(MKBUGBOOT) 175 $(MKPREP) -pbp zvmlinux ../images/zImage.pplus 176 $(MKBUGBOOT) zvmlinux ../images/zImage.bugboot 177 178zImage.initrd-PPLUS: zvmlinux.initrd $(MKPREP) $(MKBUGBOOT) 179 $(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.pplus 180 $(MKBUGBOOT) zvmlinux.initrd ../images/zImage.initrd.bugboot 181 182zImage-SP: zvmlinux 183 mv zvmlinux ../images/zImage.sandpoint 184 185zImage.initrd-SP: zvmlinux.initrd 186 mv zvmlinux.initrd ../images/zImage.initrd.sandpoint 187 188zImage-SMON: zvmlinux 189 dd if=zvmlinux of=../images/zImage.$(END) skip=64 bs=1k 190 191zImage.initrd-SMON: zvmlinux.initrd 192 dd if=zvmlinux.initrd of=../images/zImage.initrd.$(END) skip=64 bs=1k 193 194zImage-TREE: zvmlinux 195 $(MKTREE) zvmlinux ../images/zImage.$(END) $(ENTRYPOINT) 196 197zImage.initrd-TREE: zvmlinux.initrd 198 $(MKTREE) zvmlinux.initrd ../images/zImage.initrd.$(END) $(ENTRYPOINT) 199 200include $(TOPDIR)/Rules.make 201