dd15d4c610f8e6c232ba40611415eda8e36d11d4
[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 # combine kernel and rootfs into one image
15 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
16 # <type> is "sysupgrade" or "factory"
17 #
18 # -a align the rootfs start on an <align> bytes boundary
19 # -j add jffs2 end-of-filesystem markers
20 # -s strip padding from end of the image
21 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
22 define Build/mktplinkfw
23 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
24 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
25 -k $(IMAGE_KERNEL) \
26 -r $@ \
27 -o $@.new \
28 -j -X 0x40000 \
29 -a $(call rootfs_align,$(FILESYSTEM)) \
30 $(wordlist 2,$(words $(1)),$(1)) \
31 $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
32 endef
33
34 define Device/Default
35 PROFILES := Default
36 DEVICE_DTS := $(1)
37 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
38 KERNEL_ENTRY := 0x00000000
39 KERNEL_LOADADDR := 0x00000000
40 KERNEL := kernel-bin
41 endef
42
43 ifeq ($(SUBTARGET),generic)
44
45 define Device/tl-wdr4900-v1
46 DEVICE_TITLE := TP-Link TL-WDR4900
47 DEVICE_PACKAGES := kmod-ath9k wpad-basic
48 TPLINK_HWID := 0x49000001
49 TPLINK_HWREV := 1
50 TPLINK_FLASHLAYOUT := 16Mppc
51 KERNEL_NAME := cuImage.tl-wdr4900-v1
52 SUPPORTED_DEVICES:=tl-wdr4900-v1 tplink,tl-wdr4900-v1
53 IMAGES := fdt.bin factory.bin sysupgrade.bin
54 IMAGE/fdt.bin := append-dtb
55 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade | append-metadata
56 IMAGE/factory.bin := append-rootfs | mktplinkfw factory
57 endef
58 TARGET_DEVICES += tl-wdr4900-v1
59
60 endif
61
62 ifeq ($(SUBTARGET),p1020)
63
64 define Device/hiveap-330
65 DEVICE_TITLE := Aerohive HiveAP-330
66 DEVICE_PACKAGES := kmod-ath9k wpad-basic kmod-tpm-i2c-atmel
67 BLOCKSIZE := 128k
68 KERNEL_NAME := zImage
69 KERNEL_SIZE := 8m
70 SUPPORTED_DEVICES := aerohive,hiveap-330
71 IMAGES := fdt.bin sysupgrade.bin
72 IMAGE/fdt.bin := append-dtb
73 IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | check-size 256k | \
74 append-uImage-fakehdr ramdisk | pad-to 256k | check-size 512k | \
75 append-rootfs | pad-rootfs $$(BLOCKSIZE) | pad-to 41216k | check-size 41216k | \
76 append-kernel | append-metadata
77 endef
78 TARGET_DEVICES += hiveap-330
79
80 endif
81
82 ifeq ($(SUBTARGET),p2020)
83
84 define Device/p2020rdb
85 DEVICE_TITLE := Freescale P2020RDB
86 DEVICE_DTS_DIR := $(DTS_DIR)/fsl
87 DEVICE_PACKAGES := kmod-hwmon-core kmod-hwmon-lm90 kmod-rtc-ds1307 \
88 kmod-gpio-pca953x kmod-eeprom-at24
89 BLOCKSIZE := 128k
90 KERNEL := kernel-bin | gzip | \
91 fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
92 SUPPORTED_DEVICES := fsl,P2020RDB
93 IMAGES := sysupgrade.bin
94 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \
95 pad-rootfs $$(BLOCKSIZE) | append-metadata
96 endef
97 TARGET_DEVICES += p2020rdb
98
99 endif
100
101 $(eval $(call BuildImage))