From 0328163a9e81871ced2376566bcc3e8130ffcad6 Mon Sep 17 00:00:00 2001 From: mofeng-git Date: Sat, 27 Sep 2025 16:45:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8E=A9=E5=AE=A2=E4=BA=91=20sn=20?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/scripts/generate-random-mac.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/generate-random-mac.sh b/build/scripts/generate-random-mac.sh index 7cd016bf..b7d0d4f3 100644 --- a/build/scripts/generate-random-mac.sh +++ b/build/scripts/generate-random-mac.sh @@ -54,7 +54,7 @@ generate_random_mac() { if [ -f "$EFUSE_SYSFS_PATH" ]; then sn_offset=$(grep --binary-files=text -boP "$SN_PREFIX" "$EFUSE_SYSFS_PATH" | head -n1 | cut -d: -f1) if [ -n "$sn_offset" ]; then - sn=$(dd if="$EFUSE_SYSFS_PATH" bs=1 skip="$sn_offset" count="$SN_EXPECTED_LENGTH" 2>/dev/null) + sn=$(cat "$EFUSE_SYSFS_PATH" | dd bs=1 skip="$sn_offset" count="$SN_EXPECTED_LENGTH" 2>/dev/null) if [ ${#sn} -eq $SN_EXPECTED_LENGTH ]; then echo "S/N: $sn" >&2 # 输出到 stderr,避免干扰返回值 # 使用 SN 的 SHA-256 哈希生成后 5 字节(避免多余管道)