2 # Copyright (C) 2012-2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
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
13 NANDBOARDS := armada-xp-mamba
17 JFFS2_BLOCKSIZE = 128k
19 UBIFS_OPTS = -F -m 2048 -e 124KiB -c 4096 -U
20 UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
25 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
27 define Image/Build/MkuImage
28 mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \
29 -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' -d $(1) $(2);
32 define Image/Build/DTB
33 cp $(KDIR)/zImage$(2) $(KDIR)/zImage$(2)-$(1);
34 cat $(DTS_DIR)/$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
35 $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1))
36 cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
39 define Image/BuildKernel
40 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
41 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
42 $(call Image/Build/Initramfs)
46 define Image/Build/squashfs
47 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
48 $(foreach nandboard,$(NANDBOARDS),$(call Image/Build/UbinizeImage,$(nandboard),,squashfs,$(UBI_OPTS));)
50 dd if=$(KDIR)/uImage-armada-xp-mamba bs=3072k conv=sync; \
51 dd if=$(KDIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-ubinized.bin \
53 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-xp-mamba-squashfs-factory.img
56 define Image/Build/Initramfs
57 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
60 define BuildSysupgrade
61 $(call Image/Build/SysupgradeNAND,$(2),$(1),$(KDIR)/uImage-$(2))
65 $(call Image/Build/$(1))
66 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
67 $(foreach nandboard,$(NANDBOARDS),$(call BuildSysupgrade,$(1),$(nandboard));)
68 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
69 $(call Image/Build/Initramfs)
73 $(eval $(call BuildImage))