From 40fd877db287acf65a985f5f18d8b7e28ebbeb08 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Tue, 9 Sep 2025 14:48:32 -0400 Subject: [PATCH] swupdate: add script to provide runtime hardware revision Signed-off-by: Hugo Villeneuve --- .../swupdate/swupdate/97-hwrevision-hardcoded.sh.in | 12 ++++++++++++ recipes-support/swupdate/swupdate_%.bbappend | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 recipes-support/swupdate/swupdate/97-hwrevision-hardcoded.sh.in create mode 100644 recipes-support/swupdate/swupdate_%.bbappend diff --git a/recipes-support/swupdate/swupdate/97-hwrevision-hardcoded.sh.in b/recipes-support/swupdate/swupdate/97-hwrevision-hardcoded.sh.in new file mode 100644 index 0000000..44bdf5d --- /dev/null +++ b/recipes-support/swupdate/swupdate/97-hwrevision-hardcoded.sh.in @@ -0,0 +1,12 @@ +#!/bin/sh + +# TODO: the revision should be read at bootup from an EEPROM or other means. +# For now, it is simply hardcoded. +HWREV="revA" + +DESTDIR="/var/run/swupdate" +DESTFILE="${DESTDIR}/hwrevision" + +mkdir -p ${DESTDIR} + +echo "@MACHINE@ ${HWREV}" > ${DESTFILE} diff --git a/recipes-support/swupdate/swupdate_%.bbappend b/recipes-support/swupdate/swupdate_%.bbappend new file mode 100644 index 0000000..a475262 --- /dev/null +++ b/recipes-support/swupdate/swupdate_%.bbappend @@ -0,0 +1,12 @@ +FILESEXTRAPATHS:prepend:hvmpd := "${THISDIR}/${PN}:" + +SRC_URI:append:hvmpd = " \ + file://97-hwrevision-hardcoded.sh.in \ +" + +do_install:append:hvmpd() { + sed -e s/@MACHINE@/${MACHINE}/ \ + ${WORKDIR}/97-hwrevision-hardcoded.sh.in > ${WORKDIR}/97-hwrevision-hardcoded.sh + install -d ${D}${libdir}/swupdate/conf.d/ + install -m 644 ${WORKDIR}/97-hwrevision-hardcoded.sh ${D}${libdir}/swupdate/conf.d/ +} -- 2.20.1