mvebu: Switch to the generic mkuimage macro
[openwrt/openwrt.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012-2014 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 TARGET_DTBS := armada-xp-db armada-370-db armada-xp-openblocks-ax3-4 armada-370-mirabox \
11 armada-370-rd armada-xp-gp armada-xp-mamba
12
13 NANDBOARDS := armada-xp-mamba
14
15 LOADADDR:=0x00008000
16
17 JFFS2_BLOCKSIZE = 128k
18
19 UBIFS_OPTS = -F -m 2048 -e 124KiB -c 4096 -U
20 UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
21
22 KDIR_TMP:=$(KDIR)/tmp
23
24
25 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
26
27 define Image/Build/DTB
28 cp $(KDIR)/zImage$(2) $(KDIR)/zImage$(2)-$(1);
29 cat $(DTS_DIR)/$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
30 $(call Image/BuildKernel/MkuImage, \
31 none, $(LOADADDR), $(LOADADDR), \
32 $(KDIR)/zImage$(2)-$(1), $(KDIR)/uImage$(2)-$(1))
33 cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
34 endef
35
36 define Image/BuildKernel
37 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
38 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
39 $(call Image/Build/Initramfs)
40 endif
41 endef
42
43 define Image/Build/squashfs
44 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
45 $(foreach nandboard,$(NANDBOARDS),$(call Image/Build/UbinizeImage,$(nandboard),,squashfs,$(UBI_OPTS));)
46 ( \
47 dd if=$(KDIR)/uImage-armada-xp-mamba bs=3072k conv=sync; \
48 dd if=$(KDIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-ubinized.bin \
49 bs=2048 conv=sync; \
50 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-factory.img
51 endef
52
53 define Image/Build/Initramfs
54 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
55 endef
56
57 define BuildSysupgrade
58 $(call Image/Build/SysupgradeNAND,$(2),$(1),$(KDIR)/uImage-$(2))
59 endef
60
61 define Image/Build
62 $(call Image/Build/$(1))
63 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
64 $(foreach nandboard,$(NANDBOARDS),$(call BuildSysupgrade,$(1),$(nandboard));)
65 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
66 $(call Image/Build/Initramfs)
67 endif
68 endef
69
70 $(eval $(call BuildImage))