From 065c1312853f009954cef817c08d567b86b712f2 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 18 Nov 2025 22:44:40 +0100 Subject: [PATCH] board/common: Move GNS3 appliance creation to separate make target Limit support to x86, like we do on the "official" appliances on the marketplace. Aarch64 has never really been used AFAIK. Avoid the os-release import, since all that info is not important now that these appliance files are only for development scenarios. In all other cases, the official one, based on a proper release, should be used. --- board/common/Config.in | 25 +---- board/common/image/image-itb-gns3a/Config.in | 23 ++++ .../common/image/image-itb-gns3a/generate.sh | 59 ++++++++++ .../image/image-itb-gns3a/image-itb-gns3a.mk | 10 ++ board/common/mkgns3a.sh | 103 ------------------ board/common/post-image.sh | 6 - 6 files changed, 93 insertions(+), 133 deletions(-) create mode 100644 board/common/image/image-itb-gns3a/Config.in create mode 100755 board/common/image/image-itb-gns3a/generate.sh create mode 100644 board/common/image/image-itb-gns3a/image-itb-gns3a.mk delete mode 100755 board/common/mkgns3a.sh diff --git a/board/common/Config.in b/board/common/Config.in index de3521cd..3af7c388 100644 --- a/board/common/Config.in +++ b/board/common/Config.in @@ -3,6 +3,7 @@ menu "Images" source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rootfs/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-aux/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-qcow/Config.in" +source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-gns3a/Config.in" source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rauc/Config.in" endmenu @@ -24,27 +25,3 @@ config TRUSTED_KEYS_DEVELOPMENT_PATH config TRUSTED_KEYS_EXTRA_PATH string "Path to extra keys to include in image" depends on TRUSTED_KEYS - -menuconfig GNS3_APPLIANCE - bool "GNS3 Appliance" - select DISK_IMAGE - default y - help - Create a GNS3 appliance description that, together with the - disk image, can be imported into GNS3. - -config GNS3_APPLIANCE_RAM - int "Reserved RAM (MiB)" - depends on GNS3_APPLIANCE - default "192" - help - Amount of host RAM reserved for an appliance instance. - - Minimum supported size is 192M. - -config GNS3_APPLIANCE_IFNUM - int "Number of interfaces" - depends on GNS3_APPLIANCE - default "1" - help - Number of Ethernet interfaces to create for an appliance instance. diff --git a/board/common/image/image-itb-gns3a/Config.in b/board/common/image/image-itb-gns3a/Config.in new file mode 100644 index 00000000..5afe2392 --- /dev/null +++ b/board/common/image/image-itb-gns3a/Config.in @@ -0,0 +1,23 @@ +menuconfig IMAGE_ITB_GNS3A + bool "GNS3 Appliance (ITB)" + depends on BR2_x86_64 + select IMAGE_ITB_QCOW + help + Create a GNS3 appliance description that, together with the + disk image, can be imported into GNS3. + +config IMAGE_ITB_GNS3A_RAM + int "Reserved RAM (MiB)" + depends on IMAGE_ITB_GNS3A + default "192" + help + Amount of host RAM reserved for an appliance instance. + + Minimum supported size is 192M. + +config IMAGE_ITB_GNS3A_IFNUM + int "Number of interfaces" + depends on IMAGE_ITB_GNS3A + default "1" + help + Number of Ethernet interfaces to create for an appliance instance. diff --git a/board/common/image/image-itb-gns3a/generate.sh b/board/common/image/image-itb-gns3a/generate.sh new file mode 100755 index 00000000..ada7ce95 --- /dev/null +++ b/board/common/image/image-itb-gns3a/generate.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +set -e + +bios="${BINARIES_DIR}"/OVMF.fd +qcow="${BINARIES_DIR}"/"${ARTIFACT}".qcow2 +gns3a="${BINARIES_DIR}"/"${ARTIFACT}".gns3a + +cat <"${gns3a}" +{ + "name": "${ARTIFACT} devel", + "category": "router", + "description": "${ARTIFACT} development appliance", + "vendor_name": "Kernelkit", + "vendor_url": "https://kernelkit.org", + "product_name": "${ARTIFACT} devel", + "registry_version": 6, + "status": "experimental", + "maintainer": "Kernelkit", + "maintainer_email": "null@kernelkit.org", + "usage": "Default login, user/pass: admin/admin\n\nType 'cli' (and Enter) followed by 'help' for an overview of commands and relevant configuration files.", + "port_name_format": "eth{0}", + "linked_clone": true, + "qemu": { + "adapter_type": "virtio-net-pci", + "adapters": ${IFNUM}, + "ram": ${RAM}, + "cpus": 1, + "hda_disk_interface": "virtio", + "arch": "x86_64", + "console_type": "telnet", + "bios_image": "$(basename ${bios})", + "kvm": "allow" + }, + "images": [ + { + "filename": "$(basename "${bios}")", + "filesize": $(stat --printf='%s' "${bios}"), + "md5sum": "$(md5sum "${bios}" | awk '{print $1}')", + "version": "0.0" + }, + { + "filename": "$(basename "${qcow}")", + "filesize": $(stat --printf='%s' "${qcow}"), + "md5sum": "$(md5sum "${qcow}" | awk '{print $1}')", + "version": "${VERSION}" + } + ], + "versions": [ + { + "name": "${VERSION}", + "images": { + "bios_image": "$(basename ${bios})", + "hda_disk_image": "$(basename ${qcow})" + } + } + ] +} +EOF diff --git a/board/common/image/image-itb-gns3a/image-itb-gns3a.mk b/board/common/image/image-itb-gns3a/image-itb-gns3a.mk new file mode 100644 index 00000000..d4598a0f --- /dev/null +++ b/board/common/image/image-itb-gns3a/image-itb-gns3a.mk @@ -0,0 +1,10 @@ +################################################################################ +# +# image-itb-gns3a +# +################################################################################ + +IMAGE_ITB_GNS3A_DEPENDENCIES := image-itb-qcow +IMAGE_ITB_GNS3A_CONFIG_VARS := IFNUM RAM + +$(eval $(ix-image)) diff --git a/board/common/mkgns3a.sh b/board/common/mkgns3a.sh deleted file mode 100755 index 35d46d81..00000000 --- a/board/common/mkgns3a.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh -# shellcheck disable=SC1091 -. "$TARGET_DIR/etc/os-release" - -if [ -n "$INFIX_RELEASE" ]; then - rel="-${INFIX_RELEASE}" -fi - -ARCH=$1 -NM="${2:-custom}${rel}" -DISK=$3 -RAM=${4:-512} -IFNUM=${5:-1} - -# The aarch64 build currently has no "loader" but instead starts Linux -# directly, so we need to add a basic cmdline. -loader_args() -{ - if [ "$ARCH" = "aarch64" ]; then - cat <> Disk image MD5: $(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')" - -cat <"$BINARIES_DIR/${NM}.gns3a" -{ - "name": "$NM", - "category": "router", - "description": "$INFIX_DESC", - "vendor_name": "$VENDOR_NAME", - "vendor_url": "$VENDOR_HOME", - "product_name": "$NAME", - "registry_version": 6, - "status": "stable", - "maintainer": "$VENDOR_NAME", - "maintainer_email": "${SUPPORT_URL#mailto:}", - "usage": "Default login, user/pass: admin/admin\n\nType 'cli' (and Enter) followed by 'help' for an overview of commands and relevant configuration files.", - "port_name_format": "eth{0}", - "linked_clone": true, - "qemu": { - "adapter_type": "virtio-net-pci", - "adapters": ${IFNUM}, - "ram": ${RAM}, - "cpus": 1, - "hda_disk_interface": "virtio", - "arch": "$ARCH", - "console_type": "telnet", - $(loader_img) - $(loader_args) - "kvm": "$accel", - "options": "$opts" - }, - "images": [ - { - "filename": "$loader", - "filesize": $(stat --printf='%s' "$BINARIES_DIR/$loader"), - "md5sum": "$(md5sum "$BINARIES_DIR/$loader" | awk '{print $1}')", - "version": "0.0" - }, - { - "filename": "$DISK", - "filesize": $(stat --printf='%s' "$BINARIES_DIR/$DISK"), - "md5sum": "$(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')", - "version": "0.0" - } - ], - "versions": [ - { - "name": "0.0", - "images": { - $(loader_img) - "hda_disk_image": "$DISK" - } - } - ] -} -EOF diff --git a/board/common/post-image.sh b/board/common/post-image.sh index be4c9c62..e6795eae 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -33,12 +33,6 @@ ver() diskimg="${NAME}$(ver).qcow2" -load_cfg GNS3_APPLIANCE -if [ "$GNS3_APPLIANCE" = "y" ]; then - ixmsg "Creating GNS3 Appliance, $GNS3_APPLIANCE_RAM MiB with $GNS3_APPLIANCE_IFNUM ports" - $common/mkgns3a.sh $BR2_ARCH $NAME $diskimg $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM -fi - # Only for regular builds, not bootloader-only builds if [ "$BR2_TARGET_ROOTFS_SQUASHFS" = "y" ]; then rel=$(ver)