mvebu: fix build failures when initramfs is not selected
[openwrt/openwrt.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012 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
12
13 LOADADDR:=0x00008000
14
15 JFFS2_BLOCKSIZE = 128k
16
17 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
18
19 define Image/Build/MkuImage
20 mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \
21 -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' -d $(1) $(2);
22 endef
23
24 define Image/Build/DTB
25 cp $(KDIR)/zImage$(2) $(KDIR)/zImage$(2)-$(1);
26 cat $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
27 $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1))
28 cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
29 endef
30
31 define Image/BuildKernel
32 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
33 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
34 $(call Image/Build/Initramfs)
35 endif
36 endef
37
38 define Image/Build/squashfs
39 $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128
40 endef
41
42 define Image/Build/Initramfs
43 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
44 endef
45
46 define Image/Build
47 $(call Image/Build/$(1))
48 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
49 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
50 $(call Image/Build/Initramfs)
51 endif
52 endef
53
54 $(eval $(call BuildImage))