mpc85xx: use a foreach loop to copy boot images
[openwrt.git] / target / linux / mpc85xx / image / Makefile
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 DTS_TARGETS = mpc8548cds_32b p1010rdb
11 BOOT_IMAGES:=zImage
12
13 define Image/Prepare
14         $(foreach image,$(BOOT_IMAGES),
15                 cp $(LINUX_DIR)/arch/powerpc/boot/$(image) $(KDIR)/$(image)
16         )
17 endef
18
19 define Image/BuildKernel
20         cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
21         $(foreach dts,$(DTS_TARGETS),
22                 $(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(LINUX_DIR)/arch/powerpc/boot/dts/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(dts).fdt
23         )
24 endef
25
26 define Image/Build/ext2
27         cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
28 endef
29
30 define Image/Build/squashfs
31         $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
32         cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
33 endef
34
35 define Image/Build
36         $(call Image/Build/$(1),$(1))
37 endef
38
39 $(eval $(call BuildImage))