From 9018024ca92802c4234c5bce0dc8f37dd3af7cb9 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 16 Jan 2023 19:12:32 +0100 Subject: [PATCH] Add support for generating GNS3 appliance file for amd64 builds Signed-off-by: Joachim Wiberg --- board/amd64/isolinux.cfg | 15 +++++++++++ board/amd64/linux_defconfig | 5 ++++ board/common/mkgns3a.sh | 51 +++++++++++++++++++++++++++++++++++++ board/common/post-image.sh | 10 ++++++-- configs/amd64_defconfig | 7 +++++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 board/amd64/isolinux.cfg create mode 100755 board/common/mkgns3a.sh diff --git a/board/amd64/isolinux.cfg b/board/amd64/isolinux.cfg new file mode 100644 index 00000000..e1b1d201 --- /dev/null +++ b/board/amd64/isolinux.cfg @@ -0,0 +1,15 @@ +serial 0 115200 +timeout 20 +totaltimeout 100 +ontimeout qemu +ui menu.c32 + +label qemu + kernel __KERNEL_PATH__ + initrd __INITRD_PATH__ + append root=/dev/sr0 console=ttyS0 quiet + +label live + kernel __KERNEL_PATH__ + initrd __INITRD_PATH__ + append root=/dev/sr0 console=tty0 quiet diff --git a/board/amd64/linux_defconfig b/board/amd64/linux_defconfig index 1f3d8956..d5207ea4 100644 --- a/board/amd64/linux_defconfig +++ b/board/amd64/linux_defconfig @@ -1,5 +1,6 @@ CONFIG_SYSVIPC=y CONFIG_CGROUPS=y +CONFIG_BLK_DEV_INITRD=y CONFIG_SMP=y CONFIG_HYPERVISOR_GUEST=y CONFIG_PARAVIRT=y @@ -63,8 +64,12 @@ CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_FW_CFG_SYSFS=y CONFIG_FW_CFG_SYSFS_CMDLINE=y +CONFIG_BLK_DEV_NULL_BLK=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y CONFIG_VIRTIO_BLK=y CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y CONFIG_SCSI_VIRTIO=y CONFIG_ATA=y CONFIG_ATA_PIIX=y diff --git a/board/common/mkgns3a.sh b/board/common/mkgns3a.sh new file mode 100755 index 00000000..31703a35 --- /dev/null +++ b/board/common/mkgns3a.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +cat <"$BINARIES_DIR/infix.gns3a" +{ + "name": "infix", + "category": "router", + "description": "Infix Network Operating System", + "vendor_name": "KernelKit", + "vendor_url": "https://github.com/kernelkit/", + "product_name": "Infix", + "registry_version": 6, + "status": "stable", + "maintainer": "KernelKit", + "maintainer_email": "infix@example.com", + "port_name_format": "eth{0}", + "linked_clone": true, + "qemu": { + "adapter_type": "virtio-net-pci", + "adapters": 10, + "ram": 192, + "cpus": 1, + "hda_disk_interface": "virtio", + "arch": "x86_64", + "console_type": "telnet", + "kvm": "allow" + }, + "images": [ + { + "filename": "rootfs.iso9660", + "filesize": $(stat --printf='%s' "$BINARIES_DIR/rootfs.iso9660"), + "md5sum": "$(md5sum "$BINARIES_DIR/rootfs.iso9660" | awk '{print $1}')", + "version": "v0.0" + }, + { + "filename": "rw.ext4", + "filesize": $(stat --printf='%s' "$BINARIES_DIR/rw.ext4"), + "md5sum": "$(md5sum "$BINARIES_DIR/rw.ext4" | awk '{print $1}')", + "version": "v0.0" + } + ], + "versions": [ + { + "name": "v0.0", + "images": { + "cdrom_image": "rootfs.iso9660", + "hda_disk_image": "rw.ext4" + } + } + ] +} +EOF diff --git a/board/common/post-image.sh b/board/common/post-image.sh index f765a148..c31f57e1 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -1,5 +1,11 @@ #!/bin/sh +# shellcheck disable=SC1090 +. "$BR2_CONFIG" 2>/dev/null -common=$(dirname $(readlink -f "$0")) +common=$(dirname "$(readlink -f "$0")") -$common/mkfit.sh +"$common/mkfit.sh" + +if [ "$BR2_ARCH" = "x86_64" ]; then + "$common/mkgns3a.sh" +fi diff --git a/configs/amd64_defconfig b/configs/amd64_defconfig index 568ab7bf..da82945a 100644 --- a/configs/amd64_defconfig +++ b/configs/amd64_defconfig @@ -56,7 +56,14 @@ BR2_PACKAGE_WATCHDOGD=y BR2_PACKAGE_MG=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_SIZE="128M" +BR2_TARGET_ROOTFS_ISO9660=y +BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="$(BR2_EXTERNAL_INFIX_PATH)/board/amd64/isolinux.cfg" +BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_SYSLINUX=y +BR2_TARGET_SYSLINUX_ISOLINUX=y +BR2_TARGET_SYSLINUX_MBR=y +BR2_TARGET_SYSLINUX_C32="dmi.c32 libcom32.c32 libgpl.c32 liblua.c32 libutil.c32 lua.c32 menu.c32 syslinux.c32" BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y BR2_PACKAGE_FACTORY=y BR2_PACKAGE_FINIT_SULOGIN=y