ath79: cleanup image build code
[openwrt/staging/wigyori.git] / target / linux / ath79 / image / generic-tp-link.mk
1 DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT TPLINK_HEADER_VERSION TPLINK_BOARD_NAME
2
3 # combine kernel and rootfs into one image
4 # mktplinkfw <type> <optional extra arguments to mktplinkfw binary>
5 # <type> is "sysupgrade" or "factory"
6 #
7 # -a align the rootfs start on an <align> bytes boundary
8 # -j add jffs2 end-of-filesystem markers
9 # -s strip padding from end of the image
10 # -X reserve <size> bytes in the firmware image (hexval prefixed with 0x)
11 define Build/mktplinkfw
12 -$(STAGING_DIR_HOST)/bin/mktplinkfw \
13 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) \
14 -m $(TPLINK_HEADER_VERSION) \
15 -k $(IMAGE_KERNEL) \
16 -r $@ \
17 -o $@.new \
18 -j -X 0x40000 \
19 -a $(call rootfs_align,$(FILESYSTEM)) \
20 $(wordlist 2,$(words $(1)),$(1)) \
21 $(if $(findstring sysupgrade,$(word 1,$(1))),-s) && mv $@.new $@ || rm -f $@
22 endef
23
24 # mktplinkfw-combined
25 #
26 # -c combined image
27 define Build/mktplinkfw-combined
28 $(STAGING_DIR_HOST)/bin/mktplinkfw \
29 -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) -N OpenWrt -V $(REVISION) $(1) \
30 -m $(TPLINK_HEADER_VERSION) \
31 -k $@ \
32 -o $@.new \
33 -s -S \
34 -c
35 @mv $@.new $@
36 endef
37
38
39 define Device/tplink
40 TPLINK_HWREV := 0x1
41 TPLINK_HEADER_VERSION := 1
42 LOADER_TYPE := gz
43 IMAGES := sysupgrade.bin
44 IMAGE/sysupgrade.bin := append-rootfs | mktplinkfw sysupgrade
45 endef
46
47 define Device/tplink-nolzma
48 $(Device/tplink)
49 LOADER_FLASH_OFFS := 0x22000
50 COMPILE := loader-$(1).gz
51 COMPILE/loader-$(1).gz := loader-okli-compile
52 KERNEL:= kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1)
53 KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel-cmdline | mktplinkfw-combined
54 endef
55
56 define Device/tplink-4m
57 $(Device/tplink-nolzma)
58 TPLINK_FLASHLAYOUT := 4M
59 IMAGE_SIZE := 3904k
60 endef
61
62 define Device/tplink-8m
63 $(Device/tplink-nolzma)
64 TPLINK_FLASHLAYOUT := 8M
65 IMAGE_SIZE := 7936k
66 endef
67
68 define Device/tl_wr1043nd_v1
69 $(Device/tplink-8m)
70 ATH_SOC := ar9132
71 DEVICE_TITLE := TP-LINK TL-WR1043N/ND v1
72 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
73 TPLINK_HWID := 0x10430001
74 endef
75 #TARGET_DEVICES += tl_wr1043nd_v1