Compare commits

...
Author SHA1 Message Date
BFE EngineeringandClaude Haiku 5.5 ccf9359e31 Revert CPLL 900 MHz pin: render check missed [skip ci]
Decision pass 3 (2026-11-06) says that any miss in the .52 30-minute UI
check reverts the CPLL change to 1000 MHz and returns the item to the
orchestrator. The check ran on 2026-11-11 with flare-edge 201f74f9c
(candidate, pins feb66fd) against 4923dc4cc (baseline, pre-change pin).
The two flare-edge commits differ only in the vendor/warden-sdk pin.
Recomputed from the four 30-minute CSVs (two runs per image):

- render_ms mean: 12.33 and 12.48 ms (candidate) against 12.70 and
  12.79 ms (baseline): better.
- render_max top-10 mean: 56.44 and 56.32 ms against 50.11 and 55.20 ms:
  worse in both runs.
- frames above 50 ms: 7 and 8 against 4 and 6: worse.
- worst frame: 69.47 and 78.00 ms against 59.85 and 76.32 ms: worse.
- dmesg: 34 lines before and 34 after each run, so no new DDR, AXI,
  VOP or RGA lines.

The tail metrics miss the decision's "no worse" rule. This commit
restores the upstream cru assigned-clocks in
patches/20-arch-dts-bindings.patch (PLL_CPLL 1000 MHz, no 50, 100 or
30 MHz pins) and removes the static clock-plan check added by feb66fd.
The bench helpers from 97903d5 stay. Panels .52 to .56 already run the
pre-change clock (dclk_vop 31250000 Hz, read 2026-11-13), so no bench
revert is needed.

Re-apply feb66fd to test the 900 MHz plan again if the orchestrator
accepts the tail tradeoff.

Refs bfe-core1106-sdk#43
Refs flare-edge#3204 (GIC 121 leg still open)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGNpGNtFT7nhShpH56
2026-11-13 20:09:56 -06:00
BFE EngineeringandClaude Haiku 5.5 97903d55f4 VOP pixel clock: bench helpers for the 30 MHz proof [skip ci]
Panel-side helpers for the bfe-core1106-sdk#43 bench proof on panels
.52 to .56 (2026-11-11): the clock and eth0 check (vopcheck.sh), the
30-minute UI stats workload (uirun.sh), the GIC 121 frame-start count
(gic121.sh) and the run summary (summarize.py). The helpers read
clk_summary and the DRM mode; they add no build or kernel change.

Refs bfe-core1106-sdk#43. Image built from flare-edge 201f74f9c, which
pins this branch at feb66fd.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz
2026-11-11 11:52:46 -06:00
BFE EngineeringandClaude Haiku 5.5 feb66fd863 Linux VOP pixel clock: CPLL 900 MHz pins the 30 MHz mode [skip ci]
dclk_vop_src is a composite with a 5-bit divider, so from the 1000 MHz
Linux CPLL the nearest reachable rate to 30 MHz is 31.25 MHz. The panel
then refreshed at 50.9 Hz, not the 48.87 Hz of the mode. U-Boot retunes
CPLL to 960 MHz, which gives an exact 30 MHz but breaks the 50 MHz GMAC
RMII reference (no exact divider at 960).

At CPLL 900 MHz, /30 gives exactly 30 MHz, /18 exactly 50 MHz (GMAC)
and /9 exactly 100 MHz (APB, PWM, watchdog). The cru node sets PLL_CPLL
to 900 MHz and pins CLK_50M_SRC, CLK_100M_SRC and DCLK_VOP_SRC right
after it. aclk_ddr_root falls from 500 to 450 MHz and clk_250m_src from
250 to 225 MHz; no driver change.

tests/vop-dclk/check-vop-dclk.py reads the clock plan from the patch
series (list order, PLL table, IDs, exact dividers, hunk line counts);
run-check-vop-dclk-tests.sh breaks one thing per case.

Fixes #43
Refs flare-edge#3204

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz
2026-11-10 00:36:43 -06:00
BFE EngineeringandClaude Haiku 5.5 d1011ce9d8 Merge sp/adbd-tcp-off into sprint [skip ci]
Brings in luckfox board patch 0015, which removes the adbd TCP listeners
on port 5555 and on 127.0.0.1:5037, plus the fail-closed adbd build rule
and the regression tests for both. Sprint had no commits past the branch
base, so the merge tree equals the branch tip.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz
2026-11-09 14:44:51 -06:00
BFE EngineeringandClaude Haiku 5.5 fabd79f60e Fail the adbd rule on a failed step, test the real gate [skip ci]
The android-tools rule in board patch 0015 ignored failed steps. A debian
series entry or android-tools.patch.sh step that stopped applying, a failed
build, and a failed copy into out/usr/bin all went on, and the stamp was
written after them. The stamp then marked a binary that was not built from
the patch set as current, which is the failure class of bfe-core1106-sdk#44
(bfe-core1106-sdk#45).

The rule now stops at each failed step. android-tools.patch.sh runs with
-e, so a failed middle step is not hidden by the status of the last patch,
and the stamp is written last. On a clean patch set the commands run are
the same as before; only the failure paths differ.

tests/test-adbd-no-tcp.sh runs the rule under make with stub toolchains, so
nothing compiles. It evaluates ADBD_INPUTS through make and compares it with
the sha256 of the Makefile, adbd-current.sh and the patch set. It checks the
skip and rebuild cases and five injected failures that must stop the rule
with no stamp. The old test replayed the steps by hand and recomputed the
gate formula, so a Makefile with a different ADBD_INPUTS still passed
(bfe-core1106-sdk#46).

tests/adbd-no-tcp-cases.sh runs the real patch (must pass), the unpatched
base (must fail) and three mutants of the patch, each of which must fail for
its own reason: ADBD_INPUTS over the Makefile only, no fail-fast, and an
unchecked copy. The pre-fix 0015 fails four of the five fail-closed cases,
and the stamp is written in each of the four.

[skip ci] keeps this push from starting a CI run: no CI runs until the
scada rebuild is verified.

Fixes #45
Fixes #46
Refs #44

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGbdxD3FcrGMcjLNhv
2026-11-06 09:41:25 -06:00
BFE EngineeringandClaude Haiku 5.5 0d00b93a63 Drop adbd TCP listeners (flare-edge#3129)
adbd opened TCP 5555 on 0.0.0.0 and tcp:5037 on 127.0.0.1 on every panel.
Rockchip's 0015 android-tools patch enables the TCP listener whenever USB is
up, and S50usbdevice starts adbd with no arguments.

Board patch 0015 adds android-tools-patches/0017-no-adb-tcp-listener.patch,
which removes both listener calls from the device half of adb_main(). USB
stays the only transport.

The same patch makes the adbd build depend on a stamp of its inputs. The old
gate rebuilt adbd only when out/usr/bin/adbd was missing, so a patch-set change
never reached an SDK tree that already held the binary (bfe-core1106-sdk#44).

tests/test-adbd-no-tcp.sh replays the android-tools build on the base tree and
checks the listener calls and the rebuild gate. It compiles nothing; the
unpatched base fails it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qGbdxD3FcrGMcjLNhv
2026-11-06 09:33:30 -06:00
noah b8d9d541fe Merge pull request 'qemu: rig agent, a framed guest shell on its own serial port (flare-edge M9 soak-lite)' (#40) from rb/d15-rig-agent into rebuild
ci / test (push) Skipped
ci / mcdc (push) Skipped
ci / bench (push) Skipped
ci / qemu-tools (push) Skipped
ci / kernel-symbols (push) Skipped
ci / patches-apply (push) Skipped
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / quality (push) Skipped
ci / badges (push) Skipped
2026-10-31 19:40:35 -06:00
9 changed files with 697 additions and 2 deletions
+43 -2
View File
@@ -60,6 +60,7 @@ luckfox-sdk-patches/wifi/patches/ diffs against sysdrv/drv_ko/wifi/ (out-of-
luckfox-sdk-patches/board/patches/ diffs against project/ and sysdrv/ build files (board .mk,
build drivers, Makefiles, init overlays); may delete files
luckfox-sdk-patches/buildroot/ our delta on the Buildroot tree (see "Buildroot" below)
luckfox-sdk-patches/tests/ regression tests for the series (see "Regression tests")
```
Paths inside each patch are relative to the vendor SDK root, so apply with
@@ -102,6 +103,24 @@ tree alone. flare-edge's `tools/build-firmware.sh` runs it right after
applying the patches, then stages `buildroot/files/` and applies
`buildroot/patches/` onto the tree (issue #4).
## Regression tests
`tests/test-adbd-no-tcp.sh BASE_DIR PATCH_FILE|none` applies the board patch to
a copy of the base tree and runs the android-tools rule of the Makefile under
make. It checks the adbd TCP listener removal (flare-edge#3129), the rule's
fail-closed behaviour (bfe-core1106-sdk#45) and the adbd rebuild gate as the
Makefile evaluates it (bfe-core1106-sdk#44, #46). `BASE_DIR` is the luckfox base
commit 824b817f8, `sysdrv/tools/board/android-tools` only:
git -C <luckfox-sdk> archive 824b817f8 sysdrv/tools/board/android-tools | tar -C BASE_DIR -xf -
sh tests/test-adbd-no-tcp.sh BASE_DIR board/patches/0015-adbd-no-tcp-listener.patch
sh tests/adbd-no-tcp-cases.sh BASE_DIR board/patches/0015-adbd-no-tcp-listener.patch
The toolchain is a stub: the compiler stub only creates its output file, so
nothing is compiled. Run the test with `none` as the patch file to see the base
fail. `adbd-no-tcp-cases.sh` runs the real patch (must pass), the unpatched base
and three mutants of the patch (each must fail for the reason it names).
## Completeness check
flare-edge's `tools/verify-sdk-patches.sh` replays this series onto the vendor
@@ -123,7 +142,7 @@ had to be fixed before it did. Each was measured on hardware, not inferred.
|---|---|
| `rockchip_display.c` | `malloc` -> `calloc`. `enabled_at_spl` is only ever assigned under `#ifdef CONFIG_SPL_BUILD`, so in U-Boot proper it read uninitialised heap. Garbage read as truthy meant `display_enable()` skipped the connector pre-enable/enable path -- the only path that reaches `backlight_enable()`. |
| `pwm_backlight.c` | `args.args[2] & 1`. The DT has `pwms = <&pwm1 0 100000 50000>`; assigning `50000` to a `bool` polarity field inverted the PWM. Measured `DUTY=0x26e8` (99.6%) with `CTRL=0x13`; after the fix `CTRL=0x0b`. The backlight was running at 0.4%. |
| `clk_rv1106.c` | Two bugs. `rv1106_clk_set_rate()` returned a stale `ret` instead of the computed `rate`, so it always reported 0 Hz. And `DCLK_VOP_DIV_MASK` is 5 bits (max ÷32) while `DIV_ROUND_UP(1188 MHz, 30 MHz) = 40` wrote 39, truncated to 7 -- **the VOP was running at 125 MHz, not 30**. Now clamps to 32, picks the closest parent, and retunes CPLL 1000 -> 960 MHz when neither divides evenly, giving exactly 30.000 MHz. |
| `clk_rv1106.c` | Two bugs. `rv1106_clk_set_rate()` returned a stale `ret` instead of the computed `rate`, so it always reported 0 Hz. And `DCLK_VOP_DIV_MASK` is 5 bits (max /32) while `DIV_ROUND_UP(1188 MHz, 30 MHz) = 40` wrote 39, truncated to 7 -- **the VOP was running at 125 MHz, not 30**. Now clamps to 32, picks the closest parent, and retunes CPLL 1000 -> 960 MHz when neither divides evenly, giving exactly 30.000 MHz. |
| `rockchip_panel.c` | `FLARE_PANEL_SETTLE_MS`: wait after scanout starts before switching the backlight on. See the comment in the file -- it distinguishes two artefacts that look similar and have different causes. |
| `board.c` | Release `RGB_RES` (GPIO0_A1) at the top of `board_init()` instead of `board_late_init()`, and `FLARE_TRACE` instrumentation. `setup_download_mode()` is deliberately kept **first** in `board_late_init()`: moving the logo ahead of it pushed BOOT-key sampling from 1.18 s to ~4-5 s and the key had to be held for eight seconds. |
| `rv1106-u-boot.dtsi` | `u-boot,spl-boot-order = <&emmc>`. It was `<&sdmmc, &spi_nor, &spi_nand, &emmc>` -- the only fitted medium was last. Walking the dead entries cost **267 ms** every boot: ~212 ms failing to identify a non-existent SPI-NAND (`unknown raw ID 0 0 0`) and ~57 ms probing an SD slot this board does not have (`sdmmc` is wired to the AIC8800 WiFi as SDIO). **This file is shared by every rv1106 U-Boot build in the tree**; an SD- or SPI-NAND-booting variant would no longer boot. |
@@ -294,6 +313,28 @@ had masked it (the reproducibility gap `tools/build-firmware.sh` exists to close
`sysdrv/source/uboot/u-boot/configs/` (it is a whole new file, not a diff);
the board `.mk` patch is what references it by name.
### `board/patches/0015-adbd-no-tcp-listener.patch` (flare-edge#3129)
Rockchip's android-tools patch `0015-make-adb-tcp-function-default-enbale.patch`
made `adb_main()` open TCP 5555 whenever USB is up, and the non-secure branch
opened `tcp:5037` on 127.0.0.1. S50usbdevice starts adbd with no arguments, so
every panel ran both (`0.0.0.0:5555` was reachable from the LAN). The patch
adds `android-tools-patches/0017-no-adb-tcp-listener.patch`, which removes both
calls from the device half of `adb_main()` and runs last in
`android-tools.patch.sh`. USB stays the only transport.
It also changes the Makefile gate. adbd was rebuilt only when `out/usr/bin/adbd`
was missing, so a patch-set change never reached an SDK tree that already held
the binary (bfe-core1106-sdk#44). `adbd-current.sh` now compares a stamp in
`out/.adbd-inputs` with a hash of the Makefile, the gate script and the patch
set, and the build writes that stamp.
The rule now stops at the first failed step (a debian series entry, an
`android-tools.patch.sh` step run with `-e`, the build, or the copy into
`out/usr/bin`), and the stamp is written last. A failed step therefore never
leaves a stamp for an adbd that was not built from the patch set
(bfe-core1106-sdk#45).
### `board/patches/0009` to `0013` (issue #4)
Deltas that lived only in the workstation SDK until issue #4. Each patch
@@ -322,7 +363,7 @@ already carries 0004 and 0008.
| fragment | why |
|---|---|
| `uboot/flare-display.config` | the DRM/panel/PWM symbols the logo path needs |
| `uboot/flare-verbose.config` | `CONFIG_BOOTSTAGE_PRINTF_TIMESTAMP=y` -- µs timestamps on every line. ~15 chars/line ~ 1.3 ms/line at 115200, so read instrumented timings as an upper bound |
| `uboot/flare-verbose.config` | `CONFIG_BOOTSTAGE_PRINTF_TIMESTAMP=y` -- us timestamps on every line. ~15 chars/line ~ 1.3 ms/line at 115200, so read instrumented timings as an upper bound |
| `uboot/flare-bootcount.config` | boot-failure fallback to `altbootcmd=download` -> MaskRom |
| `uboot/flare-spl-brom.config` | builds `spl_bootrom.o`; does *not* set `SPL_ROCKCHIP_BACK_TO_BROM`, which would flip `SPL_MMC_SUPPORT` off |
| `kernel/flare-backlight.config` | `CONFIG_BACKLIGHT_PWM=y`. As `=m` the backlight class device does not exist until userspace `insmod`s it at ~3.3-3.7 s, which is when the logo is being replaced anyway |
@@ -0,0 +1,158 @@
Drop adbd TCP listeners and rebuild on patch change
Rockchip's 0015 android-tools patch made adbd open TCP 5555 whenever USB is
up, and the non-secure branch also opened tcp:5037 on 127.0.0.1. S50usbdevice
starts adbd with no arguments, so every panel ran both listeners: 0.0.0.0:5555
(reachable from the LAN) and 127.0.0.1:5037. Found on bench panel 10.255.1.55
(flare-edge#3129).
This patch adds android-tools-patches/0017-no-adb-tcp-listener.patch, which
removes both calls from the device half of adb_main(), and applies it last in
android-tools.patch.sh. USB stays the only transport, so the USB adbd path is
unchanged.
It also closes a build gap (bfe-core1106-sdk#44). The Makefile rebuilt adbd
only when out/usr/bin/adbd was missing, so a patch-set change never reached an
image built on an SDK tree that already held the binary. The Makefile now
gates adbd on adbd-current.sh: the build writes a stamp holding a hash of the
Makefile, the gate script and the patch set, and a missing or stale stamp
rebuilds adbd.
The rule stops at the first failed step: a debian series entry, an
android-tools.patch.sh step (run with -e), the build, or the copy into
out/usr/bin. The stamp is written last, so no binary that was not built from
the patch set gets one (bfe-core1106-sdk#45).
Regression tests: luckfox-sdk-patches/tests/test-adbd-no-tcp.sh runs the rule
under make with stub toolchains. It checks the listeners, the fail-closed
cases, the stamp and the gate that the Makefile evaluates (bfe-core1106-sdk#46).
tests/adbd-no-tcp-cases.sh runs the real patch, the unpatched base and mutants
that must fail.
diff --git a/sysdrv/tools/board/android-tools/Makefile b/sysdrv/tools/board/android-tools/Makefile
index bb72255..889e983 100644
--- a/sysdrv/tools/board/android-tools/Makefile
+++ b/sysdrv/tools/board/android-tools/Makefile
@@ -23,6 +23,15 @@ PKG_TARBALL_DEBIAN := android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
PKG_BIN := out
PKG_INSTALL_BIN_DIR := $(CURRENT_DIR)/$(PKG_BIN)/usr/bin
+# flare-edge#3129: adbd is rebuilt whenever its inputs change. The stamp holds
+# the hash of this Makefile, adbd-current.sh and the android-tools patch set.
+# An adbd without a matching stamp (left in out/ by a build from other patches)
+# is built again from the regenerated source. Every step below stops the rule
+# when it fails, and the stamp is written last, so no binary that was not built
+# from the patch set gets one (bfe-core1106-sdk#45).
+ADBD_STAMP := $(CURRENT_DIR)/$(PKG_BIN)/.adbd-inputs
+ADBD_INPUTS := $(shell cat $(CURRENT_DIR)/Makefile $(CURRENT_DIR)/adbd-current.sh $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* | sha256sum | cut -d' ' -f1)
+
PKG_DEP_OPENSSL := $(CURRENT_DIR)/../toolkits/openssl
PKG_DEP_ZLIB := $(CURRENT_DIR)/../toolkits/zlib
@@ -36,7 +45,7 @@ PKG_CONF_OPTS += -mthumb -Wa,-mimplicit-it=thumb -mthumb-interwork
endif
all: dep-openssl
- @test -f $(PKG_INSTALL_BIN_DIR)/adbd || (\
+ @sh $(CURRENT_DIR)/adbd-current.sh $(PKG_INSTALL_BIN_DIR)/adbd $(ADBD_STAMP) $(ADBD_INPUTS) || (\
rm -rf $(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS); \
tar -xf $(PKG_TARBALL_ANDROID_TOOLS); \
tar -xf $(PKG_TARBALL_DEBIAN) -C $(PKG_NAME_ANDROID_TOOLS); \
@@ -45,16 +54,17 @@ all: dep-openssl
pushd $(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS)/; \
cp -af $(CURRENT_DIR)/$(PKG_PATCHES_ANDROID_TOOLS)/* ./; \
for item in `cat ./debian/patches/series`; do \
- patch -p1 < ./debian/patches/$$item; \
+ patch -p1 < ./debian/patches/$$item || exit 1; \
done; \
- $(SHELL) ./android-tools.patch.sh; \
+ $(SHELL) -e ./android-tools.patch.sh || exit 1; \
CC="$(SYSDRV_CROSS)-gcc" GCC="$(SYSDRV_CROSS)-gcc" CXX="$(SYSDRV_CROSS)-g++" CPP="$(SYSDRV_CROSS)-cpp" \
CFLAGS="$(PKG_CONF_OPTS)" CPPFLAGS="$(PKG_CONF_OPTS)" \
CXXFLAGS="$(PKG_CONF_OPTS)" LDFLAGS="$(PKG_CONF_OPTS) $(PKG_ADBD_BUILD_STATIC)" \
make -j$(SYSDRV_JOBS) -C $(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS)/$(PKG_BIN) \
SRCDIR=$(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS) \
-f $(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS)/debian/makefiles/adbd.mk 1>/dev/null || exit -1; \
- cp -f $(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS)/$(PKG_BIN)/adbd $(PKG_INSTALL_BIN_DIR)/ ; \
+ cp -f $(CURRENT_DIR)/$(PKG_NAME_ANDROID_TOOLS)/$(PKG_BIN)/adbd $(PKG_INSTALL_BIN_DIR)/ || exit 1; \
+ echo $(ADBD_INPUTS) > $(ADBD_STAMP) || exit 1; \
popd; )
$(SYSDRV_CROSS)-strip -s $(PKG_INSTALL_BIN_DIR)/adbd ;
@mkdir -p $(PKG_BIN)/etc/init.d;
diff --git a/sysdrv/tools/board/android-tools/adbd-current.sh b/sysdrv/tools/board/android-tools/adbd-current.sh
new file mode 100644
index 0000000..df4bd81
--- /dev/null
+++ b/sysdrv/tools/board/android-tools/adbd-current.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+# adbd-current.sh ADBD STAMP INPUTS
+# Exit 0 when the built adbd is current: it exists and its stamp holds the hash
+# of the inputs it was built from (see the stamp logic in the Makefile). Any
+# other state, including an adbd left by an older patch set, exits 1 so that
+# the Makefile regenerates the android-tools source and builds again.
+# flare-edge#3129, luckfox-sdk-patches/tests/test-adbd-no-tcp.sh.
+adbd=$1
+stamp=$2
+inputs=$3
+[ -f "$adbd" ] || exit 1
+[ -f "$stamp" ] || exit 1
+[ "$(cat "$stamp")" = "$inputs" ] || exit 1
+exit 0
diff --git a/sysdrv/tools/board/android-tools/android-tools-patches/0017-no-adb-tcp-listener.patch b/sysdrv/tools/board/android-tools/android-tools-patches/0017-no-adb-tcp-listener.patch
new file mode 100644
index 0000000..c487482
--- /dev/null
+++ b/sysdrv/tools/board/android-tools/android-tools-patches/0017-no-adb-tcp-listener.patch
@@ -0,0 +1,42 @@
+flare-edge#3129: no adbd TCP listener in the image
+
+Rockchip's 0015 patch made adb_main() open a TCP listener on 5555 whenever
+USB is up (local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT)). The non-secure
+branch also installs the tcp:5037 smartsocket listener, bound to 127.0.0.1.
+S50usbdevice starts adbd with no arguments, so both listeners were live on
+every panel: 0.0.0.0:5555 and 127.0.0.1:5037.
+
+This patch removes both calls. USB stays the only transport, so the USB adbd
+path (the shell over the gadget) is unchanged. The regression test is
+luckfox-sdk-patches/tests/test-adbd-no-tcp.sh.
+
+--- a/core/adbd/adb.c
++++ b/core/adbd/adb.c
+@@ -1298,13 +1298,9 @@
+ capset(&header, cap);
+
+ D("Local port disabled\n");
+- } else {
+- char local_name[30];
+- build_local_name(local_name, sizeof(local_name), server_port);
+- if(install_listener(local_name, "*smartsocket*", NULL, 0)) {
+- exit(1);
+- }
+- }
++ }
++ /* flare-edge#3129: the non-secure branch installs no smartsocket listener
++ either (it was tcp:5037, bound to 127.0.0.1). adbd opens no TCP port. */
+
+ int usb = 0;
+ if (access(USB_ADB_PATH, F_OK) == 0 || access(USB_FFS_ADB_EP0, F_OK) == 0) {
+@@ -1327,8 +1323,8 @@
+ //} else if (!usb)
+ if (usb) {
+ printf("Using USB\n");
+- // listen on default port
+- local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT);
++ // flare-edge#3129: the image opens no TCP listener. USB is the only
++ // transport; local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT) is not called.
+ }
+
+ D("adb_main(): pre init_jdwp()\n");
diff --git a/sysdrv/tools/board/android-tools/android-tools-patches/android-tools.patch.sh b/sysdrv/tools/board/android-tools/android-tools-patches/android-tools.patch.sh
index 2cb01e6..1a0470a 100755
--- a/sysdrv/tools/board/android-tools/android-tools-patches/android-tools.patch.sh
+++ b/sysdrv/tools/board/android-tools/android-tools-patches/android-tools.patch.sh
@@ -17,3 +17,4 @@ patch -p1 < 0014-Specify-login-shell-in-standard-way.patch
patch -p1 < 0015-make-adb-tcp-function-default-enbale.patch
patch -p1 < 0015-support-rsa-key-authentication.patch
patch -p1 < 0016-fix-static-link-dl-lll_unlock_wait_private.patch
+patch -p1 < 0017-no-adb-tcp-listener.patch
+100
View File
@@ -0,0 +1,100 @@
#!/bin/sh
# adbd-no-tcp-cases.sh BASE_DIR PATCH_FILE
#
# Runs test-adbd-no-tcp.sh on the real patch (must PASS), on the unpatched base
# (must FAIL), and on three mutants of the patch. Each mutant must FAIL, and its
# FAIL line must name the reason given here:
# gate-makefile-only ADBD_INPUTS hashes only the Makefile; the patch set and
# the gate script are dropped (bfe-core1106-sdk#46)
# no-fail-fast the rule ignores failed series, patch and copy steps,
# so a failed 0017 hunk still stamps adbd (bfe-core1106-sdk#45)
# copy-unchecked only the copy into out/usr/bin is unchecked, so a failed
# copy still writes the stamp (bfe-core1106-sdk#45)
# Usage and layout: see test-adbd-no-tcp.sh.
# Exit 0 when every case behaves as expected, 1 otherwise, 2 on usage.
set -u
LC_ALL=C
export LC_ALL
if [ $# -ne 2 ]; then
echo "usage: $0 BASE_DIR PATCH_FILE" >&2
exit 2
fi
HERE=$(cd "$(dirname "$0")" && pwd) || exit 2
TEST=$HERE/test-adbd-no-tcp.sh
BASE=$(cd "$1" && pwd) || exit 2
PATCH=$(cd "$(dirname "$2")" && pwd)/$(basename "$2") || exit 2
WORK=$(mktemp -d "${TMPDIR:-/tmp}/adbd-no-tcp-cases.XXXXXX") || exit 2
trap 'rm -rf "$WORK"' EXIT
fail=0
pass() { echo "PASS $1"; }
bad() { echo "FAIL $1"; fail=1; }
# mutant NAME: writes $WORK/NAME.patch from PATCH with the sed script
# $WORK/NAME.sed. Fails when the script changes nothing.
mutant() {
sed -f "$WORK/$1.sed" "$PATCH" > "$WORK/$1.patch" || return 1
if cmp -s "$PATCH" "$WORK/$1.patch"; then return 1; fi
return 0
}
# expect WANT LABEL PATCH [REASON]: runs the test on PATCH. The exit status must
# be WANT. For a FAIL case, REASON must appear in one of the FAIL lines.
expect() {
log=$WORK/run-$(echo "$2" | tr -c 'a-zA-Z0-9' '_').log
sh "$TEST" "$BASE" "$3" > "$log" 2>&1
rc=$?
if [ "$rc" != "$1" ]; then
bad "$2 (exit $rc, want $1)"
return
fi
if [ -n "${4:-}" ] && ! grep -q "^FAIL.*$4" "$log"; then
bad "$2 (exit $rc, no FAIL line names: $4)"
return
fi
pass "$2 (exit $rc)"
}
# The mutant scripts. Each edits only the Makefile hunk of the patch, or the
# gate line that carries ADBD_INPUTS.
cat > "$WORK/gate-makefile-only.sed" <<'SEDEOF'
s#^+ADBD_INPUTS := .*$#+ADBD_INPUTS := $(shell sha256sum $(CURRENT_DIR)/Makefile | cut -c1-64)#
SEDEOF
cat > "$WORK/no-fail-fast.sed" <<'SEDEOF'
/^diff --git a\/sysdrv\/tools\/board\/android-tools\/Makefile /,/^diff --git a\/sysdrv\/tools\/board\/android-tools\/adbd-current.sh /{
/^+/{
s/ || exit 1//
s/\$(SHELL) -e /$(SHELL) /
}
}
SEDEOF
cat > "$WORK/copy-unchecked.sed" <<'SEDEOF'
/^diff --git a\/sysdrv\/tools\/board\/android-tools\/Makefile /,/^diff --git a\/sysdrv\/tools\/board\/android-tools\/adbd-current.sh /{
/^+.*cp -f /s/ || exit 1//
}
SEDEOF
expect 0 "real patch" "$PATCH"
expect 1 "unpatched base" none
if mutant gate-makefile-only; then
expect 1 "mutant gate-makefile-only" "$WORK/gate-makefile-only.patch" "ADBD_INPUTS is"
else
bad "mutant gate-makefile-only does not change the patch"
fi
if mutant no-fail-fast; then
expect 1 "mutant no-fail-fast" "$WORK/no-fail-fast.patch" "stops before compile"
else
bad "mutant no-fail-fast does not change the patch"
fi
if mutant copy-unchecked; then
expect 1 "mutant copy-unchecked" "$WORK/copy-unchecked.patch" "copy into out/usr/bin"
else
bad "mutant copy-unchecked does not change the patch"
fi
if [ "$fail" = 0 ]; then
echo "RESULT PASS"
exit 0
fi
echo "RESULT FAIL"
exit 1
+272
View File
@@ -0,0 +1,272 @@
#!/bin/sh
# test-adbd-no-tcp.sh BASE_DIR PATCH_FILE|none
#
# Regression test for flare-edge#3129 (adbd listened on TCP 5555 and on
# 127.0.0.1:5037), bfe-core1106-sdk#44 (a change to the adbd patch set never
# reached the image), bfe-core1106-sdk#45 (a failed patch or copy step still
# stamped adbd current) and bfe-core1106-sdk#46 (the gate was tested by a copy
# of its formula instead of by the Makefile).
#
# BASE_DIR holds sysdrv/tools/board/android-tools at the luckfox base commit
# 824b817f8, as in the vendor checkout:
# git -C <luckfox-sdk> archive 824b817f8 sysdrv/tools/board/android-tools | tar -C BASE_DIR -xf -
# PATCH_FILE is luckfox-sdk-patches/board/patches/0015-adbd-no-tcp-listener.patch,
# or "none" to check the unpatched base, which must FAIL.
#
# The android-tools rule of the Makefile runs for real under make, with stub
# toolchains, so nothing is compiled: the compiler stub only creates its -o
# file. The fail-closed cases each break one step and check that the rule stops
# before the stamp is written. tests/adbd-no-tcp-cases.sh runs this test on the
# real patch, on the base and on mutants of the patch.
# Exit 0 PASS, 1 FAIL, 2 usage or missing input.
set -u
LC_ALL=C
export LC_ALL
fail=0
pass() { echo "PASS $1"; }
bad() { echo "FAIL $1"; fail=1; }
if [ $# -ne 2 ]; then
echo "usage: $0 BASE_DIR PATCH_FILE|none" >&2
exit 2
fi
BASE=$1
PATCH=$2
if [ ! -d "$BASE/sysdrv/tools/board/android-tools" ]; then
echo "no sysdrv/tools/board/android-tools under $BASE" >&2
exit 2
fi
BASE=$(cd "$BASE" && pwd) || exit 2
if [ "$PATCH" != none ]; then
[ -f "$PATCH" ] || { echo "no patch file $PATCH" >&2; exit 2; }
PATCH=$(cd "$(dirname "$PATCH")" && pwd)/$(basename "$PATCH")
fi
WORK=$(mktemp -d "${TMPDIR:-/tmp}/adbd-no-tcp.XXXXXX") || exit 2
trap 'rm -rf "$WORK"' EXIT
TREE=$WORK/tree
mkdir -p "$TREE/sysdrv/tools/board" || exit 2
cp -a "$BASE/sysdrv/tools/board/android-tools" "$TREE/sysdrv/tools/board/" || exit 2
AT=$TREE/sysdrv/tools/board/android-tools
# 1. The board patch applies to the base tree.
if [ "$PATCH" != none ]; then
if (cd "$TREE" && git apply --check "$PATCH" && git apply "$PATCH") 2>"$WORK/apply.err"; then
pass "board patch applies to the base tree"
else
bad "board patch does not apply to the base tree: $(head -3 "$WORK/apply.err")"
echo "RESULT FAIL"; exit 1
fi
fi
# Stub toolchain for the rule: the compiler (also CXX and CPP), strip, and the
# openssl and zlib sub-makes. The compiler stub logs each run to $STUB_LOG,
# creates its -o output, and fails when STUB_CC_FAIL is set.
STUB=$WORK/stub
mkdir -p "$STUB/dep" || exit 2
cat > "$STUB/cross-gcc" <<'STUBEOF'
#!/bin/sh
[ -n "${STUB_LOG:-}" ] && echo "cc $*" >> "$STUB_LOG"
[ -n "${STUB_CC_FAIL:-}" ] && { echo "stub compiler: forced failure" >&2; exit 1; }
out=
while [ $# -gt 0 ]; do
if [ "$1" = -o ]; then out=$2; shift; fi
shift
done
[ -n "$out" ] && : > "$out"
exit 0
STUBEOF
cp "$STUB/cross-gcc" "$STUB/cross-g++" || exit 2
cp "$STUB/cross-gcc" "$STUB/cross-cpp" || exit 2
printf '#!/bin/sh\nexit 0\n' > "$STUB/cross-strip" || exit 2
printf 'all:\n\t@true\n' > "$STUB/dep/Makefile" || exit 2
chmod 755 "$STUB/cross-gcc" "$STUB/cross-g++" "$STUB/cross-cpp" "$STUB/cross-strip" || exit 2
# run_make AT_DIR LOG: runs the rule of the Makefile in AT_DIR under make, with
# the stubs. Sets RC (make's exit status) and CC_RUNS (compiler runs).
run_make() {
rm -f "$2.cc"
(cd "$1" && STUB_LOG="$2.cc" make -f Makefile SYSDRV_PARAM=/dev/null \
SYSDRV_CROSS="$STUB/cross" SYSDRV_JOBS=1 \
PKG_DEP_OPENSSL="$STUB/dep" PKG_DEP_ZLIB="$STUB/dep" all) > "$2" 2>&1
RC=$?
CC_RUNS=0
if [ -s "$2.cc" ]; then CC_RUNS=$(wc -l < "$2.cc" | tr -d ' '); fi
}
# case_at NAME: a fresh copy of the patched android-tools tree; prints its path.
case_at() {
rm -rf "$WORK/case-$1"
mkdir -p "$WORK/case-$1/sysdrv/tools/board" || return 1
cp -a "$AT" "$WORK/case-$1/sysdrv/tools/board/" || return 1
echo "$WORK/case-$1/sysdrv/tools/board/android-tools"
}
# 2. The rule applies every debian series entry and every android-tools.patch.sh
# step, builds adbd, and writes the stamp.
GOOD=$(case_at good) || exit 2
run_make "$GOOD" "$WORK/good.log"
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then
pass "rule applies the debian series and android-tools.patch.sh, then builds adbd"
else
bad "rule does not build adbd from the patch set (rc $RC, compiler runs $CC_RUNS): $(grep -m1 -E 'FAILED|No such|Error' "$WORK/good.log")"
fi
# 3. The device half of adb_main(), in the source the rule generated: the TCP
# listeners must be gone, and the USB transport must stay.
# Comments are stripped first: the source keeps commented-out calls, and a
# comment that names a call is not a call.
ADB=$GOOD/android-tools/core/adbd/adb.c
awk '
/^int adb_main\(/ { inmain = 1 }
inmain && /^}/ { exit }
inmain {
if (incom) { if (index($0, "*/")) incom = 0; next }
if (index($0, "/*")) { if (!index($0, "*/")) incom = 1; next }
line = $0
sub(/\/\/.*/, "", line)
if (line ~ /^#if ADB_HOST/) { host = 1; next }
if (host && line ~ /^#else/) { host = 0; dev = 1; next }
if (dev && line ~ /^#endif/) { dev = 0; next }
if (dev) print line
}' "$ADB" > "$WORK/device-main.txt" 2>/dev/null
if [ ! -s "$WORK/device-main.txt" ]; then
bad "could not extract the device half of adb_main()"
else
if grep -q 'local_init' "$WORK/device-main.txt"; then
bad "adb_main() device half still calls local_init (TCP 5555 listener)"
else
pass "adb_main() device half opens no TCP 5555 listener"
fi
if grep -q 'install_listener' "$WORK/device-main.txt"; then
bad "adb_main() device half still installs a smartsocket listener (tcp:5037)"
else
pass "adb_main() device half installs no smartsocket listener"
fi
for need in 'usb_init()' 'Using USB' 'init_jdwp()'; do
if grep -q "$need" "$WORK/device-main.txt"; then
pass "adb_main() device half keeps: $need"
else
bad "adb_main() device half lost the USB path: $need"
fi
done
fi
# 4. The gate, as the Makefile evaluates it: ADBD_INPUTS must be the sha256 of
# the Makefile, adbd-current.sh and the patch set, the three inputs that the
# stamp must match.
# shellcheck disable=SC2016 # the make text must reach make unexpanded
printf '%s\n' '$(info ADBD_INPUTS=$(ADBD_INPUTS))' > "$WORK/probe.mk" || exit 2
probe=$(cd "$GOOD" && make -s -f Makefile -f "$WORK/probe.mk" SYSDRV_PARAM=/dev/null no-such-target 2>/dev/null | sed -n 's/^ADBD_INPUTS=//p')
want=$(cd "$AT" && cat Makefile adbd-current.sh android-tools-patches/* 2>/dev/null | sha256sum | cut -d' ' -f1)
if [ -n "$probe" ] && [ "$probe" = "$want" ]; then
pass "ADBD_INPUTS is the sha256 of Makefile, adbd-current.sh and the patch set"
else
bad "ADBD_INPUTS is '$probe', want '$want' (sha256 of Makefile, adbd-current.sh and the patch set)"
fi
# 5. The rule itself: a matching stamp with adbd present skips the build, and a
# stale or missing stamp rebuilds it. The stamp must hold ADBD_INPUTS.
if [ -n "$probe" ] && [ "$(cat "$GOOD/out/.adbd-inputs" 2>/dev/null)" = "$probe" ]; then
pass "rule writes the stamp of its inputs after the build"
else
bad "rule did not write the stamp of its inputs after the build"
fi
run_make "$GOOD" "$WORK/skip.log"
if [ "$RC" = 0 ] && [ "$CC_RUNS" = 0 ] && [ -n "$probe" ] && [ "$(cat "$GOOD/out/.adbd-inputs" 2>/dev/null)" = "$probe" ]; then
pass "rule skips adbd when the stamp matches"
else
bad "rule did not skip adbd with a matching stamp (rc $RC, compiler runs $CC_RUNS)"
fi
echo "0000000000000000000000000000000000000000000000000000000000000000" > "$GOOD/out/.adbd-inputs" || exit 2
run_make "$GOOD" "$WORK/stale.log"
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then
pass "rule rebuilds adbd when the stamp is stale"
else
bad "rule did not rebuild adbd with a stale stamp (rc $RC, compiler runs $CC_RUNS)"
fi
rm -f "$GOOD/out/.adbd-inputs"
run_make "$GOOD" "$WORK/nostamp.log"
if [ "$RC" = 0 ] && [ "$CC_RUNS" -gt 0 ]; then
pass "rule rebuilds adbd when there is no stamp"
else
bad "rule did not rebuild adbd without a stamp (rc $RC, compiler runs $CC_RUNS)"
fi
# 6. Fail closed. An injected failure must stop the rule with a non-zero status
# and leave no stamp. The failures before the compile step must also stop the
# rule before the compiler runs.
check_closed() { # AT_DIR LOG PRE LABEL
run_make "$1" "$2"
stamp=absent
[ -e "$1/out/.adbd-inputs" ] && stamp=written
if [ "$RC" != 0 ] && [ "$stamp" = absent ] && { [ "$3" != pre ] || [ "$CC_RUNS" = 0 ]; }; then
pass "$4"
else
bad "$4 (rc $RC, stamp $stamp, compiler runs $CC_RUNS): $(grep -m1 -E 'FAILED|No such|Error|forced|cannot|Is a directory' "$2")"
fi
}
inject_drift() { # AT_DIR: one removed line of the 0017 hunk stops matching
f=$1/android-tools-patches/0017-no-adb-tcp-listener.patch
[ -f "$f" ] || return 1
awk '{ if ($0 == "- build_local_name(local_name, sizeof(local_name), server_port);") $0 = $0 " /* drift */"; print }' "$f" > "$f.new" || return 1
grep -q 'drift' "$f.new" || return 1
mv "$f.new" "$f"
}
inject_middle() { # AT_DIR: a failing patch step ahead of the last step
f=$1/android-tools-patches/android-tools.patch.sh
[ -f "$f" ] || return 1
awk 'NR == 4 { print "patch -p1 < 0000-no-such-patch.patch" } { print }' "$f" > "$f.new" || return 1
mv "$f.new" "$f"
}
inject_series() { # AT_DIR: a debian series entry with no patch file behind it
t=$1/android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz
d=$WORK/deb-series
rm -rf "$d" && mkdir -p "$d" || return 1
tar -xzf "$t" -C "$d" || return 1
printf '\nno-such-debian-patch.patch\n' >> "$d/debian/patches/series" || return 1
tar -czf "$t.new" -C "$d" debian || return 1
mv "$t.new" "$t"
}
D=$(case_at drift) || exit 2
if inject_drift "$D"; then
check_closed "$D" "$WORK/drift.log" pre "rule stops before compile when a 0017 hunk does not apply"
else
bad "could not inject a 0017 failure (no 0017 patch in the tree)"
fi
D=$(case_at middle) || exit 2
if inject_middle "$D"; then
check_closed "$D" "$WORK/middle.log" pre "rule stops before compile when a middle android-tools.patch.sh step fails"
else
bad "could not inject a failing android-tools.patch.sh step"
fi
D=$(case_at series) || exit 2
if inject_series "$D"; then
check_closed "$D" "$WORK/series.log" pre "rule stops before compile when a debian series entry does not apply"
else
bad "could not inject a failing debian series entry"
fi
D=$(case_at compile) || exit 2
export STUB_CC_FAIL=1
check_closed "$D" "$WORK/compile.log" any "rule stops and writes no stamp when the compiler fails"
unset STUB_CC_FAIL
D=$(case_at copy) || exit 2
mkdir -p "$D/out/usr/bin/adbd" || exit 2
check_closed "$D" "$WORK/copy.log" any "rule stops and writes no stamp when the copy into out/usr/bin fails"
# 7. The Makefile still parses (a parse error prints something other than
# "No rule to make target").
if (cd "$AT" && make -f Makefile SYSDRV_PARAM=/dev/null -n no-such-target 2>&1 | grep -q 'No rule to make target'); then
pass "Makefile parses"
else
bad "Makefile does not parse"
fi
if [ "$fail" = 0 ]; then
echo "RESULT PASS"
exit 0
fi
echo "RESULT FAIL"
exit 1
+19
View File
@@ -0,0 +1,19 @@
# VOP pixel clock bench helpers (bfe-core1106-sdk#43)
Helpers for the bench proof of the CPLL 900 MHz clock plan. They run on a Warden panel
(busybox sh), read-only except for the UI workload, and need the panel's warden-ui test
hook (FIFO `/tmp/warden-ui.ctl`).
- `vopcheck.sh candidate|baseline`: reads clk_summary and the eth0 carrier. Candidate expects
pll_cpll 900000000, dclk_vop 30000000, clk_50m_src 50000000, clk_100m_src 100000000,
aclk_ddr_root 450000000 and clk_250m_src 225000000. Baseline expects pll_cpll 1000000000 and
dclk_vop 31250000. Exit 0 when all rows pass.
- `uirun.sh LABEL SECONDS`: fixed UI workload (wake, nav, two scrolls, home), one `stats` read
after each action. Writes `/tmp/vop-ui-LABEL.csv` and `.log` on the panel.
- `gic121.sh`: VOP frame-start count (GIC 121) in three-second windows, with INTR_EN0 and
DSP_CTRL0 read only. `WINDOWS=n` sets the number of windows.
- `summarize.py FILE...`: render_ms and render_max_ms statistics for each CSV
(`python3 -I summarize.py`).
Run a helper with `sh /tmp/<name>.sh` after copying it to the panel. Hold the panel's bench
lock for the whole run (`bench-lock run --class SOAK` for a workload).
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# gic121.sh: VOP frame-start count (GIC 121) over three 3 s windows, read-only (no UI verbs, INTR_EN0 untouched).
cnt() { awk '/GIC-0 121 /{s=0; for(i=2;i<=NF;i++){ if($i ~ /^[0-9]+$/){s+=$i} else break }; print s; exit}' /proc/interrupts; }
bl=$(cat /sys/class/backlight/*/bl_power 2>/dev/null | head -1); br=$(cat /sys/class/backlight/*/brightness 2>/dev/null | head -1)
echo "backlight bl_power=$bl brightness=$br"
echo "INTR_EN0=$(devmem 0xff990034 2>/dev/null) DSP_CTRL0=$(devmem 0xff990020 2>/dev/null)"
i=1
while [ $i -le ${WINDOWS:-3} ]; do
c1=$(cnt); t1=$(cut -d' ' -f1 /proc/uptime); sleep 3; c2=$(cnt); t2=$(cut -d' ' -f1 /proc/uptime)
echo "window $i: count=$((c2-c1)) span=$(awk -v a=$t1 -v b=$t2 'BEGIN{printf "%.3f", b-a}') s rate=$(awk -v d=$((c2-c1)) -v a=$t1 -v b=$t2 'BEGIN{printf "%.2f", d/(b-a)}')/s"
i=$((i+1))
done
echo "GIC121DONE"
+42
View File
@@ -0,0 +1,42 @@
"""Summarize one UI-run CSV: stats samples per action and overall (python3 -I summarize.py FILE...)."""
import csv
import statistics
import sys
def num(v):
try:
return float(v)
except (TypeError, ValueError):
return None
def summarize(path):
rows = list(csv.DictReader(open(path, encoding="ascii")))
ok = [r for r in rows if num(r["render_ms"]) is not None and num(r["render_max_ms"]) is not None]
busy = [r for r in ok if (num(r["fps"]) or 0) > 0]
rmax = [num(r["render_max_ms"]) for r in ok]
rms = [num(r["render_ms"]) for r in busy]
fps = [num(r["fps"]) for r in busy]
out = {
"file": path,
"samples": len(rows),
"parsed": len(ok),
"busy_windows": len(busy),
"fps_mean": round(statistics.mean(fps), 2) if fps else None,
"render_ms_mean_busy": round(statistics.mean(rms), 3) if rms else None,
"render_ms_p95_busy": round(sorted(rms)[int(0.95 * (len(rms) - 1))], 3) if rms else None,
"render_max_ms_max": round(max(rmax), 2) if rmax else None,
"render_max_ms_p95": round(sorted(rmax)[int(0.95 * (len(rmax) - 1))], 2) if rmax else None,
"render_max_ms_mean": round(statistics.mean(rmax), 3) if rmax else None,
}
per = {}
for r in ok:
per.setdefault(r["action"], []).append(num(r["render_max_ms"]))
out["render_max_by_action"] = {a: round(max(v), 2) for a, v in per.items()}
return out
if __name__ == "__main__":
for p in sys.argv[1:]:
print(summarize(p))
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
# uirun.sh LABEL SECONDS: fixed UI workload for SECONDS. Each action is followed by one stats read.
LABEL=$1; DUR=$2
OUT=/tmp/vop-ui-$LABEL.csv; LOG=/tmp/vop-ui-$LABEL.log
ui() { rm -f /tmp/warden-ui.dbg; printf '%s\n' "$1" > /tmp/warden-ui.ctl; n=0; while [ ! -s /tmp/warden-ui.dbg ] && [ $n -lt 100 ]; do sleep 0.05; n=$((n+1)); done; cat /tmp/warden-ui.dbg 2>/dev/null; }
key() { printf '%s\n' "$1" | awk -F': ' -v k="$2" '$1==k {print $2; exit}' | awk '{print $1}' | tr -d '%'; }
pid0=$(pidof warden-ui 2>/dev/null); echo "start uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$pid0" > $LOG
dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.before
echo "uptime_s,action,reply1,page,cpu,fps,render_ms,render_max_ms,idle,memavail_kb" > $OUT
start=$(cut -d' ' -f1 /proc/uptime); cycles=0
while :; do
now=$(cut -d' ' -f1 /proc/uptime)
done_=$(awk -v a=$start -v b=$now -v d=$DUR 'BEGIN{print (b-a>=d)?1:0}')
[ "$done_" = 1 ] && break
for act in "wake" "nav settings/system" "scroll 360 300 300" "scroll 360 300 -300" "home"; do
r1=$(ui "$act" | head -1 | tr ',' ';')
sleep 1.2
s=$(ui stats)
page=$(key "$s" page); cpu=$(key "$s" cpu); fps=$(key "$s" fps); rms=$(key "$s" render); rmax=$(key "$s" render_max); idle=$(key "$s" idle); mem=$(key "$s" memavail)
echo "$(cut -d' ' -f1 /proc/uptime),$act,$r1,$page,$cpu,$fps,$rms,$rmax,$idle,$mem" >> $OUT
sleep 0.3
done
cycles=$((cycles+1)); sleep 1
done
echo "end uptime=$(cut -d' ' -f1 /proc/uptime) warden-ui=$(pidof warden-ui 2>/dev/null) cycles=$cycles" >> $LOG
dmesg | grep -i -E 'ddr|axi|vop|rga|error|fail|underflow|oops|bug|warn|timeout' | wc -l > /tmp/vop-dmesg-$LABEL.after
echo "DONE $LABEL" >> $LOG
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
# vopcheck.sh MODE (candidate|baseline): read-only clock plan and eth0 check on a bench panel.
MODE=${1:-candidate}
CS=/sys/kernel/debug/clk/clk_summary
rate() { awk -v n="$1" '$1==n {print $5; exit}' $CS; }
fail=0
chk() { if [ "$3" = "$2" ]; then echo "PASS $1 = $3"; else echo "FAIL $1 = $3 (want $2)"; fail=1; fi; }
if [ "$MODE" = candidate ]; then
chk pll_cpll 900000000 "$(rate pll_cpll)"
chk dclk_vop_src 30000000 "$(rate dclk_vop_src)"
chk dclk_vop 30000000 "$(rate dclk_vop)"
chk clk_50m_src 50000000 "$(rate clk_50m_src)"
chk clk_100m_src 100000000 "$(rate clk_100m_src)"
chk aclk_ddr_root 450000000 "$(rate aclk_ddr_root)"
chk clk_250m_src 225000000 "$(rate clk_250m_src)"
else
chk pll_cpll 1000000000 "$(rate pll_cpll)"
chk dclk_vop 31250000 "$(rate dclk_vop)"
fi
carrier=$(cat /sys/class/net/eth0/carrier 2>/dev/null)
if [ "$carrier" = 1 ]; then echo "PASS eth0 carrier=1 speed=$(cat /sys/class/net/eth0/speed 2>/dev/null)"; else echo "FAIL eth0 carrier=$carrier"; fail=1; fi
echo "VOPCHECK mode=$MODE release=$(sed -n 's/.*GIT_COMMIT=\([^ ]*\).*/\1/p' /etc/warden-release) rc=$fail"
exit $fail