From 1e48bddce48d66fbb021456f938b68ad4670322d Mon Sep 17 00:00:00 2001
From: j1nx
Date: Fri, 25 Dec 2020 12:47:35 +0100
Subject: [PATCH] Create and write proper OS & Machine indentification
information.
Following the XDG standards;
https://www.freedesktop.org/software/systemd/man/os-release.html
https://www.freedesktop.org/software/systemd/man/machine-info.html
/usr/lib/os-release
NAME="OpenVoiceOS"
VERSION="0.1.0 RaspberryPi 4 64bit"
ID=ovos
VERSION_ID=0.1.0
PRETTY_NAME="OpenVoiceOS 0.1.0 RaspberryPi 4 64bit"
CPE_NAME=cpe:2.3:o:openvoiceos:ovos:0.1.0:*:development:*:*:*:rpi4-64:*
HOME_URL=https://github.com/OpenVoiceOS/OpenVoiceOS
DOCUMENTATION_URL=https://github.com/OpenVoiceOS/OpenVoiceOS/tree/develop/documentation
SUPPORT_URL=https://github.com/OpenVoiceOS/OpenVoiceOS/issues
VARIANT="OpenVoiceOS - Mycroft Edition"
VARIANT_ID=ovos-rpi4-64-mycroft
/etc/machine-info
CHASSIS=embedded
DEPLOYMENT=development
---
.../board/raspberrypi/post-build.sh | 2 ++
buildroot-external/board/raspberrypi4-64/meta | 3 ++
.../board/raspberrypi4-64/post-build.sh | 34 ++++++++++++++++++-
buildroot-external/meta | 8 +++++
4 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 buildroot-external/board/raspberrypi4-64/meta
mode change 120000 => 100755 buildroot-external/board/raspberrypi4-64/post-build.sh
create mode 100644 buildroot-external/meta
diff --git a/buildroot-external/board/raspberrypi/post-build.sh b/buildroot-external/board/raspberrypi/post-build.sh
index 89554604..a694e9f8 100755
--- a/buildroot-external/board/raspberrypi/post-build.sh
+++ b/buildroot-external/board/raspberrypi/post-build.sh
@@ -3,6 +3,8 @@
set -u
set -e
+BOARD_DIR="$(dirname $0)"
+
# Add a console on tty1
#if [ -e ${TARGET_DIR}/etc/inittab ]; then
# grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
diff --git a/buildroot-external/board/raspberrypi4-64/meta b/buildroot-external/board/raspberrypi4-64/meta
new file mode 100644
index 00000000..3dcf284d
--- /dev/null
+++ b/buildroot-external/board/raspberrypi4-64/meta
@@ -0,0 +1,3 @@
+BOARD_ID=rpi4-64
+BOARD_NAME="RaspberryPi 4 64bit"
+CHASSIS=embedded
diff --git a/buildroot-external/board/raspberrypi4-64/post-build.sh b/buildroot-external/board/raspberrypi4-64/post-build.sh
deleted file mode 120000
index f793e75c..00000000
--- a/buildroot-external/board/raspberrypi4-64/post-build.sh
+++ /dev/null
@@ -1 +0,0 @@
-../raspberrypi/post-build.sh
\ No newline at end of file
diff --git a/buildroot-external/board/raspberrypi4-64/post-build.sh b/buildroot-external/board/raspberrypi4-64/post-build.sh
new file mode 100755
index 00000000..61fa7ad9
--- /dev/null
+++ b/buildroot-external/board/raspberrypi4-64/post-build.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -u
+set -e
+
+BOARD_DIR="$(dirname $0)"
+
+. "${BR2_EXTERNAL_OPENVOICEOS_PATH}/meta"
+. "${BOARD_DIR}/meta"
+
+# Write os-release
+{
+ echo "NAME=\"${OVOS_NAME}\""
+ echo "VERSION=\"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} ${BOARD_NAME}\""
+ echo "ID=${OVOS_ID}"
+ echo "VERSION_ID=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}"
+ echo "PRETTY_NAME=\"${OVOS_NAME} ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} ${BOARD_NAME}\""
+ echo "CPE_NAME=cpe:2.3:o:openvoiceos:${OVOS_ID}:${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}:*:${DEPLOYMENT}:*:*:*:${BOARD_ID}:*"
+ echo "HOME_URL=https://github.com/OpenVoiceOS/OpenVoiceOS"
+ echo "DOCUMENTATION_URL=https://github.com/OpenVoiceOS/OpenVoiceOS/tree/develop/documentation"
+ echo "SUPPORT_URL=https://github.com/OpenVoiceOS/OpenVoiceOS/issues"
+ echo "VARIANT=\"${OVOS_NAME} - Mycroft Edition\""
+ echo "VARIANT_ID=${OVOS_ID}-${BOARD_ID}-mycroft"
+} > "${TARGET_DIR}/usr/lib/os-release"
+
+# Write machine-info
+{
+ echo "CHASSIS=${CHASSIS}"
+ echo "DEPLOYMENT=${DEPLOYMENT}"
+} > "${TARGET_DIR}/etc/machine-info"
+
+cp -f ../buildroot-external/board/raspberrypi/config.txt ${BINARIES_DIR}/rpi-firmware/config.txt
+cp -f ../buildroot-external/board/raspberrypi/cmdline.txt ${BINARIES_DIR}/rpi-firmware/cmdline.txt
diff --git a/buildroot-external/meta b/buildroot-external/meta
new file mode 100644
index 00000000..70f32576
--- /dev/null
+++ b/buildroot-external/meta
@@ -0,0 +1,8 @@
+VERSION_MAJOR=0
+VERSION_MINOR=1
+VERSION_BUILD=0
+
+OVOS_NAME="OpenVoiceOS"
+OVOS_ID="ovos"
+
+DEPLOYMENT="development"