define a shared IMG_PREFIX variable used as a basename for image files, it contains...
[openwrt.git] / target / linux / ppc44x / image / Makefile
1 #
2 # Copyright (C) 2007-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 JFFS2_BLOCKSIZE=256k
11
12 define Image/Prepare
13         cp $(LINUX_DIR)/arch/powerpc/boot/cuImage.taishan $(KDIR)/uImage
14         $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(LINUX_DIR)/arch/powerpc/boot/dts/canyonlands.dts > $(KDIR)/openwrt-canyonlands.dtb
15 endef
16
17 define Image/BuildKernel
18         cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
19 endef
20
21 define Image/Build
22         $(call Image/Build/$(1),$(1))
23 endef
24
25 define Image/Build/jffs2-256k
26         ( \
27                 dd if=$(KDIR)/uImage bs=2048k conv=sync; \
28                 dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
29         ) > $(BIN_DIR)/$(IMG_PREFIX)-jffs2.img
30 endef
31
32 define Image/Build/squashfs
33         $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
34         ( \
35                 dd if=$(KDIR)/uImage bs=2048k conv=sync; \
36                 dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
37         ) > $(BIN_DIR)/$(IMG_PREFIX)-taishan-$(1).img
38         ( \
39                 dd if=$(LINUX_DIR)/arch/powerpc/boot/uImage bs=1920k conv=sync; \
40                 dd if=$(KDIR)/openwrt-canyonlands.dtb bs=128k conv=sync; \
41                 dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
42         ) > $(BIN_DIR)/$(IMG_PREFIX)-canyonlands-$(1).img
43 endef
44
45 $(eval $(call BuildImage))