From 2c355f0e3093a50b7e0b58537372e853f520b6a0 Mon Sep 17 00:00:00 2001 From: BFE Engineering Date: Fri, 6 Nov 2026 08:56:05 -0600 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01B1W6qGbdxD3FcrGMcjLNhv --- luckfox-sdk-patches/README.md | 34 +++- .../patches/0015-adbd-no-tcp-listener.patch | 134 +++++++++++++++ luckfox-sdk-patches/tests/test-adbd-no-tcp.sh | 157 ++++++++++++++++++ 3 files changed, 323 insertions(+), 2 deletions(-) create mode 100644 luckfox-sdk-patches/board/patches/0015-adbd-no-tcp-listener.patch create mode 100755 luckfox-sdk-patches/tests/test-adbd-no-tcp.sh diff --git a/luckfox-sdk-patches/README.md b/luckfox-sdk-patches/README.md index fb54829..0b151b6 100644 --- a/luckfox-sdk-patches/README.md +++ b/luckfox-sdk-patches/README.md @@ -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,19 @@ 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` replays the android-tools +build (tarball, debian series, `android-tools.patch.sh`) on the base tree and +checks the adbd TCP listener removal (flare-edge#3129) and the adbd rebuild +gate (bfe-core1106-sdk#44). `BASE_DIR` is the luckfox base commit 824b817f8, +`sysdrv/tools/board/android-tools` only: + + git -C 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 + +It compiles nothing. Run it with `none` as the patch file to see the base fail. + ## Completeness check flare-edge's `tools/verify-sdk-patches.sh` replays this series onto the vendor @@ -123,7 +137,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 +308,22 @@ 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. + ### `board/patches/0009` to `0013` (issue #4) Deltas that lived only in the workstation SDK until issue #4. Each patch @@ -322,7 +352,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 | diff --git a/luckfox-sdk-patches/board/patches/0015-adbd-no-tcp-listener.patch b/luckfox-sdk-patches/board/patches/0015-adbd-no-tcp-listener.patch new file mode 100644 index 0000000..7ea32ca --- /dev/null +++ b/luckfox-sdk-patches/board/patches/0015-adbd-no-tcp-listener.patch @@ -0,0 +1,134 @@ +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. + +Regression test: luckfox-sdk-patches/tests/test-adbd-no-tcp.sh. + +diff --git a/sysdrv/tools/board/android-tools/Makefile b/sysdrv/tools/board/android-tools/Makefile +index bb72255..50fae52 100644 +--- a/sysdrv/tools/board/android-tools/Makefile ++++ b/sysdrv/tools/board/android-tools/Makefile +@@ -23,6 +23,13 @@ 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. ++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 +43,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); \ +@@ -55,6 +62,7 @@ all: dep-openssl + 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)/ ; \ ++ echo $(ADBD_INPUTS) > $(ADBD_STAMP) ; \ + 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 diff --git a/luckfox-sdk-patches/tests/test-adbd-no-tcp.sh b/luckfox-sdk-patches/tests/test-adbd-no-tcp.sh new file mode 100755 index 0000000..954fd58 --- /dev/null +++ b/luckfox-sdk-patches/tests/test-adbd-no-tcp.sh @@ -0,0 +1,157 @@ +#!/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) and bfe-core1106-sdk#44 (a change to the adbd patch set never +# reached the image, because the Makefile kept an adbd built from older inputs). +# +# BASE_DIR holds sysdrv/tools/board/android-tools at the luckfox base commit +# 824b817f8, as in the vendor checkout: +# git -C 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 test replays what the android-tools Makefile does when it builds adbd: +# the orig tarball, the debian series and android-tools.patch.sh. Then it checks +# the device half of adb_main() and the rebuild gate. It compiles nothing. +# 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 +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 + +# 2. Regenerate the adbd source the way the Makefile does. Every step is strict +# here; the Makefile itself ignores patch failures. +cd "$AT" || exit 2 +tar -xf android-tools_4.2.2+git20130218.orig.tar.xz || { bad "orig tarball extraction"; echo "RESULT FAIL"; exit 1; } +tar -xf android-tools_4.2.2+git20130218-3ubuntu41.debian.tar.gz -C android-tools || { bad "debian tarball extraction"; echo "RESULT FAIL"; exit 1; } +mkdir -p android-tools/out +cp -af android-tools-patches/* android-tools/ || exit 2 +cd android-tools || exit 2 +series_ok=1 +for item in $(cat ./debian/patches/series); do + patch -p1 -s < "./debian/patches/$item" >/dev/null 2>&1 || { bad "debian series $item"; series_ok=0; } +done +[ "$series_ok" = 1 ] && pass "debian series applies to the orig source" +sh ./android-tools.patch.sh > "$WORK/patch-sh.log" 2>&1 +if grep -q -E 'FAILED|saving rejects|malformed' "$WORK/patch-sh.log"; then + bad "android-tools.patch.sh reports a failed hunk: $(grep -m1 -E 'FAILED|saving rejects|malformed' "$WORK/patch-sh.log")" +else + pass "android-tools.patch.sh applies every patch" +fi + +# 3. The device half of adb_main(): 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. +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 +}' core/adbd/adb.c > "$WORK/device-main.txt" +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 rebuild gate: adbd is current only when its stamp matches its inputs. +cd "$AT" || exit 2 +if [ -f ./adbd-current.sh ] && grep -q 'sh $(CURRENT_DIR)/adbd-current.sh $(PKG_INSTALL_BIN_DIR)/adbd $(ADBD_STAMP) $(ADBD_INPUTS)' Makefile \ + && grep -q 'echo $(ADBD_INPUTS) > $(ADBD_STAMP)' Makefile; then + pass "Makefile gates adbd on the stamp and writes it after the build" + G=$WORK/gate + mkdir -p "$G/out/usr/bin" + inputs=$(cat Makefile adbd-current.sh android-tools-patches/* | sha256sum | cut -d' ' -f1) + stamp=$G/out/.adbd-inputs + adbd=$G/out/usr/bin/adbd + gate() { sh ./adbd-current.sh "$adbd" "$stamp" "$inputs"; } + expect() { # expect RC LABEL + gate >/dev/null 2>&1; rc=$? + if [ "$rc" = "$1" ]; then pass "gate: $2 (exit $rc)"; else bad "gate: $2 (exit $rc, want $1)"; fi + } + expect 1 "no adbd, so rebuild" + : > "$adbd" + expect 1 "adbd without a stamp, so rebuild" + echo "0000000000000000000000000000000000000000000000000000000000000000" > "$stamp" + expect 1 "adbd with a stale stamp, so rebuild" + echo "$inputs" > "$stamp" + expect 0 "adbd with a matching stamp, so skip" +else + bad "Makefile does not gate adbd on adbd-current.sh and the stamp" +fi + +# 5. The Makefile still parses (a parse error prints something other than +# "No rule to make target"). +cd "$AT" || exit 2 +if 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