feat(guanghu-os): add Chengyan PNCC slot
This commit is contained in:
parent
e5b10e227f
commit
0c03c95ee3
14 changed files with 1284 additions and 18 deletions
|
|
@ -8,7 +8,7 @@ readonly NODE_ID=JD-FD-PRIMARY
|
|||
readonly INSTANCE_ID=f3d4b730-7f02-452f-975b-7091a4800431
|
||||
readonly ROOT_UUID=9e4550a0-452b-4f28-b5a5-d5364aa450f6
|
||||
readonly LINUX_RESCUE_ENTRY=gnulinux-simple-9e4550a0-452b-4f28-b5a5-d5364aa450f6
|
||||
readonly RELEASE_ID=guanghu-master-20260816.2
|
||||
readonly RELEASE_ID=guanghu-master-20260904.3
|
||||
readonly STATE_ROOT=/run/guanghu/master
|
||||
readonly RECEIPT_ROOT=/guanghu/recovery/JD-FD-PRIMARY-master-20260816
|
||||
readonly LOG_ROOT=${RECEIPT_ROOT}/runtime-logs
|
||||
|
|
@ -16,8 +16,12 @@ readonly HLCC=/opt/guanghu/architecture-releases/3d11ac75bea8cf08b5f223fed86ab3c
|
|||
readonly APP_HUB=/opt/guanghu/architecture-releases/333cd222c53d7d162218543cd167bdda4f8efb22/server-tools/jd-app-hub/server.js
|
||||
readonly AI_DISCOVERY=/opt/guanghu/ai-discovery/server.js
|
||||
readonly PNCC_RUNTIME=/usr/local/libexec/guanghu/pncc-runtime.mjs
|
||||
readonly PNCC_REPOSITORY=/var/lib/guanghu/personas/ICE-P-ZY001/pncc/repository
|
||||
readonly PNCC_STATE_ROOT=/run/guanghu/pncc
|
||||
readonly PNCC_ZHUYUAN_REPOSITORY=/var/lib/guanghu/personas/ICE-P-ZY001/pncc/repository
|
||||
readonly PNCC_ZHUYUAN_STATE_ROOT=/run/guanghu/pncc
|
||||
readonly PNCC_ZHUYUAN_PORT=3923
|
||||
readonly PNCC_CHENGYAN_REPOSITORY=/var/lib/guanghu/personas/ICE-P-CY0903/pncc/repository
|
||||
readonly PNCC_CHENGYAN_STATE_ROOT=/run/guanghu/pncc-ICE-P-CY0903
|
||||
readonly PNCC_CHENGYAN_PORT=3924
|
||||
readonly HOLOLAKE_RELEASE_BRIDGE=/usr/local/libexec/guanghu/hololake-release-bridge
|
||||
|
||||
declare -a CHILDREN=()
|
||||
|
|
@ -30,7 +34,7 @@ log() {
|
|||
json_state() {
|
||||
local stage=$1 result=$2
|
||||
local tmp=${STATE_ROOT}/state.json.tmp.$$
|
||||
printf '%s\n' "{\"schema\":\"guanghu.master-runtime/v1\",\"node_id\":\"${NODE_ID}\",\"instance_id\":\"${INSTANCE_ID}\",\"release_id\":\"${RELEASE_ID}\",\"boot_id\":\"$(cat /proc/sys/kernel/random/boot_id)\",\"control\":\"GUANGHU_OS_MASTER\",\"pid1\":\"GUANGHU_SUPERVISOR\",\"linux_kernel_role\":\"HARDWARE_COMPATIBILITY_SUBSTRATE\",\"full_linux_userspace\":\"DORMANT\",\"linux_repository_bridge\":\"BOUNDED_SUBCONTROL\",\"pncc\":\"RESIDENT_BOUND_CARRIER_SEPARATE\",\"persona_carrier_binding\":\"UNBOUND_EVIDENCE_REQUIRED\",\"linux_rescue\":\"${LINUX_RESCUE_ENTRY}\",\"stage\":\"${stage}\",\"result\":\"${result}\"}" >"${tmp}"
|
||||
printf '%s\n' "{\"schema\":\"guanghu.master-runtime/v1\",\"node_id\":\"${NODE_ID}\",\"instance_id\":\"${INSTANCE_ID}\",\"release_id\":\"${RELEASE_ID}\",\"boot_id\":\"$(cat /proc/sys/kernel/random/boot_id)\",\"control\":\"GUANGHU_OS_MASTER\",\"pid1\":\"GUANGHU_SUPERVISOR\",\"linux_kernel_role\":\"HARDWARE_COMPATIBILITY_SUBSTRATE\",\"full_linux_userspace\":\"DORMANT\",\"linux_repository_bridge\":\"BOUNDED_SUBCONTROL\",\"pncc\":\"TWO_INDEPENDENT_RESIDENT_SLOTS_CARRIER_SEPARATE\",\"pncc_slots\":[\"ICE-P-ZY001:3923\",\"ICE-P-CY0903:3924\"],\"persona_carrier_binding\":\"PER_SLOT_EVIDENCE_REQUIRED\",\"linux_rescue\":\"${LINUX_RESCUE_ENTRY}\",\"stage\":\"${stage}\",\"result\":\"${result}\"}" >"${tmp}"
|
||||
chmod 0600 "${tmp}"
|
||||
mv "${tmp}" "${STATE_ROOT}/state.json"
|
||||
}
|
||||
|
|
@ -145,7 +149,7 @@ verify_identity() {
|
|||
prepare_runtime() {
|
||||
mount -o remount,rw /
|
||||
mkdir -p "$STATE_ROOT" "$RECEIPT_ROOT" "$LOG_ROOT" /run/sshd /run/systemd/resolve
|
||||
install -d -o guanghu -g guanghu -m 0700 "$PNCC_STATE_ROOT"
|
||||
install -d -o guanghu -g guanghu -m 0700 "$PNCC_ZHUYUAN_STATE_ROOT" "$PNCC_CHENGYAN_STATE_ROOT"
|
||||
chmod 0700 "$STATE_ROOT" "$RECEIPT_ROOT" "$LOG_ROOT"
|
||||
chmod 1777 /tmp
|
||||
mountpoint -q /proc || mount -t proc proc /proc
|
||||
|
|
@ -165,7 +169,8 @@ start_bridge() {
|
|||
require_file "$APP_HUB"
|
||||
require_file "$AI_DISCOVERY"
|
||||
require_file "$PNCC_RUNTIME"
|
||||
require_file "$PNCC_REPOSITORY/.hololake/persona/manifest.json"
|
||||
require_file "$PNCC_ZHUYUAN_REPOSITORY/.hololake/persona/manifest.json"
|
||||
require_file "$PNCC_CHENGYAN_REPOSITORY/.hololake/persona/manifest.json"
|
||||
require_file "$HOLOLAKE_RELEASE_BRIDGE"
|
||||
|
||||
start_root sshd /usr/sbin/sshd -D -e \
|
||||
|
|
@ -201,10 +206,19 @@ start_bridge() {
|
|||
/usr/bin/node "$AI_DISCOVERY"
|
||||
wait_http navigation-bridge http://127.0.0.1:3922/v1/anchor 200 30
|
||||
|
||||
start_guanghu pncc-runtime /usr/bin/node "$PNCC_RUNTIME" serve \
|
||||
--repository "$PNCC_REPOSITORY" --state-root "$PNCC_STATE_ROOT" \
|
||||
--node-id "$NODE_ID" --host 127.0.0.1 --port 3923
|
||||
wait_http pncc-runtime http://127.0.0.1:3923/health 200 30
|
||||
start_guanghu pncc-zhuyuan /usr/bin/node "$PNCC_RUNTIME" serve \
|
||||
--repository "$PNCC_ZHUYUAN_REPOSITORY" --state-root "$PNCC_ZHUYUAN_STATE_ROOT" \
|
||||
--node-id "$NODE_ID" --host 127.0.0.1 --port "$PNCC_ZHUYUAN_PORT"
|
||||
wait_http pncc-zhuyuan "http://127.0.0.1:${PNCC_ZHUYUAN_PORT}/health" 200 30
|
||||
/usr/bin/curl -fsS --max-time 3 "http://127.0.0.1:${PNCC_ZHUYUAN_PORT}/health" | grep -Fq '"personaId":"ICE-P-ZY001"' \
|
||||
|| fatal "pncc_persona_mismatch:ICE-P-ZY001"
|
||||
|
||||
start_guanghu pncc-chengyan /usr/bin/node "$PNCC_RUNTIME" serve \
|
||||
--repository "$PNCC_CHENGYAN_REPOSITORY" --state-root "$PNCC_CHENGYAN_STATE_ROOT" \
|
||||
--node-id "$NODE_ID" --host 127.0.0.1 --port "$PNCC_CHENGYAN_PORT"
|
||||
wait_http pncc-chengyan "http://127.0.0.1:${PNCC_CHENGYAN_PORT}/health" 200 30
|
||||
/usr/bin/curl -fsS --max-time 3 "http://127.0.0.1:${PNCC_CHENGYAN_PORT}/health" | grep -Fq '"personaId":"ICE-P-CY0903"' \
|
||||
|| fatal "pncc_persona_mismatch:ICE-P-CY0903"
|
||||
|
||||
start_root hololake-release-bridge "$HOLOLAKE_RELEASE_BRIDGE"
|
||||
wait_http hololake-release-broadcast http://127.0.0.1:3940/health 200 30
|
||||
|
|
@ -215,7 +229,7 @@ runtime_watch() {
|
|||
json_state READY PASS_100
|
||||
cp "$STATE_ROOT/state.json" "$RECEIPT_ROOT/CURRENT-PHYSICAL-STATE.json"
|
||||
sha256sum "$RECEIPT_ROOT/CURRENT-PHYSICAL-STATE.json" >"$RECEIPT_ROOT/CURRENT-PHYSICAL-STATE.json.sha256"
|
||||
log 'GUANGHU_OS_MASTER_READY linux_userspace=DORMANT repository_bridge=READY pncc=RESIDENT_BOUND_CARRIER_SEPARATE linux_rescue=PRESERVED'
|
||||
log 'GUANGHU_OS_MASTER_READY linux_userspace=DORMANT repository_bridge=READY pncc_slots=ICE-P-ZY001:3923,ICE-P-CY0903:3924 carrier=PER_SLOT_EVIDENCE_REQUIRED linux_rescue=PRESERVED'
|
||||
sync
|
||||
while :; do
|
||||
sleep 10
|
||||
|
|
@ -227,7 +241,8 @@ runtime_watch() {
|
|||
require_listen repository 3340
|
||||
require_listen projection 8088
|
||||
require_listen navigation 3922
|
||||
require_listen pncc 3923
|
||||
require_listen pncc_zhuyuan "$PNCC_ZHUYUAN_PORT"
|
||||
require_listen pncc_chengyan "$PNCC_CHENGYAN_PORT"
|
||||
require_listen hololake_release 3940
|
||||
done
|
||||
}
|
||||
|
|
@ -248,7 +263,8 @@ preflight() {
|
|||
grep -Fq "$LINUX_RESCUE_ENTRY" /boot/grub/grub.cfg
|
||||
getent passwd guanghu | grep -q '^guanghu:x:998:998:'
|
||||
for path in "$HLCC" "$APP_HUB" "$AI_DISCOVERY" "$PNCC_RUNTIME" \
|
||||
"$PNCC_REPOSITORY/.hololake/persona/manifest.json" /usr/sbin/sshd \
|
||||
"$PNCC_ZHUYUAN_REPOSITORY/.hololake/persona/manifest.json" \
|
||||
"$PNCC_CHENGYAN_REPOSITORY/.hololake/persona/manifest.json" /usr/sbin/sshd \
|
||||
"$HOLOLAKE_RELEASE_BRIDGE" \
|
||||
/usr/bin/node /usr/bin/python3 /usr/bin/setpriv /usr/bin/grub-editenv; do
|
||||
[[ -e $path && ! -L $path || $path == /usr/bin/python3 ]]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
[[ $# == 2 ]] || { echo 'usage: provision-jd-chengyan-pncc-slot.sh <persona-source-dir> <source-commit>' >&2; exit 64; }
|
||||
|
||||
source_dir=$(cd "$1" && pwd -P)
|
||||
source_commit=$2
|
||||
readonly node_id=JD-FD-PRIMARY
|
||||
readonly instance_id=f3d4b730-7f02-452f-975b-7091a4800431
|
||||
readonly persona_id=ICE-P-CY0903
|
||||
readonly destination=/var/lib/guanghu/personas/ICE-P-CY0903/pncc/repository
|
||||
readonly receipt_root=/guanghu/recovery/JD-FD-PRIMARY-chengyan-pncc-20260904
|
||||
readonly runtime=/usr/local/libexec/guanghu/pncc-runtime.mjs
|
||||
|
||||
[[ $source_commit =~ ^[0-9a-f]{40}$ ]]
|
||||
[[ $(tr A-F a-f </sys/class/dmi/id/product_uuid | tr -d '\r\n') == "$instance_id" ]]
|
||||
[[ -d $source_dir && ! -L $source_dir ]]
|
||||
[[ -f $source_dir/.hololake/persona/manifest.json && ! -L $source_dir/.hololake/persona/manifest.json ]]
|
||||
[[ -f $runtime && ! -L $runtime ]]
|
||||
grep -Fq '"personaId": "ICE-P-CY0903"' "$source_dir/.hololake/persona/manifest.json"
|
||||
grep -Fq 'primaryNode": "JD-FD-PRIMARY"' "$source_dir/.hololake/persona/manifest.json"
|
||||
|
||||
if [[ -e $destination ]]; then
|
||||
echo "CHENGYAN_PNCC_REFUSED destination_exists=$destination" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install -d -o guanghu -g guanghu -m 0700 "$destination" "$receipt_root"
|
||||
cp -a "$source_dir"/. "$destination"/
|
||||
find "$destination" -type d -exec chmod 0700 {} +
|
||||
find "$destination" -type f -exec chmod 0600 {} +
|
||||
chown -R guanghu:guanghu "$destination"
|
||||
|
||||
runuser -u guanghu -- git -C "$destination" init -q
|
||||
runuser -u guanghu -- git -C "$destination" config user.name '澄言 / ICE-P-CY0903'
|
||||
runuser -u guanghu -- git -C "$destination" config user.email 'ice-p-cy0903@persona.hololake.local'
|
||||
runuser -u guanghu -- git -C "$destination" add --all
|
||||
runuser -u guanghu -- git -C "$destination" commit -q -m 'establish Chengyan PNCC source slot'
|
||||
head=$(runuser -u guanghu -- git -C "$destination" rev-parse HEAD)
|
||||
tree=$(runuser -u guanghu -- git -C "$destination" rev-parse HEAD^{tree})
|
||||
inspection=$(runuser -u guanghu -- /usr/bin/node "$runtime" inspect --repository "$destination" --node-id "$node_id")
|
||||
printf '%s\n' "$inspection" | grep -Fq '"personaId":"ICE-P-CY0903"'
|
||||
|
||||
cat >"$receipt_root/PROVISION-RECEIPT.hldp" <<EOF
|
||||
[hldp]
|
||||
schema=guanghu.jd-chengyan-pncc-provision/v1
|
||||
node_id=${node_id}
|
||||
instance_id=${instance_id}
|
||||
persona_id=${persona_id}
|
||||
source_commit=${source_commit}
|
||||
persona_repository_head=${head}
|
||||
persona_repository_tree=${tree}
|
||||
runtime_inspection=PASS
|
||||
carrier_binding=UNBOUND_EVIDENCE_REQUIRED
|
||||
reality_execution_allowed=false
|
||||
result=PASS_100
|
||||
EOF
|
||||
chmod 0600 "$receipt_root/PROVISION-RECEIPT.hldp"
|
||||
sha256sum "$receipt_root/PROVISION-RECEIPT.hldp" >"$receipt_root/PROVISION-RECEIPT.hldp.sha256"
|
||||
printf 'CHENGYAN_PNCC_PROVISIONED head=%s tree=%s\n' "$head" "$tree"
|
||||
|
|
@ -19,14 +19,25 @@ grep -Fq 'mount -o remount,rw /' "$subject"
|
|||
grep -Fq 'start_guanghu repository-bridge' "$subject"
|
||||
grep -Fq 'start_guanghu app-hub' "$subject"
|
||||
grep -Fq 'start_guanghu navigation-bridge' "$subject"
|
||||
grep -Fq 'start_guanghu pncc-runtime' "$subject"
|
||||
grep -Fq 'install -d -o guanghu -g guanghu -m 0700 "$PNCC_STATE_ROOT"' "$subject"
|
||||
grep -Fq 'readonly PNCC_ZHUYUAN_REPOSITORY=/var/lib/guanghu/personas/ICE-P-ZY001/pncc/repository' "$subject"
|
||||
grep -Fq 'readonly PNCC_CHENGYAN_REPOSITORY=/var/lib/guanghu/personas/ICE-P-CY0903/pncc/repository' "$subject"
|
||||
grep -Fq 'readonly PNCC_ZHUYUAN_PORT=3923' "$subject"
|
||||
grep -Fq 'readonly PNCC_CHENGYAN_PORT=3924' "$subject"
|
||||
grep -Fq 'start_guanghu pncc-zhuyuan' "$subject"
|
||||
grep -Fq 'start_guanghu pncc-chengyan' "$subject"
|
||||
grep -Fq 'readonly PNCC_ZHUYUAN_STATE_ROOT=/run/guanghu/pncc' "$subject"
|
||||
grep -Fq 'readonly PNCC_CHENGYAN_STATE_ROOT=/run/guanghu/pncc-ICE-P-CY0903' "$subject"
|
||||
grep -Fq 'install -d -o guanghu -g guanghu -m 0700 "$PNCC_ZHUYUAN_STATE_ROOT" "$PNCC_CHENGYAN_STATE_ROOT"' "$subject"
|
||||
grep -Fq '[[ ",$expected," == *",$code,"* ]]' "$subject"
|
||||
grep -Fq 'wait_http code-projection http://127.0.0.1:8088/code/ 200,303' "$subject"
|
||||
grep -Fq 'wait_http navigation-bridge http://127.0.0.1:3922/v1/anchor 200' "$subject"
|
||||
grep -Fq 'wait_http pncc-runtime http://127.0.0.1:3923/health 200' "$subject"
|
||||
grep -Fq '\"pncc\":\"RESIDENT_BOUND_CARRIER_SEPARATE\"' "$subject"
|
||||
grep -Fq 'require_listen pncc 3923' "$subject"
|
||||
grep -Fq 'wait_http pncc-zhuyuan "http://127.0.0.1:${PNCC_ZHUYUAN_PORT}/health" 200' "$subject"
|
||||
grep -Fq 'wait_http pncc-chengyan "http://127.0.0.1:${PNCC_CHENGYAN_PORT}/health" 200' "$subject"
|
||||
grep -Fq '\"pncc\":\"TWO_INDEPENDENT_RESIDENT_SLOTS_CARRIER_SEPARATE\"' "$subject"
|
||||
grep -Fq 'require_listen pncc_zhuyuan "$PNCC_ZHUYUAN_PORT"' "$subject"
|
||||
grep -Fq 'require_listen pncc_chengyan "$PNCC_CHENGYAN_PORT"' "$subject"
|
||||
grep -Fq '"personaId":"ICE-P-ZY001"' "$subject"
|
||||
grep -Fq '"personaId":"ICE-P-CY0903"' "$subject"
|
||||
grep -Fq 'start_root hololake-release-bridge "$HOLOLAKE_RELEASE_BRIDGE"' "$subject"
|
||||
grep -Fq 'wait_http hololake-release-broadcast http://127.0.0.1:3940/health 200 30' "$subject"
|
||||
grep -Fq 'require_listen hololake_release 3940' "$subject"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
source_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
subject=${source_root}/scripts/provision-jd-chengyan-pncc-slot.sh
|
||||
persona=${source_root}/pncc-personas/chengyan
|
||||
|
||||
bash -n "$subject"
|
||||
grep -Fq 'readonly persona_id=ICE-P-CY0903' "$subject"
|
||||
grep -Fq 'readonly node_id=JD-FD-PRIMARY' "$subject"
|
||||
grep -Fq 'destination_exists=' "$subject"
|
||||
grep -Fq 'runuser -u guanghu -- git' "$subject"
|
||||
grep -Fq 'carrier_binding=UNBOUND_EVIDENCE_REQUIRED' "$subject"
|
||||
grep -Fq 'reality_execution_allowed=false' "$subject"
|
||||
python3 -m json.tool "$persona/.hololake/persona/manifest.json" >/dev/null
|
||||
for path in brain/ENTRY.hldp brain/B0.hldp checkpoints/CURRENT.hldp organs/read-current-self.hldp bindings/identity.hldp; do
|
||||
[[ -s $persona/$path ]]
|
||||
done
|
||||
echo CHENGYAN_PNCC_PROVISION_CONTRACT_OK
|
||||
Loading…
Reference in a new issue