blob: b85be195b692ae5b8fa67d60bc5dd2ae06bcdc27 [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001From 55ca589ab9e6e719c1e1f9fc72997d1643d28fe3 Mon Sep 17 00:00:00 2001
2From: Allan Xavier <mr.a.xavier@googlemail.com>
3Date: Thu, 12 Jan 2023 12:08:55 +0000
4Subject: [PATCH] Fix rpi-eeprom-update when using busybox find
5
6The busybox implementation of find does not detect recursive nested
7symlinks, this results in it finding multiple instances of of_node
8matching -samefile, the result of which then fails the -e path test.
9
10The of_node symlink we're tyring to find should match the path
11/sys/bus/nvmem/devices/*/of_node so just limit the find depth to 3 as
12there's no point searching deeper than that.
13
14Signed-off-by: Allan Xavier <mr.a.xavier@googlemail.com>
15
16Upstream-Status: Backport [https://github.com/raspberrypi/rpi-eeprom/commit/55ca589ab9e6e719c1e1f9fc72997d1643d28fe3]
17---
18 rpi-eeprom-update | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/rpi-eeprom-update b/rpi-eeprom-update
22index 79eb3bf..cb25316 100755
23--- a/rpi-eeprom-update
24+++ b/rpi-eeprom-update
25@@ -126,7 +126,7 @@ getBootloaderConfig() {
26
27 if [ -f "${blconfig_alias}" ]; then
28 local blconfig_ofnode_path="/sys/firmware/devicetree/base"$(strings "${blconfig_alias}")""
29- local blconfig_ofnode_link=$(find -L /sys/bus/nvmem -samefile "${blconfig_ofnode_path}" 2>/dev/null)
30+ local blconfig_ofnode_link=$(find -L /sys/bus/nvmem -maxdepth 3 -samefile "${blconfig_ofnode_path}" 2>/dev/null)
31
32 if [ -e "${blconfig_ofnode_link}" ]; then
33 blconfig_nvmem_path=$(dirname "${blconfig_ofnode_link}")
34--
352.34.1
36