.*\.a$ .*\.cmi$ .*\.cmo$ .*\.cmx$ \..*\.d$ .*\.o$ .*\.opic$ .*\.pyc$ .*\.so$ .*\.so\..*$ .*\.tar\.bz2$ .*\.tar\.gz$ .*~$ .*\.swp$ .*\.tmp$ .*\.flc$ .*\.orig$ .*\.rej$ .*\.spot$ .*\.spit$ .*\.gcno$ .*\.gcda$ .*/a\.out$ .*/Modules\.symvers$ .*/cscope\..*$ ^cscope.*$ ^[^/]*\.bz2$ ^\.config$ ^\.pc (^|/)(tags|TAGS)$ (^|/)(GTAGS|GPATH|GSYMS|GRTAGS)$ ^autom4te\.cache$ ^config\.log$ ^config\.status$ ^config\.cache$ ^config/Toplevel\.mk$ ^build-.*$ ^dist/.*$ ^docs/autom4te\.cache$ ^docs/config\.log$ ^docs/config\.status ^docs/config/Toplevel\.mk ^docs/.*\.aux$ ^docs/.*\.dvi$ ^docs/.*\.log$ ^docs/.*\.pdf$ ^docs/.*\.ps$ ^docs/.*\.toc$ ^docs/api/.*$ ^docs/figs/xenserver\.eps$ ^docs/html/.*$ ^docs/interface/WARNINGS$ ^docs/interface/images\.pl$ ^docs/interface/images\.tex$ ^docs/interface/img1\.png$ ^docs/interface/index\.html$ ^docs/interface/interface\.css$ ^docs/interface/interface\.html$ ^docs/interface/labels\.pl$ ^docs/figs/.*\.png ^docs/man1/ ^docs/man5/ ^docs/pdf/.*$ ^docs/ps/.*$ ^docs/user/WARNINGS$ ^docs/user/images\.pl$ ^docs/user/images\.tex$ ^docs/user/img1\.png$ ^docs/user/img2\.png$ ^docs/user/img3\.png$ ^docs/user/index\.html$ ^docs/user/internals\.pl$ ^docs/user/labels\.pl$ ^docs/user/user\.css$ ^docs/user/user\.html$ ^docs/txt/.*$ ^docs/xen-api/vm_lifecycle.eps$ ^docs/xen-api/xenapi-datamodel-graph.eps$ ^docs/xen-api/xenapi.out$ ^extras/mini-os/include/list\.h$ ^extras/mini-os/include/mini-os$ ^extras/mini-os/include/x86/mini-os$ ^extras/mini-os/include/xen$ ^extras/mini-os/mini-os.*$ ^install/.*$ ^linux-[^/]*-paravirt/.*$ ^linux-2.6[^/]*/.*$ ^linux-[^/]*-rc/.*$ ^linux-[^/]*-tip/.*$ ^linux-[^/]*-git/.*$ ^linux-[^/]*\.patch$ ^mkddbxen$ ^netbsd-[^/]*-tools/.*$ ^netbsd-[^/]*-xen0/.*$ ^netbsd-[^/]*-xenU/.*$ ^netbsd-[^/]*\.patch$ ^patches/.*/\.makedep$ ^patches/ebtables-brnf-5_vs_2\.4\.25\.diff$ ^patches/ebtables\.diff$ ^patches/tmp/.*$ ^pristine-.*$ ^ref-.*$ ^tmp-.*$ ^stubdom/autom4te\.cache$ ^stubdom/binutils-.*$ ^stubdom/config\.log$ ^stubdom/config\.status$ ^stubdom/config\.cache$ ^stubdom/cross-root-.*$ ^stubdom/gcc-.*$ ^stubdom/include$ ^stubdom/ioemu$ ^stubdom/xenstore$ ^stubdom/libxc-.*$ ^stubdom/lwip-.*$ ^stubdom/mini-os-.*$ ^stubdom/mk-headers-.*$ ^stubdom/newlib-.*$ ^stubdom/pciutils-.*$ ^stubdom/zlib-.*$ ^stubdom/grub-.*$ ^stubdom/polarssl-.*$ ^stubdom/gmp-.*$ ^stubdom/tpm_emulator-.*$ ^stubdom/ocaml-.*$ ^stubdom/lwip/ ^stubdom/ioemu/ ^stubdom/stubdompath\.sh$ ^stubdom/vtpm/vtpm_manager\.h$ ^tools/.*/build/lib.*/.*\.py$ ^tools/blktap2/control/tap-ctl$ ^tools/blktap2/drivers/img2qcow$ ^tools/blktap2/drivers/lock-util$ ^tools/blktap2/drivers/qcow-create$ ^tools/blktap2/drivers/qcow2raw$ ^tools/blktap2/drivers/tapdisk-client$ ^tools/blktap2/drivers/tapdisk-diff$ ^tools/blktap2/drivers/tapdisk-stream$ ^tools/blktap2/drivers/tapdisk2$ ^tools/blktap2/drivers/td-util$ ^tools/blktap2/vhd/vhd-update$ ^tools/blktap2/vhd/vhd-util$ ^tools/blktap/drivers/blktapctrl$ ^tools/blktap/drivers/img2qcow$ ^tools/blktap/drivers/qcow-create$ ^tools/blktap/drivers/qcow2raw$ ^tools/blktap/drivers/tapdisk$ ^tools/check/\..*$ ^tools/console/xenconsole$ ^tools/console/xenconsoled$ ^tools/debugger/gdb/gdb-6\.2\.1-linux-i386-xen/.*$ ^tools/debugger/gdb/gdb-6\.2\.1/.*$ ^tools/debugger/gdb/gdb-6\.2\.1\.tar\.bz2$ ^tools/debugger/gdbsx/gdbsx$ ^tools/debugger/kdd/kdd$ ^tools/debugger/xenitp/xenitp$ ^tools/firmware/.*/biossums$ ^tools/firmware/.*\.bin$ ^tools/firmware/.*\.sym$ ^tools/firmware/.*bios/.*bios.*\.txt$ ^tools/firmware/etherboot/eb-roms\.h$ ^tools/firmware/etherboot/ipxe/.*$ ^tools/firmware/etherboot/ipxe\.git/.*$ ^tools/firmware/extboot/extboot.img$ ^tools/firmware/extboot/signrom$ ^tools/firmware/hvmloader/acpi/mk_dsdt$ ^tools/firmware/hvmloader/acpi/dsdt.*\.c$ ^tools/firmware/hvmloader/acpi/dsdt_.*\.asl$ ^tools/firmware/hvmloader/acpi/ssdt_.*\.h$ ^tools/firmware/hvmloader/hvmloader$ ^tools/firmware/hvmloader/roms\.inc$ ^tools/firmware/rombios/BIOS-bochs-[^/]*$ ^tools/firmware/rombios/_rombios[^/]*_\.c$ ^tools/firmware/rombios/rombios[^/]*\.s$ ^tools/firmware/rombios/32bit/32bitbios_flat\.h$ ^tools/firmware/vgabios/vbetables-gen$ ^tools/firmware/vgabios/vbetables\.h$ ^tools/flask/utils/flask-getenforce$ ^tools/flask/utils/flask-get-bool$ ^tools/flask/utils/flask-loadpolicy$ ^tools/flask/utils/flask-setenforce$ ^tools/flask/utils/flask-set-bool$ ^tools/flask/utils/flask-label-pci$ ^tools/fs-back/fs-backend$ ^tools/hotplug/common/hotplugpath\.sh$ ^tools/include/xen/.*$ ^tools/include/xen-foreign/.*\.(c|h|size)$ ^tools/include/xen-foreign/checker$ ^tools/libxen/libxenapi- ^tools/libxen/test/test_bindings$ ^tools/libxen/test/test_event_handling$ ^tools/libxl/_.*\.h$ ^tools/libxl/_.*\.c$ ^tools/libxl/libxlu_cfg_y\.output$ ^tools/libxl/xl$ ^tools/libxl/libxl-save-helper$ ^tools/libxl/testidl$ ^tools/libxl/testidl\.c$ ^tools/libxl/tmp\..*$ ^tools/libxl/.*\.new$ ^tools/libxl/_libxl\.api-for-check ^tools/libxl/libxl\.api-ok ^tools/libvchan/vchan-node[12]$ ^tools/misc/cpuperf/cpuperf-perfcntr$ ^tools/misc/cpuperf/cpuperf-xen$ ^tools/misc/xc_shadow$ ^tools/misc/xen_cpuperf$ ^tools/misc/xen-detect$ ^tools/misc/xen-hptool$ ^tools/misc/xen-hvmcrash$ ^tools/misc/xen-tmem-list-parse$ ^tools/misc/xenperf$ ^tools/misc/xenpm$ ^tools/misc/xen-hvmctx$ ^tools/misc/xen-lowmemd$ ^tools/misc/gtraceview$ ^tools/misc/gtracestat$ ^tools/misc/xenlockprof$ ^tools/misc/xencov$ ^tools/pygrub/build/.*$ ^tools/python/build/.*$ ^tools/python/xen/util/path\.py$ ^tools/python/xen/lowlevel/xl/_pyxl_types.c ^tools/python/xen/lowlevel/xl/_pyxl_types.h ^tools/remus/imqebt/imqebt$ ^tools/remus/kmod/.*(\.cmd|\.mod|\.ko|\.mod\.c|\.symvers|\.xen)$ ^tools/security/secpol_tool$ ^tools/security/xen/.*$ ^tools/security/xensec_tool$ ^tools/tests/x86_emulator/blowfish\.bin$ ^tools/tests/x86_emulator/blowfish\.h$ ^tools/tests/x86_emulator/test_x86_emulator$ ^tools/tests/x86_emulator/x86_emulate$ ^tools/tests/regression/installed/.*$ ^tools/tests/regression/build/.*$ ^tools/tests/regression/downloads/.*$ ^tools/tests/xen-access/xen-access$ ^tools/tests/mem-sharing/memshrtool$ ^tools/tests/mce-test/tools/xen-mceinj$ ^tools/vtpm/tpm_emulator-.*\.tar\.gz$ ^tools/vtpm/tpm_emulator/.*$ ^tools/vtpm/vtpm/.*$ ^tools/vtpm_manager/manager/vtpm_managerd$ ^tools/xcutils/lsevtchn$ ^tools/xcutils/xc_restore$ ^tools/xcutils/xc_save$ ^tools/xcutils/readnotes$ ^tools/misc/xenwatchdogd$ ^tools/xenfb/sdlfb$ ^tools/xenfb/vncfb$ ^tools/xenmon/xentrace_setmask$ ^tools/xenmon/xenbaked$ ^tools/xenpaging/xenpaging$ ^tools/xenpmd/xenpmd$ ^tools/xenstat/xentop/xentop$ ^tools/xenstore/testsuite/tmp/.*$ ^tools/xenstore/init-xenstore-domain$ ^tools/xenstore/xen$ ^tools/xenstore/xenstore$ ^tools/xenstore/xenstore-chmod$ ^tools/xenstore/xenstore-exists$ ^tools/xenstore/xenstore-list$ ^tools/xenstore/xenstore-read$ ^tools/xenstore/xenstore-rm$ ^tools/xenstore/xenstore-write$ ^tools/xenstore/xenstore-control$ ^tools/xenstore/xenstore-ls$ ^tools/xenstore/xenstore-watch$ ^tools/xenstore/xenstored$ ^tools/xenstore/xenstored_test$ ^tools/xenstore/xs_crashme$ ^tools/xenstore/xs_random$ ^tools/xenstore/xs_stress$ ^tools/xenstore/xs_tdb_dump$ ^tools/xenstore/xs_test$ ^tools/xenstore/xs_watch_stress$ ^tools/xentrace/xentrace_setsize$ ^tools/xentrace/tbctl$ ^tools/xentrace/xenctx$ ^tools/xentrace/xentrace$ ^tools/xm-test/ramdisk/buildroot ^tools/xm-test/aclocal.m4$ ^tools/xm-test/autom4te ^tools/xm-test/install-sh$ ^tools/xm-test/mkinstalldirs$ ^tools/xm-test/missing$ ^tools/xm-test/config(ure|.log|.status|.guess|.sub)$ ^tools/xm-test/Makefile(.in)*$ ^tools/xm-test/.*/Makefile(.in)*$ ^tools/xm-test/lib/XmTestLib/config.py$ ^tools/xm-test/lib/XmTestReport/xmtest.py$ ^tools/xm-test/tests/.*\.test$ ^tools/firmware/ovmf-remote ^tools/firmware/ovmf$ ^tools/qemu-xen-traditional-dir-remote ^tools/qemu-xen-traditional-dir$ ^tools/qemu-xen-dir-remote ^tools/qemu-xen-dir$ ^tools/firmware/seabios-dir-remote ^tools/firmware/seabios-dir$ ^tools/ocaml/.*/.*\.annot$ ^tools/ocaml/.*/.*\.cmx?a$ ^tools/ocaml/.*/META$ ^tools/ocaml/.*/\.ocamldep\.make$ ^tools/ocaml/libs/xl/_libxl_types\.ml\.in$ ^tools/ocaml/libs/xl/_libxl_types\.mli\.in$ ^tools/ocaml/libs/xl/_libxl_types\.inc$ ^tools/ocaml/libs/xl/xenlight\.ml$ ^tools/ocaml/libs/xl/xenlight\.mli$ ^tools/ocaml/xenstored/oxenstored$ ^tools/autom4te\.cache$ ^tools/config\.h$ ^tools/config\.log$ ^tools/config\.status$ ^tools/config\.cache$ ^config/Tools\.mk$ ^config/Stubdom\.mk$ ^config/Docs\.mk$ ^xen/\.banner.*$ ^xen/System.map$ ^xen/arch/arm/asm-offsets\.s$ ^xen/arch/arm/xen\.lds$ ^xen/arch/x86/asm-offsets\.s$ ^xen/arch/x86/boot/mkelf32$ ^xen/arch/x86/xen\.lds$ ^xen/arch/x86/boot/reloc\.S$ ^xen/arch/x86/boot/reloc\.bin$ ^xen/arch/x86/boot/reloc\.lnk$ ^xen/arch/x86/efi\.lds$ ^xen/arch/x86/efi/disabled$ ^xen/arch/x86/efi/mkreloc$ ^xen/ddb/.*$ ^xen/include/headers\.chk$ ^xen/include/asm$ ^xen/include/asm-.*/asm-offsets\.h$ ^xen/include/compat/.*$ ^xen/include/hypervisor-ifs/arch$ ^xen/include/linux$ ^xen/include/public/public$ ^xen/include/xen/.*\.new$ ^xen/include/xen/acm_policy\.h$ ^xen/include/xen/banner\.h$ ^xen/include/xen/compile\.h$ ^xen/tools/figlet/figlet$ ^xen/tools/symbols$ ^xen/xsm/flask/include/av_perm_to_string\.h$ ^xen/xsm/flask/include/av_permissions\.h$ ^xen/xsm/flask/include/class_to_string\.h$ ^xen/xsm/flask/include/flask\.h$ ^xen/xsm/flask/include/initial_sid_to_string\.h$ ^xen/xen$ ^xen/xen-syms$ ^xen/xen\..*$ ^unmodified_drivers/linux-2.6/\.tmp_versions ^unmodified_drivers/linux-2.6/.*\.cmd$ ^unmodified_drivers/linux-2.6/.*\.ko$ ^unmodified_drivers/linux-2.6/.*\.mod\.c$ ^LibVNCServer.* ' href='#n162'>162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
#
# Copyright (C) 2012-2016 OpenWrt.org
# Copyright (C) 2016 LEDE-project.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

JFFS2_BLOCKSIZE = 128k

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

KERNEL_LOADADDR := 0x00008000

define Build/dtb
        $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
endef

# SD-Card Images:
# these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
# MBR:            2048 sectors
# Partition 1:   32768 sectors
# Partition 2:   98304 sectors (configurable)

define Build/boot-scr-cfpro
	rm -f $@.bootscript
	mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d cfpro-boot.script $@.bootscript
endef

define Build/boot-img
	rm -f $@.boot
	mkfs.fat -C $@.boot 16384
	$(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb)
	mcopy -i $@.boot $(IMAGE_KERNEL) ::zImage
	mcopy -i $@.boot $@.bootscript ::boot.scr
endef

define Build/sdcard-img
	ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
	./gen_mvebu_sdcard_img.sh $@ \
		"$(STAGING_DIR_IMAGE)/clearfog-u-boot-spl.kwb" \
		c 32768 $@.boot \
		83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
endef

define Device/Default
  PROFILES := Default
  DEVICE_DTS := $(1)
  BOARD_NAME = $$(DEVICE_DTS)
  KERNEL_NAME := zImage
  KERNEL := kernel-bin | append-dtb | uImage none
  SUPPORTED_DEVICES = $$(DEVICE_DTS)
endef

define Device/UBI
  IMAGES := sysupgrade.bin
  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef

define Device/UBI-factory
  $(Device/UBI)
  UBINIZE_OPTS := -E 5
  IMAGES += factory.img
  IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
endef

define Device/NAND-128K
  $(Device/UBI)
  BLOCKSIZE := 128k
  PAGESIZE := 2048
  SUBPAGESIZE := 512
  VID_HDR_OFFSET := 2048
endef

define Device/NAND-256K
  $(Device/UBI)
  BLOCKSIZE := 256k
  PAGESIZE := 4096
endef

define Device/NAND-512K
  $(Device/UBI)
  BLOCKSIZE := 512k
  PAGESIZE := 4096
endef

define Device/linksys
  DEVICE_TITLE := Linksys $(1)
  DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
endef

define Device/armada-385-linksys
  $(Device/NAND-128K)
  $(Device/UBI-factory)
  KERNEL_SIZE := 6144k
endef

define Device/linksys-wrt1200ac
  $(call Device/linksys,WRT1200AC (Caiman))
  $(Device/armada-385-linksys)
  DEVICE_DTS := armada-385-linksys-caiman
endef
TARGET_DEVICES += linksys-wrt1200ac

define Device/linksys-wrt1900acv2
  $(call Device/linksys,WRT1900ACv2 (Cobra))
  $(Device/armada-385-linksys)
  DEVICE_DTS := armada-385-linksys-cobra
endef
TARGET_DEVICES += linksys-wrt1900acv2

define Device/linksys-wrt3200acm
  $(call Device/linksys,WRT3200ACM (Rango))
  $(Device/armada-385-linksys)
  DEVICE_DTS := armada-385-linksys-rango
  DEVICE_PACKAGES += kmod-mwifiex-sdio
endef
TARGET_DEVICES += linksys-wrt3200acm

define Device/linksys-wrt1900acs
  $(call Device/linksys,WRT1900ACS (Shelby))
  $(Device/armada-385-linksys)
  DEVICE_DTS := armada-385-linksys-shelby
endef
TARGET_DEVICES += linksys-wrt1900acs

define Device/linksys-wrt1900ac
  $(call Device/linksys,WRT1900AC (Mamba))
  DEVICE_DTS := armada-xp-linksys-mamba
  $(Device/NAND-128K)
  $(Device/UBI-factory)
  KERNEL_SIZE := 3072k
endef
TARGET_DEVICES += linksys-wrt1900ac

define Device/openblocks-ax3-4
  $(Device/UBI-factory)
  DEVICE_DTS := armada-xp-openblocks-ax3-4
  SUPPORTED_DEVICES := $(1)
  BLOCKSIZE := 128k
  PAGESIZE := 1
  IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
  DEVICE_TITLE := Plat'Home OpenBlocks AX3
endef
TARGET_DEVICES += openblocks-ax3-4

define Device/armada-385-db-ap
  $(Device/NAND-256K)
  $(Device/UBI-factory)
  KERNEL_SIZE := 8192k
  DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
endef
TARGET_DEVICES += armada-385-db-ap

define Device/marvell-nand
  $(Device/NAND-512K)
  DEVICE_TITLE := Marvell Armada $(1)
endef

Device/armada-370-db = $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
Device/armada-370-rd = $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
Device/armada-xp-db = $(call Device/marvell-nand,XP DB (DB-78460-BP))
Device/armada-xp-gp = $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
TARGET_DEVICES += armada-370-db armada-370-rd armada-xp-db armada-xp-gp

define Device/armada-388-rd
  DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
  IMAGES := firmware.bin
  IMAGE/firmware.bin := append-kernel | pad-to 256k | append-rootfs | pad-rootfs
endef
TARGET_DEVICES += armada-388-rd

define Device/armada-388-clearfog-pro
  KERNEL_INSTALL := 1
  KERNEL := dtb | kernel-bin
  DEVICE_TITLE := SolidRun ClearFog Pro
  DEVICE_PACKAGES := mkf2fs e2fsprogs swconfig kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
  IMAGES := sdcard.img.gz
  IMAGE/sdcard.img.gz := boot-scr-cfpro | boot-img | sdcard-img | gzip | append-metadata
  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(2)
endef
TARGET_DEVICES += armada-388-clearfog-pro

define Device/globalscale-mirabox
  $(Device/NAND-512K)
  DEVICE_DTS := armada-370-mirabox
  SUPPORTED_DEVICES := mirabox
  DEVICE_TITLE := Globalscale Mirabox
endef
TARGET_DEVICES += globalscale-mirabox

$(eval $(call BuildImage))