From 0039f93de67aca5e3a870a49b19d5d6c8d55c17f Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 21 Mar 2021 14:58:10 +0100 Subject: [PATCH] busybox: add create-edid-cpio script This script simply creates /flash/edid.cpio with the contents from .config/firmware/edid Compared to the x86 specific getedid script this works on all platforms as it doesn't contain any platform specific code. Eventually getedid should be refactored make use of this helper script, too. Signed-off-by: Matthias Reichl --- packages/sysutils/busybox/package.mk | 1 + .../sysutils/busybox/scripts/create-edid-cpio | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 packages/sysutils/busybox/scripts/create-edid-cpio diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk index 9556a1c488..272aa4dc2f 100644 --- a/packages/sysutils/busybox/package.mk +++ b/packages/sysutils/busybox/package.mk @@ -123,6 +123,7 @@ makeinstall_host() { makeinstall_target() { mkdir -p ${INSTALL}/usr/bin [ ${TARGET_ARCH} = x86_64 ] && cp ${PKG_DIR}/scripts/getedid ${INSTALL}/usr/bin + cp ${PKG_DIR}/scripts/create-edid-cpio ${INSTALL}/usr/bin/ cp ${PKG_DIR}/scripts/createlog ${INSTALL}/usr/bin/ cp ${PKG_DIR}/scripts/dthelper ${INSTALL}/usr/bin ln -sf dthelper ${INSTALL}/usr/bin/dtfile diff --git a/packages/sysutils/busybox/scripts/create-edid-cpio b/packages/sysutils/busybox/scripts/create-edid-cpio new file mode 100755 index 0000000000..d98362886e --- /dev/null +++ b/packages/sysutils/busybox/scripts/create-edid-cpio @@ -0,0 +1,36 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv) + +EDID_DIR="/storage/.config/firmware/edid" +EDID_CPIO="/flash/edid.cpio" +TMPDIR="/tmp/edid-cpio" + +if [ "$1" = "-q" ]; then + VERBOSE=0 +else + VERBOSE=1 +fi + +if [ ! -d "${EDID_DIR}" ]; then + echo "error: ${EDID_DIR} does not exist" + exit 1 +fi + +set -e + +rm -rf "${TMPDIR}" +mkdir -p "${TMPDIR}/usr/lib/firmware" +cp -r "${EDID_DIR}" "${TMPDIR}/usr/lib/firmware" +cd "${TMPDIR}" +mount -o remount,rw /flash +find usr -print | cpio -ov -H newc > "${EDID_CPIO}" +sync +mount -o remount,ro /flash +cd /storage +rm -rf "${TMPDIR}" + +if [ "${VERBOSE}" = "1" ]; then + echo "successfully created ${EDID_CPIO}" +fi