Adrian Schmutzler f52081bcf9 treewide: provide global default for SUPPORTED_DEVICES
The majority of our targets provide a default value for the variable
SUPPORTED_DEVICES, which is used in images to check against the
compatible on a running device:

  SUPPORTED_DEVICES := $(subst _,$(comma),$(1))

At the moment, this is implemented in the Device/Default block of
the individual targets or even subtargets. However, since we
standardized device names and compatible in the recent past, almost
all targets are following the same scheme now:

  device/image name:  vendor_model
  compatible:         vendor,model

The equal redundant definitions are a symptom of this process.

Consequently, this patch moves the definition to image.mk making it
a global default. For the few targets not using the scheme above,
SUPPORTED_DEVICES will be defined to a different value in
Device/Default anyway, overwriting the default. In other words:
This change is supposed to be cosmetic.

This can be used as a global measure to get the current compatible
with: $(firstword $(SUPPORTED_DEVICES))
(Though this is not precisely an achievement of this commit.)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-23 12:45:21 +01:00

61 lines
1.8 KiB
Makefile

#
# 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
DEVICE_VARS += UBOOT_DEVICE_NAME
define Build/Compile
$(CP) $(LINUX_DIR)/COPYING $(KDIR)/COPYING.linux
endef
### Image scripts ###
define Build/boot-common
# This creates a new folder copies the dtb (as rockchip.dtb)
# and the kernel image (as kernel.img)
rm -fR $@.boot
mkdir -p $@.boot
$(CP) $(DTS_DIR)/$(DEVICE_DTS).dtb $@.boot/rockchip.dtb
$(CP) $(IMAGE_KERNEL) $@.boot/kernel.img
endef
define Build/boot-script
# Make an U-boot image and copy it to the boot partition
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $(if $(1),$(1),mmc).bootscript $@.boot/boot.scr
endef
define Build/pine64-img
# Creates the final SD/eMMC images,
# combining boot partition, root partition as well as the u-boot bootloader
# Generate a new partition table in $@ with 32 MiB of
# alignment padding for the idbloader and u-boot to fit:
# http://opensource.rock-chips.com/wiki_Boot_option#Boot_flow
#
# U-Boot SPL expects the U-Boot ITB to be located at sector 0x4000 (8 MiB) on the MMC storage
$(SCRIPT_DIR)/gen_image_generic.sh \
$@ \
$(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
32768
# Copy the idbloader and the u-boot image to the image at sector 0x40 and 0x4000
dd if="$(STAGING_DIR_IMAGE)"/$(UBOOT_DEVICE_NAME)-idbloader.img of="$@" seek=64 conv=notrunc
dd if="$(STAGING_DIR_IMAGE)"/$(UBOOT_DEVICE_NAME)-u-boot.itb of="$@" seek=16384 conv=notrunc
endef
### Devices ###
define Device/Default
PROFILES := Default
KERNEL := kernel-bin
IMAGES := sysupgrade.img.gz
DEVICE_DTS = rockchip/$$(SOC)-$(lastword $(subst _, ,$(1)))
endef
include $(SUBTARGET).mk
$(eval $(call BuildImage))