From fcccef86c44bdcbf61857dcfe1b46c99790c5ae6 Mon Sep 17 00:00:00 2001 From: Adam Stolcenburg Date: Mon, 22 Dec 2025 12:35:44 +0100 Subject: [PATCH 1/3] Apply access rights to the Wayland and Rialto sockets The wayland socket in the builds for the brcm974116sff platform does not have write permissions for other users, therefore a correction of access rights is necessary. Ref: #RDKEAPPRT-510 --- bolt/src/run.cjs | 37 ++++------------------- bolt/src/runtime-config.cjs | 59 +++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/bolt/src/run.cjs b/bolt/src/run.cjs index 346ac54..27d3ffb 100644 --- a/bolt/src/run.cjs +++ b/bolt/src/run.cjs @@ -18,6 +18,7 @@ */ const { Remote } = require('./Remote.cjs'); +const runtime = require('./runtime-config.cjs'); const { makeTemplate, applyGPUConfig } = require('./runtime-config.cjs'); const config = require('./config.cjs'); @@ -302,45 +303,17 @@ function run(remoteName, pkg, options) { } setupResources(remote, pkg); - - const waylandSocketPath = getWaylandSocketPath(pkg); - if (remote.socketExists(waylandSocketPath)) { - bundleConfig.mounts.push({ - source: waylandSocketPath, - destination: waylandSocketPath, - type: "bind", - options: [ - "rbind", - "rw" - ] - }); - const pathArray = waylandSocketPath.split("/"); - bundleConfig.process.env.push(`WAYLAND_DISPLAY=${pathArray.pop()}`); - bundleConfig.process.env.push(`XDG_RUNTIME_DIR=${pathArray.join("/")}`); - } - - const rialtoSocketPath = getRialtoSocketPath(pkg); - if (remote.socketExists(rialtoSocketPath)) { - bundleConfig.mounts.push({ - source: rialtoSocketPath, - destination: rialtoSocketPath, - type: "bind", - options: [ - "rbind", - "rw" - ] - }); - bundleConfig.process.env.push(`RIALTO_SOCKET_PATH=${rialtoSocketPath}`); - } + const waylandAvailable = runtime.configureWaylandSocket(remote, bundleConfig, getWaylandSocketPath(pkg)); + const rialtoAvailable = runtime.configureRialtoSocket(remote, bundleConfig, getRialtoSocketPath(pkg)); layerDirs.reverse(); prepareBundle(remote, pkg, bundleConfig, layerDirs, options); - if (!remote.socketExists(rialtoSocketPath)) { + if (!rialtoAvailable) { console.warn('\n\n\x1b[31mRialto socket not available! Playback not supported!\x1b[0m\n\n'); } - if (!remote.socketExists(waylandSocketPath)) { + if (!waylandAvailable) { console.warn('\n\n\x1b[31mWayland socket not available! Graphics rendering not available!\x1b[0m\n\n'); } diff --git a/bolt/src/runtime-config.cjs b/bolt/src/runtime-config.cjs index bc0dcdb..ffc7bc5 100644 --- a/bolt/src/runtime-config.cjs +++ b/bolt/src/runtime-config.cjs @@ -302,17 +302,21 @@ function hexToNumber(str) { throw new Error(`Cannot parse ${str} as hex number`); } +function applyAccessRights(remote, groupIds, path, perm, groupName) { + if (perm[7] === "r" && perm[8] === "w") { + } else if (groupIds.includes(groupName) && perm[4] === "r" && perm[5] === "w") { + } else { + console.warn(`Changing access rights for ${path}! (was ${perm}, group: ${groupName})`); + remote.exec(`chmod a+rw ${path}`); + } +} + function processDevNodeEntry(remote, config, devNode, groupIds) { try { const [perm, majorHex, minorHex, groupName] = remote.exec(`stat -c '%A:%t:%T:%G' ${devNode}`).trim().split(":"); if (perm.length === 10 && (perm[0] === "c" || perm[0] === "b")) { addDevice(config, devNode, perm[0], hexToNumber(majorHex), hexToNumber(minorHex)); - if (perm[7] === "r" && perm[8] === "w") { - } else if (groupIds.includes(groupName) && perm[4] === "r" && perm[5] === "w") { - } else { - console.warn(`Changing access rights for ${devNode}! (was ${perm}, group: ${groupName})`); - remote.exec(`chmod a+rw ${devNode}`); - } + applyAccessRights(remote, groupIds, devNode, perm, groupName); } else { throw new Error(`not a device (perm: ${perm})`); } @@ -386,5 +390,48 @@ function applyGPUConfig(remote, config, gpuConfig) { } } +function configureWaylandSocket(remote, bundleConfig, waylandSocketPath) { + if (remote.socketExists(waylandSocketPath)) { + const [perm, groupName] = remote.exec(`stat -c '%A:%G' ${waylandSocketPath}`).trim().split(":"); + applyAccessRights(remote, [], waylandSocketPath, perm, groupName); + + bundleConfig.mounts.push({ + source: waylandSocketPath, + destination: waylandSocketPath, + type: "bind", + options: [ + "rbind", + "rw" + ] + }); + const pathArray = waylandSocketPath.split("/"); + bundleConfig.process.env.push(`WAYLAND_DISPLAY=${pathArray.pop()}`); + bundleConfig.process.env.push(`XDG_RUNTIME_DIR=${pathArray.join("/")}`); + return true; + } + return false; +} + +function configureRialtoSocket(remote, bundleConfig, rialtoSocketPath) { + if (remote.socketExists(rialtoSocketPath)) { + const [perm, groupName] = remote.exec(`stat -c '%A:%G' ${rialtoSocketPath}`).trim().split(":"); + applyAccessRights(remote, [], rialtoSocketPath, perm, groupName); + bundleConfig.mounts.push({ + source: rialtoSocketPath, + destination: rialtoSocketPath, + type: "bind", + options: [ + "rbind", + "rw" + ] + }); + bundleConfig.process.env.push(`RIALTO_SOCKET_PATH=${rialtoSocketPath}`); + return true; + } + return false; +} + exports.makeTemplate = makeTemplate; exports.applyGPUConfig = applyGPUConfig; +exports.configureWaylandSocket = configureWaylandSocket; +exports.configureRialtoSocket = configureRialtoSocket; From 491e3d8ae2579f6ae749b1a425ad26cfa6fde19f Mon Sep 17 00:00:00 2001 From: Adam Stolcenburg Date: Mon, 22 Dec 2025 12:43:52 +0100 Subject: [PATCH 2/3] Add fallback mechanism for seletected GPU layer libraries Although some GPU layer libraries may not exist in the rootfs file system, they can be replaced with symbolic links to libraries whose names include the version number. This change adds a fallback mechanism for this case and activates it for: - /usr/lib/libEGL.so - /usr/lib/libGLESv1_CM.so - /usr/lib/libGLESv2.so Ref: #RDKEAPPRT-510 --- gpu-layer-poc/setup-gpu-layer.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gpu-layer-poc/setup-gpu-layer.sh b/gpu-layer-poc/setup-gpu-layer.sh index edf4ccd..ca31c09 100755 --- a/gpu-layer-poc/setup-gpu-layer.sh +++ b/gpu-layer-poc/setup-gpu-layer.sh @@ -45,6 +45,12 @@ LIBS+=(/usr/lib/libGLESv2.so) LIBS+=(/usr/lib/libGLESv2.so.2) LIBS+=(/usr/lib/libwayland-egl.so.1) +declare -A FILE_INFO_FALLBACK + +FILE_INFO_FALLBACK[/usr/lib/libEGL.so]="'libEGL.so' -> 'libEGL.so.1'" +FILE_INFO_FALLBACK[/usr/lib/libGLESv1_CM.so]="'libGLESv1_CM.so' -> 'libGLESv1_CM.so.1'" +FILE_INFO_FALLBACK[/usr/lib/libGLESv2.so]="'libGLESv2.so' -> 'libGLESv2.so.2'" + BASE_LIBS+=(libwayland-server.so) BASE_LIBS+=(libwayland-client.so) BASE_LIBS+=(libdl.so) @@ -138,7 +144,7 @@ function main { PROCESSED_LIBS_SET[${lib}]=1 local file_info - file_info=$(remote stat -c '%N' "${lib}") + file_info=$(remote stat -c '%N' "${lib}" 2> /dev/null || echo "${FILE_INFO_FALLBACK[${lib}]}") echo "Processing ${lib}..." From 6d9819805e4c5bc80108cbf7e8f4fd54b8a44f01 Mon Sep 17 00:00:00 2001 From: Adam Stolcenburg Date: Mon, 22 Dec 2025 12:53:14 +0100 Subject: [PATCH 3/3] Add GPU layer PoC config for brcm974116sff Use the default configuration for the platform if no configuration is provided for the detected firmware version. Ref: #RDKEAPPRT-510 --- gpu-layer-poc/brcm974116sff.json | 21 +++++++++++++++++++++ gpu-layer-poc/setup-gpu-layer.sh | 17 ++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 gpu-layer-poc/brcm974116sff.json diff --git a/gpu-layer-poc/brcm974116sff.json b/gpu-layer-poc/brcm974116sff.json new file mode 100644 index 0000000..3f78842 --- /dev/null +++ b/gpu-layer-poc/brcm974116sff.json @@ -0,0 +1,21 @@ +{ + "vendorGpuSupport": { + "devNodes": [ + "/dev/nexus", + "/dev/nexusmem", + "/dev/dri/card0", + "/dev/dri/card1", + "/dev/dri/renderD128" + ], + "groupIds": [ + "video" + ], + "files": [ + { + "type": "bind", + "source": "/tmp/nxserver_ipc", + "destination": "/tmp/nxserver_ipc" + } + ] + } +} diff --git a/gpu-layer-poc/setup-gpu-layer.sh b/gpu-layer-poc/setup-gpu-layer.sh index ca31c09..4d1b4a5 100755 --- a/gpu-layer-poc/setup-gpu-layer.sh +++ b/gpu-layer-poc/setup-gpu-layer.sh @@ -121,11 +121,18 @@ function add_deps { function main { local config_name local tmp_config - - config_name=$(get_platform)-$(get_version).json - - if [[ ! -f "${config_name}" ]]; then - echo "File ${config_name} not found, platform not supported." + local platform + local firmware_version + + platform=$(get_platform) + firmware_version=$(get_version) + + if [[ -f ${platform}-${firmware_version}.json ]]; then + config_name="${platform}-${firmware_version}.json" + elif [[ -f ${platform}.json ]]; then + config_name="${platform}.json" + else + echo "Config for platform ${platform} not found (${firmware_version})" exit 2 fi