Skip to content

Commit 9656145

Browse files
committed
fix(chip-aosp): fuse Eliza product and activate HAL contracts
1 parent d28b18f commit 9656145

17 files changed

Lines changed: 158 additions & 56 deletions

packages/chip/scripts/boot_android_simulator.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ report="${ANDROID_SIM_BOOT_REPORT:-$repo_root/build/reports/android_sim_boot.jso
1313
evidence_dir="$repo_root/docs/evidence/android"
1414
aosp_dir=${AOSP_DIR:-}
1515
aosp_shell=${AOSP_SHELL:-bash}
16-
aosp_product=${AOSP_PRODUCT:-eliza_ai_soc-trunk_staging-userdebug}
17-
aosp_cuttlefish_product=${AOSP_CUTTLEFISH_PRODUCT:-aosp_cf_riscv64_phone-trunk_staging-userdebug}
16+
aosp_product=${AOSP_PRODUCT:-eliza_openagent_ai_soc_phone-trunk_staging-userdebug}
17+
aosp_cuttlefish_product=${AOSP_CUTTLEFISH_PRODUCT:-eliza_cf_riscv64_phone-trunk_staging-userdebug}
1818
aosp_cuttlefish_args=${AOSP_CUTTLEFISH_ARGS:---cpus=4 --memory_mb=8192 --gpu_mode=none}
1919
aosp_cuttlefish_launcher=${AOSP_CUTTLEFISH_LAUNCHER:-}
2020
aosp_adb_timeout_seconds=${AOSP_ADB_TIMEOUT_SECONDS:-180}

packages/chip/scripts/check_aosp_product_contract.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ def run_check(args: argparse.Namespace) -> dict[str, object]:
192192
openagent_inherits = inherit_products(openagent_text)
193193
chip_packages = makefile_product_packages(chip_device_text)
194194
os_common_packages = makefile_product_packages(os_common_text)
195+
chip_inherits_eliza_common = "vendor/eliza/eliza_common.mk" in chip_inherits
196+
effective_chip_packages = chip_packages | (
197+
os_common_packages if chip_inherits_eliza_common else set()
198+
)
195199
local_dests = local_manifest_dests(LOCAL_MANIFEST)
196200
chip_manifest_hals = manifest_hal_names(CHIP_MANIFEST)
197201

@@ -235,10 +239,10 @@ def run_check(args: argparse.Namespace) -> dict[str, object]:
235239
)
236240
add_if(
237241
findings,
238-
bool(REQUIRED_ELIZA_PACKAGES - chip_packages),
242+
bool(REQUIRED_ELIZA_PACKAGES - effective_chip_packages),
239243
"chip_product_missing_eliza_privapp_packages",
240244
"chip eliza_ai_soc product does not install the Eliza privileged app and permission XML packages",
241-
f"missing={sorted(REQUIRED_ELIZA_PACKAGES - chip_packages)} chip_packages={sorted(chip_packages)}",
245+
f"missing={sorted(REQUIRED_ELIZA_PACKAGES - effective_chip_packages)} effective_packages={sorted(effective_chip_packages)}",
242246
"Install the Eliza APK, default-permissions XML, and privapp permissions in the selected chip Android product.",
243247
)
244248
add_if(
@@ -310,6 +314,7 @@ def run_check(args: argparse.Namespace) -> dict[str, object]:
310314
"chip_product_inherits": sorted(chip_inherits),
311315
"os_openagent_inherits": sorted(openagent_inherits),
312316
"chip_product_packages": sorted(chip_packages),
317+
"effective_chip_product_packages": sorted(effective_chip_packages),
313318
"os_common_packages": sorted(os_common_packages),
314319
"local_manifest_dest_count": len(local_dests),
315320
"chip_vintf_hals": sorted(chip_manifest_hals),

packages/chip/sw/aosp-device/build-aosp-riscv64.sh

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env bash
2-
# build-aosp-riscv64.sh - AOSP build pipeline for the Cuttlefish riscv64 target,
3-
# overlaid with the eliza_ai_soc device tree.
2+
# build-aosp-riscv64.sh - AOSP build pipeline for the fused Eliza OpenAgent
3+
# E1 RISC-V AI SoC product.
44
#
5-
# Default lunch combo: aosp_cf_riscv64_phone-trunk_staging-userdebug
6-
# Optional lunch combo: eliza_ai_soc-trunk_staging-userdebug (requires the
7-
# overlay-mode=local-manifest path so the project is sync'd
8-
# under the AOSP tree with a proper repo project entry).
5+
# Default lunch combo: eliza_openagent_ai_soc_phone-trunk_staging-userdebug
6+
# Reference-only combo: aosp_cf_riscv64_phone-trunk_staging-userdebug.
97
#
108
# This script is intentionally idempotent enough to re-run incrementally:
119
# * Pre-flight is non-destructive.
@@ -26,6 +24,7 @@ SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
2624
CHIP_ROOT=$(cd -- "$SCRIPT_DIR/../.." && pwd)
2725
ELIZA_ROOT=$(cd -- "$CHIP_ROOT/../.." && pwd)
2826
DEVICE_OVERLAY_SRC="$SCRIPT_DIR/device/eliza/eliza_ai_soc"
27+
ELIZA_VENDOR_SRC="$ELIZA_ROOT/packages/os/android/vendor/eliza"
2928
LOCAL_MANIFEST_TEMPLATE="$SCRIPT_DIR/local_manifests/eliza.xml"
3029

3130
usage() {
@@ -38,7 +37,7 @@ required:
3837
build options:
3938
--branch BRANCH AOSP manifest branch (default: android-latest-release).
4039
--lunch-target COMBO Lunch target
41-
(default: aosp_cf_riscv64_phone-trunk_staging-userdebug).
40+
(default: eliza_openagent_ai_soc_phone-trunk_staging-userdebug).
4241
--jobs N Parallelism for repo sync and `m`
4342
(default: $(nproc)).
4443
--device-overlay-mode MODE
@@ -80,7 +79,7 @@ warn() { printf '[%s] WARN: %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$*" >&2; }
8079

8180
WORKSPACE=""
8281
BRANCH="android-latest-release"
83-
LUNCH_TARGET="aosp_cf_riscv64_phone-trunk_staging-userdebug"
82+
LUNCH_TARGET="eliza_openagent_ai_soc_phone-trunk_staging-userdebug"
8483
JOBS=$(nproc 2>/dev/null || echo 4)
8584
OVERLAY_MODE="symlink"
8685
RESYNC=0
@@ -138,6 +137,9 @@ for required in \
138137
"$DEVICE_OVERLAY_SRC/device.mk" \
139138
"$DEVICE_OVERLAY_SRC/manifest.xml" \
140139
"$DEVICE_OVERLAY_SRC/eliza_e1.xml" \
140+
"$ELIZA_VENDOR_SRC/AndroidProducts.mk" \
141+
"$ELIZA_VENDOR_SRC/eliza_common.mk" \
142+
"$ELIZA_VENDOR_SRC/products/eliza_openagent_ai_soc_phone.mk" \
141143
"$LOCAL_MANIFEST_TEMPLATE"; do
142144
[ -f "$required" ] || die "missing repo artifact: $required"
143145
done
@@ -246,8 +248,9 @@ run_repo_sync() {
246248
}
247249

248250
install_overlay_symlinks() {
249-
log "overlay: dropping symlinks into device/eliza/eliza_ai_soc/"
251+
log "overlay: dropping symlinks into device/eliza/eliza_ai_soc/ and vendor/eliza/"
250252
local dst="$WORKSPACE/device/eliza/eliza_ai_soc"
253+
local vendor_dst="$WORKSPACE/vendor/eliza"
251254
mkdir -p "$dst"
252255
# Mirror the layout exactly. We symlink files (not the whole dir) so any
253256
# additions to the overlay are picked up on the next run.
@@ -257,6 +260,13 @@ install_overlay_symlinks() {
257260
mkdir -p "$dst/$(dirname "$rel")"
258261
ln -sfn "$DEVICE_OVERLAY_SRC/$rel" "$dst/$rel"
259262
done
263+
mkdir -p "$vendor_dst"
264+
cd "$ELIZA_VENDOR_SRC"
265+
find . -type f -print0 | while IFS= read -r -d '' rel; do
266+
rel=${rel#./}
267+
mkdir -p "$vendor_dst/$(dirname "$rel")"
268+
ln -sfn "$ELIZA_VENDOR_SRC/$rel" "$vendor_dst/$rel"
269+
done
260270
}
261271

262272
install_overlay_local_manifest() {
@@ -287,6 +297,13 @@ install_overlay() {
287297
[ -f "$WORKSPACE/device/eliza/eliza_ai_soc/$rel" ] \
288298
|| die "overlay install: device/eliza/eliza_ai_soc/$rel did not materialize"
289299
done
300+
for rel in \
301+
AndroidProducts.mk \
302+
eliza_common.mk \
303+
products/eliza_openagent_ai_soc_phone.mk; do
304+
[ -f "$WORKSPACE/vendor/eliza/$rel" ] \
305+
|| die "overlay install: vendor/eliza/$rel did not materialize"
306+
done
290307
}
291308

292309
run_build() {
@@ -314,8 +331,8 @@ run_build() {
314331
# Derive the product output directory from the lunch combo.
315332
product_out_dir() {
316333
case "$LUNCH_TARGET" in
317-
aosp_cf_riscv64_phone-*) echo "$WORKSPACE/out/target/product/vsoc_riscv64" ;;
318-
eliza_ai_soc-*) echo "$WORKSPACE/out/target/product/eliza_ai_soc" ;;
334+
aosp_cf_riscv64_phone-*) echo "$WORKSPACE/out/target/product/vsoc_riscv64" ;;
335+
eliza_ai_soc-*|eliza_openagent_ai_soc_phone-*) echo "$WORKSPACE/out/target/product/eliza_ai_soc" ;;
319336
*)
320337
local short=${LUNCH_TARGET%%-*}
321338
echo "$WORKSPACE/out/target/product/${short}"

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/BoardConfig.mk

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ TARGET_CPU_VARIANT := generic
1616
# simulator base.
1717
-include device/google/cuttlefish/vsoc_riscv64/BoardConfig.mk
1818

19-
# Temporary workaround matching AOSP riscv64 targets while prebuilts lack
20-
# riscv64 variants.
21-
ALLOW_MISSING_DEPENDENCIES := true
2219
TARGET_NO_BOOTLOADER := true
2320
TARGET_NO_KERNEL := false
2421
BOARD_KERNEL_CMDLINE += console=ttyS0 earlycon androidboot.hardware=eliza_ai_soc

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/device.mk

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@ PRODUCT_COPY_FILES += \
1717
device/eliza/eliza_ai_soc/init.eliza.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.eliza.rc \
1818
device/eliza/eliza_ai_soc/fstab.eliza:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.eliza
1919

20-
# HAL service binaries.
21-
#
22-
# Future integration points:
23-
# android.hardware.graphics.composer@2.4-service
24-
# hwcomposer.eliza_ai_soc
25-
# vendor.eliza.e1_npu@1.0-service
26-
# HAL package names are intentionally not listed until source or prebuilts are
27-
# imported into the external AOSP tree. Keeping these out of PRODUCT_PACKAGES
28-
# prevents vendorimage from passing with misleading, unimplemented services.
29-
#
30-
# Future external-tree packages:
31-
# hwcomposer.eliza_ai_soc
32-
# e1_npu.default
33-
#
20+
PRODUCT_PACKAGES += \
21+
android.hardware.graphics.composer@2.4-service.eliza_ai_soc \
22+
hwcomposer.eliza_ai_soc \
23+
vendor.eliza.e1_npu@1.0-service
24+
3425
# WiFi/Bluetooth packages, permissions, overlays, supplicant/hostapd configs,
3526
# and Android feature XML are intentionally absent until the external module
3627
# has host-controller, firmware, regulatory, and framework evidence.

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/eliza_ai_soc.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# contract on top.
44
$(call inherit-product, device/google/cuttlefish/vsoc_riscv64/phone/aosp_cf.mk)
55
$(call inherit-product, device/eliza/eliza_ai_soc/device.mk)
6+
$(call inherit-product, vendor/eliza/eliza_common.mk)
67

78
PRODUCT_NAME := eliza_ai_soc
89
PRODUCT_DEVICE := eliza_ai_soc

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/hal/e1_npu/Android.bp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ package {
1111
default_applicable_licenses: ["Android-Apache-2.0"],
1212
}
1313

14+
hidl_interface {
15+
name: "vendor.eliza.e1_npu@1.0",
16+
root: "vendor.eliza",
17+
srcs: [
18+
"IE1Npu.hal",
19+
],
20+
interfaces: [
21+
"android.hidl.base@1.0",
22+
],
23+
gen_java: false,
24+
}
25+
1426
cc_binary {
1527
name: "vendor.eliza.e1_npu@1.0-service",
1628
relative_install_path: "hw",

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/hal/e1_npu/E1Npu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class E1Npu : public IE1Npu {
3535
// Offset into the device that returns the driver identity word.
3636
// Matches sw/linux/drivers/e1/e1_platform_contract.h
3737
// (E1_NPU_RESULT_OFFSET).
38-
static constexpr off_t kResultOffset = 0x10;
38+
static constexpr off_t kResultOffset = 0x08;
3939
};
4040

4141
} // namespace implementation

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/hal/e1_npu/vendor.eliza.e1_npu@1.0-service.rc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ service vendor.e1_npu /vendor/bin/hw/vendor.eliza.e1_npu@1.0-service
33
class hal
44
user system
55
group system
6-
disabled
7-
oneshot
86

97
on property:vendor.e1_npu.ready=1
108
start vendor.e1_npu

packages/chip/sw/aosp-device/device/eliza/eliza_ai_soc/init.eliza.rc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Backing kernel node: /dev/e1-npu.
55
#
66
# Policy:
7-
# - The e1_npu HAL package is not started from this root init scaffold until
8-
# the matching service binary is included in PRODUCT_PACKAGES.
7+
# - The e1_npu HAL starts only after post-fs ownership/mode setup for the
8+
# backing kernel device has run.
99
# - The hwcomposer HAL is the only graphics HAL declared. There is no
1010
# surfaceflinger override and no GLES library mapping.
1111
# - No audio, camera, radio, BT, WiFi, sensors, or thermal services.
@@ -22,3 +22,4 @@ on post-fs
2222
chmod 0660 /dev/e1-npu
2323
# Vendor scratch directory for the HAL (no persistent state in v0).
2424
mkdir /mnt/vendor/e1_npu 0770 system system
25+
setprop vendor.e1_npu.ready 1

0 commit comments

Comments
 (0)