mpc85xx: fix initramfs images
[openwrt/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 define imgname
11 $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
12 endef
13
14 define sysupname
15 $(call imgname,$(1),$(2))-sysupgrade.bin
16 endef
17
18 define factoryname
19 $(call imgname,$(1),$(2))-factory.bin
20 endef
21
22 zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
23
24 DTS_TARGETS = mpc8548cds_32b p1010rdb-pa tl-wdr4900-v1 p1020rdb
25
26 define Image/BuildKernel
27 cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
28 $(foreach dts,$(DTS_TARGETS),
29 $(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(DTS_DIR)/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(dts).fdt
30 )
31 endef
32
33 define Image/BuildKernel
34 cp $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-zImage
35 cp $(KDIR)/cuImage.tl-wdr4900-v1-initramfs $(BIN_DIR)/$(IMG_PREFIX)-tl-wdr4900-initramfs.uImage
36 endef
37
38 define Image/Build/TPLINK
39 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
40 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
41 -k $(KDIR)/$(3) \
42 -r $(KDIR)/root.$(1) \
43 -o $(call factoryname,$(1),$(2))
44 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
45 -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
46 -k $(KDIR)/$(3) \
47 -r $(KDIR)/root.$(1) \
48 -o $(call sysupname,$(1),$(2))
49 endef
50
51 define Image/Build/Profile/TLWDR4900
52 $(call Image/Build/TPLINK,$(1),tl-wdr4900-v1,cuImage.tl-wdr4900-v1,0x49000001,1,16Mppc)
53 endef
54
55 define Image/Build/Profile/Default
56 $(call Image/Build/Profile/TLWDR4900,$(1))
57 endef
58
59 define Image/Build/ext2
60 cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
61 endef
62
63 define Image/Build/squashfs
64 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
65 cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
66 endef
67
68 PROFILE ?= Default
69
70 define Image/Build
71 $(call Image/Build/$(1),$(1))
72 $(call Image/Build/Profile/$(PROFILE),$(1))
73 endef
74
75 $(eval $(call BuildImage))