1#
2# arch/ppc/boot/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License.  See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1994 by Linus Torvalds
9# Adapted for PowerPC by Gary Thomas
10# modified by Cort (cort@cs.nmt.edu)
11#
12
13GZIP_FLAGS = -v9f
14
15CFLAGS	+= -fno-builtin -D__BOOTER__ -I$(TOPDIR)/arch/$(ARCH)/boot/include
16
17AFLAGS	+= -D__BOOTER__
18OBJCOPY_ARGS = -O elf32-powerpc
19
20MKIMAGE				:= $(TOPDIR)/scripts/mkuboot.sh
21
22lib/zlib.a: lib/zlib.c
23	$(MAKE) -C lib
24
25images/vmlinux.gz: $(TOPDIR)/vmlinux
26	$(MAKE) -C images vmlinux.gz
27
28# Subdirs and tools needed for each.  Assume we always need to go into
29# 'simple' unless told otherwise.
30subdir-y			:= lib common simple
31subdir-$(CONFIG_ALL_PPC)	:= chrp pmac prep
32tools-$(CONFIG_ALL_PPC)		:= addnote mknote hack-coff mkprep
33tools-$(CONFIG_4xx)		:= mktree
34tools-$(CONFIG_LOPEC)		:= mkbugboot mkprep
35tools-$(CONFIG_PPLUS)		:= mkbugboot mkprep
36tools-$(CONFIG_PRPMC750)	:= mkbugboot mkprep
37tools-$(CONFIG_SPRUCE)		:= mktree
38
39# These are dirs we don't want to go into on BOOT_TARGETS.  We have them for
40# the 'depend' stage.
41NONBOOT				:= lib common
42
43# These are the subdirs we want to use
44BOOTDIRS			= $(filter-out $(NONBOOT), $(subdir-y))
45
46makeof1275:
47	$(MAKE) -C of1275
48
49# This will make the tools we need.  We do it like this to ensure that we use
50# HOSTCC. -- Tom
51maketools:
52	$(MAKE) -C utils $(tools-y)
53
54# The targets all boards support for boot images.
55BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
56
57$(BOOT_TARGETS): vmapus lib/zlib.a images/vmlinux.gz makeof1275 maketools
58ifneq ($(BOOTDIRS),)
59	for d in $(BOOTDIRS); do $(MAKE) -C $$d $@; done
60endif
61
62vmapus: $(TOPDIR)/vmlinux
63ifdef CONFIG_APUS
64	$(STRIP) $(TOPDIR)/vmlinux -o images/vmapus
65	gzip $(GZIP_FLAGS) images/vmapus
66endif
67
68# Make an image for PPCBoot / U-Boot.
69uImage: $(MKIMAGE) images/vmlinux.gz
70	$(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \
71	-C gzip -a 00000000 -e 00000000 \
72	-n 'Linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)' \
73	-d images/vmlinux.gz images/vmlinux.UBoot
74	ln -sf vmlinux.UBoot images/uImage
75	rm -f ./mkuboot
76
77# These are subdirs with files not normally rm'ed. -- Tom
78clean:
79	$(MAKE) -C images clean
80	$(MAKE) -C utils clean
81
82include $(TOPDIR)/Rules.make
83