ipq806x: build images and add sysupgrade support for AP148
[openwrt/staging/wigyori.git] / target / linux / ipq806x / image / Makefile
1 # Copyright (c) 2014 The Linux Foundation. All rights reserved.
2 #
3 include $(TOPDIR)/rules.mk
4 include $(INCLUDE_DIR)/image.mk
5
6 UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F
7 UBINIZE_OPTS = -m 2048 -p 128KiB
8
9 KERNEL_LOADADDR := 0x42208000
10
11 define Image/Prepare
12 $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf
13 endef
14
15 define Image/BuildKernel
16 $(CP) $(KDIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR)
17 endef
18
19 define Image/Build/squashfs
20 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
21 endef
22
23 define Image/Build
24 $(call Image/Build/$(1),$(1))
25 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-root.img bs=2k conv=sync
26 endef
27
28 define Build/append-dtb
29 cat $(DTS_DIR)/$(DEVICE_DTS).dtb >> $@
30 endef
31
32 define Device/Default
33 PROFILES := Default
34 KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
35 DEVICE_DTS :=
36 KERNEL_PREFIX := $$(IMAGE_PREFIX)
37 IMAGES :=
38 KERNEL_IN_UBI :=
39 endef
40 DEVICE_VARS += DEVICE_DTS KERNEL_IN_UBI
41
42 define Device/LegacyImage
43 KERNEL_SUFFIX := -uImage
44 KERNEL = kernel-bin | append-dtb | uImage none
45 KERNEL_NAME := zImage
46 endef
47
48 define Device/FitImage
49 KERNEL_SUFFIX := -fit-uImage.itb
50 KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
51 KERNEL_NAME := Image
52 endef
53
54 define Device/UbiFit
55 KERNEL_IN_UBI := 1
56 IMAGES := nand-factory.ubi nand-sysupgrade.tar
57 IMAGE/nand-factory.ubi := append-ubi
58 IMAGE/nand-sysupgrade.tar := sysupgrade-nand
59 endef
60
61 define Device/AP148
62 $(call Device/FitImage)
63 $(call Device/UbiFit)
64 DEVICE_DTS := qcom-ipq8064-ap148
65 BLOCKSIZE := 128KiB
66 PAGESIZE := 2048
67 endef
68
69 define Device/AP148-legacy
70 $(call Device/LegacyImage)
71 $(call Device/UbiFit)
72 DEVICE_DTS := qcom-ipq8064-ap148
73 BLOCKSIZE := 128KiB
74 PAGESIZE := 2048
75 BOARD_NAME := AP148
76 endef
77
78 define Device/DB149
79 $(call Device/FitImage)
80 DEVICE_DTS := qcom-ipq8064-db149
81 KERNEL_INSTALL := 1
82 endef
83
84 TARGET_DEVICES += AP148 AP148-legacy DB149
85
86 $(eval $(call BuildImage))