51af440d34e4c93d6bcc563cdc62cdfec5e45b87
[openwrt/staging/rmilecki.git] / target / linux / kirkwood / image / Makefile
1 #
2 # Copyright (C) 2009-2013 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 NAND_BLOCKSIZE := 2048:128k
11
12 define Image/BuildKernel
13 cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
14 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
15 $(CP) $(KDIR)/uImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
16 endif
17 endef
18
19 define Image/Build
20 $(foreach board,$(BOARDS),
21 $(LINUX_DIR)/scripts/dtc/dtc \
22 -O dtb -o $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb \
23 -I dts $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(board).dts ;
24 )
25
26 $(if $(Image/Build/$(1)), \
27 $(call Image/Build/$(1),$(1)), \
28 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
29 )
30 endef
31
32 define Image/Build/jffs2-nand-2048-128k
33 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
34 bs=2048 conv=sync
35 endef
36
37 define Image/Build/squashfs
38 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
39 ( \
40 dd if=$(KDIR)/uImage bs=4096k conv=sync; \
41 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
42 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
43 endef
44
45 $(eval $(call BuildImage))