mpc85xx: Use uncompressed kernel on the HiveAP-330
[openwrt/openwrt.git] / target / linux / mpc85xx / image / Makefile
1 #
2 # This is free software, licensed under the GNU General Public License v2.
3 # See /LICENSE for more information.
4 #
5 include $(TOPDIR)/rules.mk
6 include $(INCLUDE_DIR)/image.mk
7
8 DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT
9
10 define rootfs_align
11 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
12 endef
13
14 define Build/copy-file
15 cat "$(1)" > "$@"
16 endef
17
18 # combine kernel and rootfs into one image
19 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
20 # <type> is "sysupgrade" or "factory"
21 #
22 # -a align the rootfs start on an <align> bytes boundary
23 # -j add jffs2 end-of-filesystem markers
24 # -s strip padding from end of the image
25 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
26 define Build/mktplinkfw
27 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
28 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
29 -k $(IMAGE_KERNEL) \
30 -r $@ \
31 -o $@.new \
32 -j -X 0x40000 \
33 -a $(call rootfs_align,$(FILESYSTEM)) \
34 $(wordlist 2,$(words $(1)),$(1)) \
35 $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
36 endef
37
38 define Device/Default
39 PROFILES := Default
40 DEVICE_DTS := $(1)
41 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
42 KERNEL_ENTRY := 0x00000000
43 KERNEL_LOADADDR := 0x00000000
44 KERNEL := kernel-bin
45 endef
46
47 ifeq ($(SUBTARGET),generic)
48
49 define Device/tl-wdr4900-v1
50 DEVICE_TITLE := TP-Link TL-WDR4900
51 TPLINK_HWID := 0x49000001
52 TPLINK_HWREV := 1
53 TPLINK_FLASHLAYOUT := 16Mppc
54 KERNEL_SIZE := 2684k
55 KERNEL_NAME := simpleImage.tl-wdr4900-v1
56 KERNEL_INITRAMFS :=
57 KERNEL := kernel-bin | uImage none
58 KERNEL_ENTRY := 0x1000000
59 KERNEL_LOADADDR := 0x1000000
60 SUPPORTED_DEVICES:=tl-wdr4900-v1 tplink,tl-wdr4900-v1
61 ARTIFACTS := fdt.bin
62 ARTIFACT/fdt.bin := append-dtb
63 IMAGES := fdt.bin factory.bin sysupgrade.bin
64 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade | append-metadata
65 IMAGE/factory.bin := append-rootfs | mktplinkfw factory
66 endef
67 TARGET_DEVICES += tl-wdr4900-v1
68
69 define Device/red-15w-rev1
70 DEVICE_TITLE := Sophos RED 15w Rev.1
71 # Original firmware uses a dedicated DTB-partition.
72 # The bootloader however supports FIT-images.
73 KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
74 SUPPORTED_DEVICES := sophos,red-15w-rev1
75 IMAGES := sysupgrade.bin
76 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
77 endef
78 TARGET_DEVICES += red-15w-rev1
79
80 endif
81
82 ifeq ($(SUBTARGET),p1020)
83
84 define Device/hiveap-330
85 DEVICE_TITLE := Aerohive HiveAP-330
86 DEVICE_PACKAGES := kmod-tpm-i2c-atmel
87 BLOCKSIZE := 128k
88 KERNEL := kernel-bin | uImage none
89 KERNEL_SIZE := 8m
90 KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs | uImage none
91 SUPPORTED_DEVICES := aerohive,hiveap-330
92 IMAGES := fdt.bin sysupgrade.bin
93 IMAGE/fdt.bin := append-dtb
94 IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | check-size 256k | \
95 append-uImage-fakehdr ramdisk | pad-to 256k | check-size 512k | \
96 append-rootfs | pad-rootfs $$(BLOCKSIZE) | pad-to 41216k | check-size 41216k | \
97 append-kernel | append-metadata
98 endef
99 TARGET_DEVICES += hiveap-330
100
101 define Device/panda
102 DEVICE_TITLE := OCEDO Panda
103 DEVICE_PACKAGES := kmod-rtc-ds1307 uboot-envtools
104 KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
105 PAGESIZE := 2048
106 SUBPAGESIZE := 512
107 BLOCKSIZE := 128k
108 SUPPORTED_DEVICES := ocedo,panda
109 IMAGES := fdt.bin sysupgrade.bin
110 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
111 IMAGE/fdt.bin := append-dtb
112 endef
113 TARGET_DEVICES += panda
114
115 endif
116
117 ifeq ($(SUBTARGET),p2020)
118
119 define Device/p2020rdb
120 DEVICE_TITLE := Freescale P2020RDB
121 DEVICE_DTS_DIR := $(DTS_DIR)/fsl
122 DEVICE_PACKAGES := kmod-hwmon-core kmod-hwmon-lm90 kmod-rtc-ds1307 \
123 kmod-gpio-pca953x kmod-eeprom-at24
124 BLOCKSIZE := 128k
125 KERNEL := kernel-bin | gzip | \
126 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
127 SUPPORTED_DEVICES := fsl,P2020RDB
128 IMAGES := sysupgrade.bin
129 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \
130 pad-rootfs $$(BLOCKSIZE) | append-metadata
131 endef
132 TARGET_DEVICES += p2020rdb
133
134 endif
135
136 $(eval $(call BuildImage))