From 1235ea7c205c313e8dbb5c46917b8739abbfb152 Mon Sep 17 00:00:00 2001
From: =?utf8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
Date: Mon, 22 Feb 2021 18:04:16 +0100
Subject: [PATCH] image: add ModelNameLimit16
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

This script returns the model name limited to 16 characters.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 include/image-commands.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index c3f8b4b95a30..51e745958e62 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -3,6 +3,10 @@
 IMAGE_KERNEL = $(word 1,$^)
 IMAGE_ROOTFS = $(word 2,$^)
 
+define ModelNameLimit16
+$(shell expr substr "$(word 2, $(subst _, ,$(1)))" 1 16)
+endef
+
 define rootfs_align
 $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1))))))
 endef
-- 
2.30.2