Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 1 | From 55ca589ab9e6e719c1e1f9fc72997d1643d28fe3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Allan Xavier <mr.a.xavier@googlemail.com> |
| 3 | Date: Thu, 12 Jan 2023 12:08:55 +0000 |
| 4 | Subject: [PATCH] Fix rpi-eeprom-update when using busybox find |
| 5 | |
| 6 | The busybox implementation of find does not detect recursive nested |
| 7 | symlinks, this results in it finding multiple instances of of_node |
| 8 | matching -samefile, the result of which then fails the -e path test. |
| 9 | |
| 10 | The 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 |
| 12 | there's no point searching deeper than that. |
| 13 | |
| 14 | Signed-off-by: Allan Xavier <mr.a.xavier@googlemail.com> |
| 15 | |
| 16 | Upstream-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 | |
| 21 | diff --git a/rpi-eeprom-update b/rpi-eeprom-update |
| 22 | index 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 | -- |
| 35 | 2.34.1 |
| 36 | |