Skip to content

Commit

Permalink
Improved verification image
Browse files Browse the repository at this point in the history
1) Fixed controller-model.json to report the correct total size of storage
2) Added information about iommu_groups
3) Improved the labels of devices descriped in controller-model.json
4) Added the script to log the VM capabilities
5) Added a log for the available watchdogs

Signed-off-by: Ioannis Sfakianakis <jsfakas@gmail.com>
  • Loading branch information
jsfakian authored and eriknordmark committed Oct 25, 2023
1 parent 938265e commit cce7bc3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 28 deletions.
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ $(INSTALLER):
@echo $(FULL_VERSION) > $(VERSION_FILE)

$(VERIFICATION):
@mkdir -p $@
@rm -rf $@
@cp -rp $(INSTALLER) $@
@cp -r pkg/verification/verification/* $@
@echo $(FULL_VERSION) > $(VERIFICATION)/eve_version

Expand Down Expand Up @@ -738,18 +739,15 @@ $(LIVE).parallels: $(LIVE).raw
qemu-img info -f parallels --output json $(LIVE).parallels/live.0.$(PARALLELS_UUID).hds | jq --raw-output '.["virtual-size"]' | xargs ./tools/parallels_disk.sh $(LIVE) $(PARALLELS_UUID)

$(VERIFICATION).raw: $(BOOT_PART) $(EFI_PART) $(ROOTFS_IMG) $(INITRD_IMG) $(VERIFICATION_IMG) $(CONFIG_IMG) $(PERSIST_IMG) $(BSP_IMX_PART) | $(VERIFICATION)
./tools/prepare-verification.sh pkg/verification $(INSTALLER) $(VERIFICATION)
./tools/prepare-platform.sh "$(PLATFORM)" "$(BUILD_DIR)" "$(VERIFICATION)" || :
./tools/makeflash.sh "mkverification-raw-efi" -C 850 $| $@ "conf_win verification inventory_win"
$(QUIET): $@: Succeeded

$(VERIFICATION).net: $(EFI_PART) $(ROOTFS_IMG) $(INITRD_IMG) $(VERIFICATION_IMG) $(CONFIG_IMG) $(PERSIST_IMG) $(KERNEL_IMG) | $(VERIFICATION)
./tools/prepare-verification.sh pkg/verification $(INSTALLER) $(VERIFICATION)
./tools/prepare-platform.sh "$(PLATFORM)" "$(BUILD_DIR)" "$(VERIFICATION)" || :
./tools/makenet.sh $| verification.img $@

$(VERIFICATION).iso: $(EFI_PART) $(ROOTFS_IMG) $(INITRD_IMG) $(VERIFICATION_IMG) $(CONFIG_IMG) $(PERSIST_IMG) | $(VERIFICATION)
./tools/prepare-verification.sh pkg/verification $(INSTALLER) $(VERIFICATION)
./tools/prepare-platform.sh "$(PLATFORM)" "$(BUILD_DIR)" "$(VERIFICATION)" || :
./tools/makeiso.sh $| $@ verification
$(QUIET): $@: Succeeded
Expand Down Expand Up @@ -781,11 +779,10 @@ eve: $(INSTALLER) $(EVE_ARTIFACTS) current $(RUNME) $(BUILD_YML) | $(BUILD_DIR)
$(QUIET): $@: Succeeded

VERIFICATION_ARTIFACTS=$(BIOS_IMG) $(EFI_PART) $(CONFIG_IMG) $(PERSIST_IMG) $(INITRD_IMG) $(VERIFICATION_IMG) $(ROOTFS_IMG) $(SBOM) $(BSP_IMX_PART) fullname-rootfs $(BOOT_PART)
verification: $(VERIFICATION) $(VERIFICATION_ARTIFACTS) current | $(BUILD_DIR)
verification: $(VERIFICATION_ARTIFACTS) current $(VERIFICATION) | $(BUILD_DIR)
$(QUIET): "$@: Begin: EVE_REL=$(EVE_REL), HV=$(HV), LINUXKIT_PKG_TARGET=$(LINUXKIT_PKG_TARGET)"
cp images/*.yml $|
cp pkg/verification/runme.sh pkg/verification/build.yml $|
cp -r $|/installer/* $|/verification
$(PARSE_PKGS) pkg/verification/Dockerfile.in > $|/Dockerfile
$(LINUXKIT) $(DASH_V) pkg $(LINUXKIT_PKG_TARGET) --platforms linux/$(ZARCH) --hash-path $(CURDIR) --hash $(ROOTFS_VERSION)-$(HV) --docker $(if $(strip $(EVE_REL)),--release) $(EVE_REL)$(if $(strip $(EVE_REL)),-$(HV)) $(FORCE_BUILD) $|
$(QUIET)if [ -n "$(EVE_REL)" ] && [ $(HV) = $(HV_DEFAULT) ]; then \
Expand Down
41 changes: 39 additions & 2 deletions pkg/debug/spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ get_modem_atport() {
return 1
}

add_description() {
DEVICE_TYPE="$1"
if [ -n "$verbose" ]; then
desc=$(lspci -Ds "${DEVICE_TYPE}")
desc="${desc#*: }"
cat <<__EOT__
"description": ${desc},
__EOT__
fi
}

if [ -e /dev/xen ]; then
CPUS=$(eve exec xen-tools xl info | grep nr_cpus | cut -f2 -d:)
MEM=$(( $(eve exec xen-tools xl info | grep total_memory | cut -f2 -d:) ))
Expand All @@ -223,7 +234,7 @@ else
MEM=$(awk '/MemTotal:/ { print int($2 / 1024); }' < /proc/meminfo)
fi

DISK=$(lsblk -b | grep disk | awk '{ total += $4; } END { print int(total/(1024*1024*1024)); }')
DISK=$(lsblk -b -o NAME,TYPE,TRAN,SIZE | grep disk | grep -v usb | awk '{ total += $4; } END { print int(total/(1024*1024*1024)); }')
WDT=$([ -e /dev/watchdog ] && echo true || echo false)
HSM=$([ -e /dev/tpmrm0 ] && echo 1 || echo 0)

Expand Down Expand Up @@ -260,6 +271,9 @@ for VGA in $(lspci -D | grep VGA | cut -f1 -d\ ); do
"PciLong": "${VGA}"
},
"logicallabel": "VGA${ID}",
__EOT__
add_description "${VGA}"
cat <<__EOT__
"usagePolicy": {}
__EOT__
if [ -n "$verbose" ]; then
Expand All @@ -284,6 +298,9 @@ for USB in $(lspci -D | grep USB | cut -f1 -d\ ); do
"PciLong": "${USB}"
},
"logicallabel": "USB${ID}",
__EOT__
add_description "${USB}"
cat <<__EOT__
"usagePolicy": {}
__EOT__
if [ -n "$verbose" ]; then
Expand All @@ -301,6 +318,9 @@ cat <<__EOT__
"phylabel": "USB",
"assigngrp": "USB",
"logicallabel": "USB",
__EOT__
add_description "${USB}"
cat <<__EOT__
"usagePolicy": {}
},
__EOT__
Expand All @@ -319,6 +339,9 @@ for NVME in $(lspci -D | grep "Non-Volatile memory" | cut -f1 -d\ ); do
"PciLong": "${NVME}"
},
"logicallabel": "NVME${ID}",
__EOT__
add_description "${NVME}"
cat <<__EOT__
"usagePolicy": {}
__EOT__
if [ -n "$verbose" ]; then
Expand Down Expand Up @@ -440,11 +463,19 @@ for ETH in /sys/class/net/*; do
"usage": 1,
"phylabel": "${LABEL}",
"logicallabel": "${LABEL}",
__EOT__
BUS_ID=$(echo "$ETH" | sed -e 's#/net/.*'"${LABEL}"'##' -e 's#^.*/##')
if echo "${BUS_ID}" | grep -q "virtio"; then
PCI_ADDR=$(echo "$ETH" | sed -e 's#/'"${BUS_ID}"'/.*##' -e 's#^.*/##')
add_description "${PCI_ADDR}"
else
add_description "${BUS_ID}"
fi
cat <<__EOT__
"usagePolicy": {},
"cost": ${COST},
__EOT__
# XXX shouldn't we check if on USB and use the group for the USB controller?
BUS_ID=$(echo "$ETH" | sed -e 's#/net/.*'"${LABEL}"'##' -e 's#^.*/##')
if echo "$BUS_ID" | grep -q '[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f].[0-9a-f]'; then
grp=$(get_assignmentgroup "$LABEL" "$BUS_ID")
cat <<__EOT__
Expand Down Expand Up @@ -482,6 +513,9 @@ for audio in $(lspci -D | grep Audio | cut -f1 -d\ ); do
"PciLong": "${audio}"
},
"logicallabel": "Audio${ID}",
__EOT__
add_description "${audio}"
cat <<__EOT__
"usagePolicy": {}
__EOT__
if [ -n "$verbose" ]; then
Expand All @@ -507,6 +541,9 @@ if [ -n "$verbose" ]; then
"PciLong": "${pci}"
},
"logicallabel": "Other${ID}",
__EOT__
add_description "${pci}"
cat <<__EOT__
"usagePolicy": {}
__EOT__
add_pci_info "${pci}"
Expand Down
12 changes: 12 additions & 0 deletions pkg/mkverification-raw-efi/verify
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,18 @@ tpm2_pcrread >> "$REPORT/summary.log"

cp "/root/etc/eve-release" "$REPORT"

find /sys/kernel/iommu_groups/ -type l > "$REPORT/iommu_groups.out"

watchdogs=$(find /dev -name "watchdog*" | grep -vw "/dev/watchdog")
watchdogs_count=$(echo "$watchdogs" | wc -l)
if [ "${watchdogs_count}" -gt "1" ]; then
echo "Warning: ${watchdogs_count} watchdogs available" > "$REPORT/watchdogs.log"
elif [ "${watchdogs_count}" -eq "1" ]; then
wdctl "${watchdogs}" >> "$REPORT/watchdogs.log"
else
echo "No watchdogs available" > "$REPORT/watchdogs.log"
fi

cat "$REPORT/summary.log"

if [ -n "$REPORT" ]; then
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/pubsub/socketdriver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (s *SocketDriver) Publisher(global bool, name, topic string, persistent boo
sock, err := net.Dial("unixpacket", sockName)
if err == nil {
sock.Close()
s.Log.Fatalf("Can not publish %s since it it already used",
s.Log.Fatalf("Cannot publish %s since it is already used",
sockName)
}
if err := os.Remove(sockName); err != nil {
Expand Down
19 changes: 0 additions & 19 deletions tools/prepare-verification.sh

This file was deleted.

0 comments on commit cce7bc3

Please sign in to comment.