mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
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.
This commit is contained in:
+1
-24
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
bios="${BINARIES_DIR}"/OVMF.fd
|
||||
qcow="${BINARIES_DIR}"/"${ARTIFACT}".qcow2
|
||||
gns3a="${BINARIES_DIR}"/"${ARTIFACT}".gns3a
|
||||
|
||||
cat <<EOF >"${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
|
||||
@@ -0,0 +1,10 @@
|
||||
################################################################################
|
||||
#
|
||||
# image-itb-gns3a
|
||||
#
|
||||
################################################################################
|
||||
|
||||
IMAGE_ITB_GNS3A_DEPENDENCIES := image-itb-qcow
|
||||
IMAGE_ITB_GNS3A_CONFIG_VARS := IFNUM RAM
|
||||
|
||||
$(eval $(ix-image))
|
||||
@@ -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 <<EOF
|
||||
"kernel_command_line": "console=ttyAMA0 root=PARTLABEL=primary quiet",
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
loader_img()
|
||||
{
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
cat <<EOF
|
||||
"bios_image": "$loader",
|
||||
EOF
|
||||
else
|
||||
cat <<EOF
|
||||
"kernel_image": "$loader",
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
loader=OVMF.fd
|
||||
accel=allow
|
||||
opts=
|
||||
else
|
||||
loader=Image
|
||||
accel=disable
|
||||
opts="-M virt -cpu cortex-a72"
|
||||
fi
|
||||
|
||||
echo ">> Disk image MD5: $(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')"
|
||||
|
||||
cat <<EOF >"$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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user