diff --git a/Makefile b/Makefile index 45ef4dd4b51..376abb6d9dd 100644 --- a/Makefile +++ b/Makefile @@ -682,6 +682,9 @@ run-live-gui: $(SWTPM) GETTY $(DEVICETREE_DTB) run-target: $(SWTPM) GETTY $(QEMU_SYSTEM) $(QEMU_OPTS) -drive file=$(TARGET_IMG),format=$(IMG_FORMAT) +run-target-live-gui: $(SWTPM) GETTY $(DEVICETREE_DTB) + $(QEMU_SYSTEM) $(QEMU_OPTS_GUI) -drive file=$(TARGET_IMG),format=$(IMG_FORMAT) + run-rootfs%: $(SWTPM) GETTY (echo 'set devicetree="(hd0,msdos1)/eve.dtb"' ; echo 'set rootfs_root=/dev/vdb' ; echo 'set root=hd1' ; echo 'export rootfs_root' ; echo 'export devicetree' ; echo 'configfile /EFI/BOOT/grub.cfg' ) > $(EFI_PART)/BOOT/grub.cfg $(QEMU_SYSTEM) $(QEMU_OPTS) -drive file=$(ROOTFS_IMG_BASE)$*.img,format=raw -drive file=fat:rw:$(EFI_PART)/..,label=CONFIG,id=uefi-disk,format=vvfat @@ -1353,6 +1356,7 @@ help: @echo " run-installer-raw runs installer.raw (via qemu) and 'installs' EVE into (initially blank) target.img" @echo " run-installer-net runs installer.net (via qemu/iPXE) and 'installs' EVE into (initially blank) target.img" @echo " run-target runs a full fledged virtual device on qemu from target.img (similar to run-live)" + @echo " run-target-live-gui same as run-target but with an emulated graphics card" @echo @echo "make run is currently an alias for make run-live" @echo diff --git a/pkg/pillar/cmd/monitor/ipc_server.go b/pkg/pillar/cmd/monitor/ipc_server.go index e886ff33e02..ed0380aeebf 100644 --- a/pkg/pillar/cmd/monitor/ipc_server.go +++ b/pkg/pillar/cmd/monitor/ipc_server.go @@ -179,15 +179,25 @@ func (s *monitorIPCServer) sendIpcMessage(t string, msg any) error { ipcMessage := ipcMessage{Type: t, Message: json.RawMessage(data)} + // re-marshal with the ipcMessage wrapper if data, err = json.Marshal(ipcMessage); err != nil { log.Errorf("Failed to Marshal IPC message: %v", err) return err } + // Log only metadata for large messages to avoid logging system issues if t == "TpmLogs" { - log.Noticef("Sending IPC message: %s", t) + log.Noticef("Sending IPC message: type=%s (TpmLogs - large binary data)", t) + } else if t == "EvalStatus" { + log.Noticef("Sending IPC message: type=%s (EvalStatus - evaluation status update)", t) } else { - log.Noticef("Sending IPC message: %s", string(data)) + // For smaller messages, truncate if needed + msgStr := string(data) + if len(msgStr) > 500 { + log.Noticef("Sending IPC message: type=%s, size=%d bytes (message truncated)", t, len(msgStr)) + } else { + log.Noticef("Sending IPC message: %s", msgStr) + } } _, err = s.codec.Write(data) diff --git a/pkg/pillar/cmd/monitor/subscriptions.go b/pkg/pillar/cmd/monitor/subscriptions.go index 8eba9475a6c..21939f2e1df 100644 --- a/pkg/pillar/cmd/monitor/subscriptions.go +++ b/pkg/pillar/cmd/monitor/subscriptions.go @@ -241,6 +241,32 @@ func handleGlobalConfigImpl(ctxArg interface{}, key string, log.Functionf("handleGlobalConfigImpl done for %s", key) } +func handleEvalStatusCreate(ctxArg interface{}, key string, statusArg interface{}) { + log.Functionf("handleEvalStatusCreate called: key=%s, type=%T", key, statusArg) + handleEvalStatusUpdate(ctxArg, key, statusArg) +} + +func handleEvalStatusModify(ctxArg interface{}, key string, statusArg interface{}, oldStatusArg interface{}) { + log.Functionf("handleEvalStatusModify called: key=%s, type=%T", key, statusArg) + oldStatus := oldStatusArg.(types.EvalStatus) + newStatus := statusArg.(types.EvalStatus) + log.Functionf("handleEvalStatusModify: old phase=%s -> new phase=%s, allowOnboard %t -> %t", + oldStatus.Phase, newStatus.Phase, oldStatus.AllowOnboard, newStatus.AllowOnboard) + handleEvalStatusUpdate(ctxArg, key, statusArg) +} + +func handleEvalStatusDelete(ctxArg interface{}, key string, statusArg interface{}) { + log.Functionf("handleEvalStatusDelete called: key=%s", key) +} + +func handleEvalStatusUpdate(ctxArg interface{}, key string, statusArg interface{}) { + ctx := ctxArg.(*monitor) + status := statusArg.(types.EvalStatus) + log.Functionf("handleEvalStatusUpdate: EvalStatus details - platform=%t, slot=%s, phase=%s, allowOnboard=%t, inventory=%t", + status.IsEvaluationPlatform, status.CurrentSlot, status.Phase, status.AllowOnboard, status.InventoryCollected) + ctx.IPCServer.sendIpcMessage("EvalStatus", status) +} + func (ctx *monitor) subscribe(ps *pubsub.PubSub) error { var err error @@ -441,6 +467,26 @@ func (ctx *monitor) subscribe(ps *pubsub.PubSub) error { ErrorTime: errorTime, }) + log.Noticef("Creating subscription for EvalStatus from evalmgr") + subEvalStatus, err := ps.NewSubscription(pubsub.SubscriptionOptions{ + AgentName: "evalmgr", + MyAgentName: agentName, + TopicImpl: types.EvalStatus{}, + Persistent: true, + Activate: false, + Ctx: ctx, + CreateHandler: handleEvalStatusCreate, + ModifyHandler: handleEvalStatusModify, + DeleteHandler: handleEvalStatusDelete, + WarningTime: warningTime, + ErrorTime: errorTime, + }) + if err != nil { + log.Errorf("Cannot create subscription for EvalStatus: %v", err) + return err + } + log.Noticef("Successfully created subscription for EvalStatus") + ctx.subscriptions["IOAdapters"] = subPhysicalIOAdapter ctx.subscriptions["VaultStatus"] = subVaultStatus ctx.subscriptions["OnboardingStatus"] = subOnboardStatus @@ -452,6 +498,7 @@ func (ctx *monitor) subscribe(ps *pubsub.PubSub) error { ctx.subscriptions["LedBlinkCounter"] = subLedBlinkCounter ctx.subscriptions["ZedAgentStatus"] = subZedAgentStatus ctx.subscriptions["GlobalConfig"] = subGlobalConfig + ctx.subscriptions["EvalStatus"] = subEvalStatus return nil }