1 # Copyright (c) 2014 The Linux Foundation. All rights reserved.
3 include $(TOPDIR)/rules.mk
4 include $(INCLUDE_DIR)/image.mk
6 UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F
7 UBINIZE_OPTS = -m 2048 -p 128KiB
9 KERNEL_LOADADDR := 0x42208000
12 $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf
13 mkimage -A arm -O linux -T filesystem -C none \
14 -a $(KERNEL_LOADADDR) -e $(KERNEL_LOADADDR) \
15 -n 'ARM OpenWrt fakeroot' \
16 -s $(KDIR_TMP)/root.dummy-uImage.tmp
17 echo -ne '\xff' > $(KDIR_TMP)/root.dummy
18 cat $(KDIR_TMP)/root.dummy $(KDIR_TMP)/root.dummy-uImage.tmp > $(KDIR)/root.dummy
21 define Image/BuildKernel
22 $(CP) $(KDIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR)
25 define Image/Build/squashfs
26 cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-raw
27 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
31 $(call Image/Build/$(1),$(1))
32 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-root.img bs=2k conv=sync
35 define Build/append-dtb
36 cat $(DTS_DIR)/$(DEVICE_DTS).dtb >> $@
39 define Build/append-file
45 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
46 KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
48 KERNEL_PREFIX := $$(IMAGE_PREFIX)
53 DEVICE_VARS += DEVICE_DTS KERNEL_IN_UBI BOARD_NAME
55 define Device/LegacyImage
56 KERNEL_SUFFIX := -uImage
57 KERNEL = kernel-bin | append-dtb | uImage none
61 define Device/FitImage
62 KERNEL_SUFFIX := -fit-uImage.itb
63 KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
69 IMAGES := nand-factory.ubi nand-sysupgrade.tar
70 IMAGE/nand-factory.ubi := append-ubi
71 IMAGE/nand-sysupgrade.tar := sysupgrade-nand
74 define Device/DniImage
75 PROFILES += $$(DEVICE_NAME)
76 FILESYSTEMS := squashfs
77 KERNEL_SUFFIX := -uImage
78 KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
79 KERNEL = kernel-bin | append-dtb | pad-to $$$$(($$(KERNEL_SIZE)-2*64-1)) | uImage none | append-file $(KDIR)/root.dummy
83 IMAGES := factory.img sysupgrade.tar
84 IMAGE/factory.img := append-kernel | append-ubi | netgear-dni
85 IMAGE/sysupgrade.tar = sysupgrade-nand
87 DEVICE_VARS += KERNEL_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID DEVICE_BLOCK_SIZE DEVICE_PAGE_SIZE
90 $(call Device/FitImage)
92 DEVICE_DTS := qcom-ipq8064-ap148
96 DEVICE_TITLE := Qualcom AP148
99 define Device/AP148-legacy
100 $(call Device/LegacyImage)
101 $(call Device/UbiFit)
102 DEVICE_DTS := qcom-ipq8064-ap148
106 DEVICE_TITLE := Qualcom AP148 (legacy)
110 $(call Device/DniImage)
111 DEVICE_DTS := qcom-ipq8064-d7800
112 KERNEL_SIZE := 2097152
113 NETGEAR_BOARD_ID := D7800
114 NETGEAR_HW_ID := 29764958+0+128+512+4x4+4x4
118 DEVICE_TITLE := Netgear Nighthawk X4 D7800
122 $(call Device/FitImage)
123 DEVICE_DTS := qcom-ipq8064-db149
126 DEVICE_TITLE := Qualcom DB149
130 $(call Device/DniImage)
131 DEVICE_DTS := qcom-ipq8064-r7500
132 KERNEL_SIZE := 2097152
133 NETGEAR_BOARD_ID := R7500
134 NETGEAR_HW_ID := 29764841+0+128+256+3x3+4x4
138 DEVICE_TITLE := Netgear Nighthawk X4 R7500
141 TARGET_DEVICES += AP148 AP148-legacy D7800 DB149 R7500
143 $(eval $(call BuildImage))