2 # Copyright (C) 2009-2013 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 NAND_BLOCKSIZE := 2048:128k
12 define Image/BuildKernel
13 $(CP) $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
15 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
16 $(CP) $(KDIR)/uImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
19 $(foreach board,$(BOARDS),
20 $(LINUX_DIR)/scripts/dtc/dtc \
21 -O dtb -o $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb \
22 -I dts $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(board).dts
26 define Image/InstallKernel
28 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),)
29 $(INSTALL_DIR) $(TARGET_DIR)/boot
30 $(CP) $(KDIR)/uImage $(TARGET_DIR)/boot/
33 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
34 $(INSTALL_DIR) $(TARGET_DIR)/boot
35 $(foreach board,$(BOARDS),
36 $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb $(TARGET_DIR)/boot/
42 $(if $(Image/Build/$(1)), \
43 $(call Image/Build/$(1),$(1)), \
44 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
48 define Image/Build/jffs2-nand-2048-128k
49 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
53 define Image/Build/squashfs
54 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
56 dd if=$(KDIR)/uImage bs=4096k conv=sync; \
57 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
58 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
61 define Image/Build/ubifs
64 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
68 define Image/Build/ubi
71 $(call Image/Build/ubifs,$(1))
75 $(eval $(call BuildImage))