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
11 UBIFS_OPTS := -m 2048 -e 126KiB -c 4096 -U
12 UBINIZE_OPTS := -m 2048 -p 128KiB -s 512
14 define Image/BuildKernel
15 $(CP) $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
17 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
18 $(CP) $(KDIR)/uImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs
21 $(foreach board,$(BOARDS),
22 $(LINUX_DIR)/scripts/dtc/dtc \
23 -O dtb -o $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb \
24 -I dts $(LINUX_DIR)/arch/arm/boot/dts/kirkwood-$(board).dts
28 define Image/InstallKernel
30 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),)
31 $(INSTALL_DIR) $(TARGET_DIR)/boot
32 $(CP) $(KDIR)/uImage $(TARGET_DIR)/boot/
35 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
36 $(INSTALL_DIR) $(TARGET_DIR)/boot
37 $(foreach board,$(BOARDS),
38 $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(board).dtb $(TARGET_DIR)/boot/
44 $(if $(Image/Build/$(1)), \
45 $(call Image/Build/$(1),$(1)), \
46 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
50 define Image/Build/jffs2-nand-2048-128k
51 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
55 define Image/Build/squashfs
56 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
58 dd if=$(KDIR)/uImage bs=4096k conv=sync; \
59 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
60 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
63 $(eval $(call BuildImage))