Normalize null-separated dtc multi-string output in DTB checks
This commit is contained in:
1 parent
f6b42ff604
commit
edc8c5a6fc
4 files changed
+9
-4
No files matched your search
@@ -25,6 +25,7 @@ OUTPUT = BASE / "images/qcom-msm8905-nokia-beatles-cover.dtb"
|
||||
|
||||
|
||||
def validate(text):
|
||||
text = text.replace(r"\0", '", "')
|
||||
checks = (
|
||||
'compatible = "spi-mux";',
|
||||
'compatible = "gpio-mux";',
|
||||
|
||||
@@ -2278,7 +2278,7 @@ done
|
||||
if command -v dtc >/dev/null 2>&1; then
|
||||
for dtb in "$BASE_DIR"/prebuilt/kernel-6.12.1-msm8916/dtbs/*.dtb; do
|
||||
[ -f "$dtb" ] || continue
|
||||
dec_dts="$(dtc -q -I dtb -O dts "$dtb" 2>/dev/null || true)"
|
||||
dec_dts="$(dtc -q -I dtb -O dts "$dtb" 2>/dev/null | sed 's/\\0/", "/g' || true)"
|
||||
if [ -z "$dec_dts" ]; then
|
||||
fail "failed to decompile ${dtb#"$BASE_DIR/"}"
|
||||
elif printf "%s\n" "$dec_dts" | grep -qE 'cd-gpios|broken-cd'; then
|
||||
@@ -2309,7 +2309,7 @@ if ! awk '/resin \{/,/\};/ { if ($0 ~ /linux,code = <0x6c>;/) found=1 } END { ex
|
||||
fi
|
||||
COCONUT_DTB="$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb"
|
||||
if command -v dtc >/dev/null 2>&1 && [ -f "$COCONUT_DTB" ]; then
|
||||
dec_coco="$(dtc -q -I dtb -O dts "$COCONUT_DTB" 2>/dev/null || true)"
|
||||
dec_coco="$(dtc -q -I dtb -O dts "$COCONUT_DTB" 2>/dev/null | sed 's/\\0/", "/g' || true)"
|
||||
if ! printf "%s\n" "$dec_coco" | grep -qF '"gpio0", "gpio3", "gpio7", "gpio99", "gpio6", "gpio1"' || \
|
||||
printf "%s\n" "$dec_coco" | grep -qF '"gpio52", "gpio56"' || \
|
||||
! printf "%s\n" "$dec_coco" | grep -qF '0x3030067' || \
|
||||
@@ -2352,7 +2352,7 @@ if ! grep -qF '0x500d4' "$SPARKLER_DTS" || \
|
||||
fail "devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts drifted from Sxmo keypad, CPU clock, or haptic invariants"
|
||||
fi
|
||||
if command -v dtc >/dev/null 2>&1 && [ -f "$SPARKLER_DTB" ]; then
|
||||
dec_sparkler="$(dtc -q -I dtb -O dts "$SPARKLER_DTB" 2>/dev/null || true)"
|
||||
dec_sparkler="$(dtc -q -I dtb -O dts "$SPARKLER_DTB" 2>/dev/null | sed 's/\\0/", "/g' || true)"
|
||||
if ! printf "%s\n" "$dec_sparkler" | grep -qF 'qcom,msm-id = <0xf5 0x00>;' || \
|
||||
! printf "%s\n" "$dec_sparkler" | grep -qF 'qcom,board-id = <0x08 0x100>;' || \
|
||||
! printf "%s\n" "$dec_sparkler" | grep -qF 'reg = <0x80000000 0x20000000>;' || \
|
||||
|
||||
@@ -78,7 +78,7 @@ def decompile(dtb, target):
|
||||
str(dtb)], capture_output=True, text=True)
|
||||
if proc.returncode:
|
||||
return None
|
||||
return target.read_text(encoding="utf-8", errors="replace")
|
||||
return target.read_text(encoding="utf-8", errors="replace").replace(r"\0", '", "')
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -93,7 +93,11 @@ class TestSparklerPort(unittest.TestCase):
|
||||
# 1094400000 Hz in big-endian u32 is 0x413b3800 ("A;8\0" in ASCII)
|
||||
self.assertGreaterEqual(raw_dtb.count(b"\x41\x3b\x38\x00"), 4, dtb_rel)
|
||||
dec = subprocess.check_output([dtc, "-q", "-I", "dtb", "-O", "dts", dtb_path], text=True)
|
||||
dec = dec.replace(r"\0", '", "')
|
||||
self._assert_dts_invariants(dec)
|
||||
null_joined = dec.replace('"nokia,sparkler", "qcom,msm8909"', r'"nokia,sparkler\0qcom,msm8909"')
|
||||
self.assertIn(r'compatible = "nokia,sparkler\0qcom,msm8909";', null_joined)
|
||||
self._assert_dts_invariants(null_joined.replace(r"\0", '", "'))
|
||||
|
||||
def test_smp_cpufreq_haptic_audio_and_camera_fixes(self):
|
||||
patch_0013 = read_text("patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch")
|
||||
|
||||
Reference in new issue
Block a user