treewide: rename IMAGE_PREFIX/IMAGE_NAME to DEVICE_IMG_*
[openwrt/staging/dedeckeh.git] / target / linux / imx6 / image / Makefile
index 540692d817377e0bfd391fb9b41a46bfc0dbd25d..9ce620655a220a323d6043baeffe999d92127737 100644 (file)
@@ -1,9 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Copyright (C) 2013 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
+
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/image.mk
 
@@ -11,7 +9,7 @@ include $(INCLUDE_DIR)/image.mk
 # Images
 #################################################
 
-DEVICE_VARS += MKUBIFS_OPTS
+DEVICE_VARS += MKUBIFS_OPTS UBOOT BOOT_SCRIPT
 
 define Build/boot-overlay
        rm -rf $@.boot
@@ -35,7 +33,7 @@ define Build/boot-overlay
 
        $(STAGING_DIR_HOST)/bin/mkfs.ubifs \
                --space-fixup --compr=zlib --squash-uids \
-               $(MKUBIFS_OPTS) -c 8124 \
+               $(MKUBIFS_OPTS) -c 16248 \
                -o $@.boot.ubifs -d $@.boot
 
        $(TAR) -C $@.boot -cf $@.boot.tar .
@@ -58,6 +56,61 @@ define Build/boot-scr
        $(BIN_DIR)/boot.scr
 endef
 
+define Build/recovery-scr
+       mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
+       -n '$(DEVICE_ID) OpenWrt recovery bootscript' \
+       -d ./recovery-$(DEVICE_NAME) $@
+endef
+
+define Build/imx6-combined-image-prepare
+       rm -rf $@.boot
+       mkdir -p $@.boot
+endef
+
+define Build/imx6-combined-image-clean
+       rm -rf $@.boot $@.fs
+endef
+
+define Build/imx6-combined-image
+       $(CP) $(IMAGE_KERNEL) $@.boot/uImage
+
+       $(foreach dts,$(DEVICE_DTS), \
+               $(CP) \
+                       $(DTS_DIR)/$(dts).dtb \
+                       $@.boot/;
+       )
+
+       mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
+               -n '$(DEVICE_ID) OpenWrt bootscript' \
+               -d $(BOOT_SCRIPT) \
+               $@.boot/boot.scr
+
+       cp $@ $@.fs
+
+       $(SCRIPT_DIR)/gen_image_generic.sh $@ \
+               $(CONFIG_TARGET_KERNEL_PARTSIZE) \
+               $@.boot \
+               $(CONFIG_TARGET_ROOTFS_PARTSIZE) \
+               $@.fs \
+               1024
+endef
+
+define Build/imx6-sdcard
+       $(Build/imx6-combined-image-prepare)
+
+       $(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img $@.boot/u-boot.img
+       $(Build/imx6-combined-image)
+       dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc
+
+       $(Build/imx6-combined-image-clean)
+endef
+
+define Build/apalis-emmc
+       $(Build/imx6-combined-image-prepare)
+       $(Build/imx6-combined-image)
+       $(Build/imx6-combined-image-clean)
+endef
+
 #################################################
 # Devices
 #################################################
@@ -70,14 +123,14 @@ define Device/Default
   KERNEL_INSTALL := 1
   KERNEL_SUFFIX := -uImage
   KERNEL_NAME := zImage
-  KERNEL_PREFIX := $$(IMAGE_PREFIX)
   KERNEL := kernel-bin | uImage none
-  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
   IMAGES :=
 endef
 
 define Device/ventana
-  DEVICE_TITLE := Gateworks Ventana family (normal NAND flash)
+  DEVICE_VENDOR := Gateworks
+  DEVICE_MODEL := Ventana family
+  DEVICE_VARIANT := normal NAND flash
   DEVICE_DTS:= \
        imx6dl-gw51xx \
        imx6dl-gw52xx \
@@ -87,6 +140,10 @@ define Device/ventana
        imx6dl-gw552x \
        imx6dl-gw553x \
        imx6dl-gw5904 \
+       imx6dl-gw5907 \
+       imx6dl-gw5910 \
+       imx6dl-gw5912 \
+       imx6dl-gw5913 \
        imx6q-gw51xx \
        imx6q-gw52xx \
        imx6q-gw53xx \
@@ -95,18 +152,23 @@ define Device/ventana
        imx6q-gw551x \
        imx6q-gw552x \
        imx6q-gw553x \
-       imx6q-gw5904
+       imx6q-gw5904 \
+       imx6q-gw5907 \
+       imx6q-gw5910 \
+       imx6q-gw5912 \
+       imx6q-gw5913
   DEVICE_PACKAGES := kmod-sky2 kmod-sound-core kmod-sound-soc-imx kmod-sound-soc-imx-sgtl5000 \
        kmod-can kmod-can-flexcan kmod-can-raw \
        kmod-hwmon-gsc \
        kmod-leds-gpio kmod-pps-gpio \
        kobs-ng
   KERNEL += | boot-overlay
-  IMAGES := nand.ubi bootfs.tar.gz
+  IMAGES := nand.ubi bootfs.tar.gz dtb
   UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
+  BOOT_SCRIPT := bootscript-ventana
   IMAGE/nand.ubi := append-ubi
-  IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb
-  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
+  IMAGE/bootfs.tar.gz := bootfs.tar.gz
+  IMAGE/dtb := install-dtb
   PAGESIZE := 2048
   BLOCKSIZE := 128k
   MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB
@@ -115,8 +177,10 @@ TARGET_DEVICES += ventana
 
 define Device/ventana-large
   $(Device/ventana)
+  DEVICE_VENDOR := Gateworks
+  DEVICE_MODEL := Ventana family
+  DEVICE_VARIANT := large NAND flash
   DEVICE_NAME := ventana
-  DEVICE_TITLE := Gateworks Ventana family (large NAND flash)
   IMAGES := nand.ubi
   PAGESIZE := 4096
   BLOCKSIZE := 256k
@@ -125,18 +189,50 @@ endef
 TARGET_DEVICES += ventana-large
 
 define Device/wandboard
-  DEVICE_TITLE := Wandboard Dual
+  DEVICE_VENDOR := Wandboard
+  DEVICE_MODEL := Dual
   DEVICE_DTS := imx6dl-wandboard
 endef
 TARGET_DEVICES += wandboard
 
 define Device/cubox-i
-  KERNEL := kernel-bin | install-dtb | boot-scr
+  DEVICE_VENDOR := SolidRun
+  DEVICE_MODEL := CuBox-i
+  KERNEL := kernel-bin
+  UBOOT := mx6cuboxi
+  BOOT_SCRIPT = bootscript-cubox
   DEVICE_NAME := cubox
-  DEVICE_TITLE := SolidRun CuBox-i
-  DEVICE_PACKAGES := u-boot-mx6cuboxi kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
-  DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i
+  DEVICE_PACKAGES := kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
+  DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i imx6q-hummingboard imx6dl-hummingboard
+  IMAGES := combined.bin dtb
+  FILESYSTEMS := squashfs
+  IMAGE/combined.bin := append-rootfs | pad-extra 128k | imx6-sdcard
+  IMAGE/dtb := install-dtb
 endef
 TARGET_DEVICES += cubox-i
 
+define Device/apalis
+  DEVICE_VENDOR := Toradex
+  DEVICE_MODEL := Apalis family
+  SUPPORTED_DEVICES := apalis,ixora apalis,eval
+  DEVICE_DTS := \
+         imx6q-apalis-eval \
+         imx6q-apalis-ixora \
+         imx6q-apalis-ixora-v1.1
+  DEVICE_PACKAGES := \
+       kmod-can kmod-can-flexcan kmod-can-raw \
+       kmod-leds-gpio kmod-gpio-button-hotplug \
+       kmod-pps-gpio kmod-rtc-ds1307
+  BOOT_SCRIPT := bootscript-apalis
+  UBOOT := apalis_imx6
+  FILESYSTEMS := squashfs
+  IMAGES := combined.bin sysupgrade.bin
+  DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1).$$(2)
+  IMAGE/combined.bin := append-rootfs | pad-extra 128k | apalis-emmc
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  ARTIFACTS := recovery.scr
+  ARTIFACT/recovery.scr := recovery-scr
+endef
+TARGET_DEVICES += apalis
+
 $(eval $(call BuildImage))