af29c2baae90549faec01a82db2c7acc60408956
[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 $(call Image/Build/Initramfs)
34 endef
35
36 define Image/Build/squashfs
37 $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128
38 endef
39
40 define Image/Build/Initramfs
41 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
42 endef
43
44 define Image/Build
45 $(call Image/Build/$(1))
46 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
47 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
48 $(call Image/Build/Initramfs)
49 endif
50 endef
51
52 $(eval $(call BuildImage))