diff --git a/board/common/genimage.cfg.in b/board/common/genimage.cfg.in index 70b6a8ec..efd68295 100644 --- a/board/common/genimage.cfg.in +++ b/board/common/genimage.cfg.in @@ -30,7 +30,7 @@ image var.ext4 { } } -image disk.img { +image @DISKIMG@ { size = @TOTALSIZE@ hdimage { partition-table-type = "gpt" diff --git a/board/common/mkdisk.sh b/board/common/mkdisk.sh index cc99b4a3..d2f5132c 100755 --- a/board/common/mkdisk.sh +++ b/board/common/mkdisk.sh @@ -123,10 +123,11 @@ tmp=$BUILD_DIR/genimage.tmp total=$((512 << M)) bootoffs=$((32 << K)) bootdata= +diskimg=disk.img bootimg= bootpart= -while getopts "a:b:B:s:" opt; do +while getopts "a:b:B:n:s:" opt; do case ${opt} in a) arch=$OPTARG @@ -137,6 +138,9 @@ while getopts "a:b:B:s:" opt; do B) bootoffs=$(($OPTARG)) ;; + n) + diskimg=${OPTARG} + ;; s) total=$(size2int $OPTARG) ;; @@ -158,6 +162,7 @@ awk \ -vimgsize=$imgsize \ -vcfgsize=$cfgsize \ -vvarsize=$varsize \ + -vdiskimg=$diskimg \ -vbootimg="$bootimg" -vbootpart="$bootpart" \ '{ sub(/@TOTALSIZE@/, total); @@ -166,7 +171,7 @@ awk \ sub(/@IMGSIZE@/, imgsize); sub(/@CFGSIZE@/, cfgsize); sub(/@VARSIZE@/, varsize); - + sub(/@DISKIMG@/, diskimg); sub(/@BOOTIMG@/, bootimg); sub(/@BOOTPART@/, bootpart); }1' \ diff --git a/board/common/mkgns3a.sh b/board/common/mkgns3a.sh index 931e085a..1950b0af 100755 --- a/board/common/mkgns3a.sh +++ b/board/common/mkgns3a.sh @@ -1,4 +1,16 @@ #!/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. @@ -24,15 +36,6 @@ EOF fi } -if [ -n "$INFIX_RELEASE" ]; then - rel="-${INFIX_RELEASE}" -fi - -ARCH=$1 -NM="${2:-custom}${rel}" -RAM=${3:-512} -IFNUM=${4:-1} - if [ "$ARCH" = "x86_64" ]; then loader=OVMF.fd accel=allow @@ -43,19 +46,21 @@ else opts="-M virt -cpu cortex-a72" fi +echo ">> Disk image MD5: $(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')" + cat <"$BINARIES_DIR/${NM}.gns3a" { "name": "$NM", "category": "router", - "description": "Infix is a Network Operating System based on Linux. It can be set up both as a switch, with offloading using switchdev, and a router with firewalling.", - "vendor_name": "KernelKit", - "vendor_url": "https://github.com/kernelkit/", - "product_name": "Infix", + "description": "$INFIX_DESC", + "vendor_name": "$VENDOR_NAME", + "vendor_url": "$VENDOR_HOME", + "product_name": "$NAME", "registry_version": 6, "status": "stable", - "maintainer": "KernelKit", - "maintainer_email": "kernelkit@googlegroups.com", - "usage": "Default console login is 'root', no password. For remote login, default user/pass: admin/admin also works.\n\nType 'help' for an overview of commands and relevant configuration files.\n\nThe /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/", + "maintainer": "$VENDOR_NAME", + "maintainer_email": "${SUPPORT_URL#mailto:}", + "usage": "Default login, user/pass: admin/admin\n\nType 'help' for an overview of commands and relevant configuration files.\n\nFor Classic builds the following applies: the /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/", "port_name_format": "eth{0}", "linked_clone": true, "qemu": { @@ -66,6 +71,7 @@ cat <"$BINARIES_DIR/${NM}.gns3a" "hda_disk_interface": "virtio", "arch": "$ARCH", "console_type": "telnet", + $(loader_img) $(loader_args) "kvm": "$accel", "options": "$opts" @@ -78,9 +84,9 @@ cat <"$BINARIES_DIR/${NM}.gns3a" "version": "0.0" }, { - "filename": "disk.img", - "filesize": $(stat --printf='%s' "$BINARIES_DIR/disk.img"), - "md5sum": "$(md5sum "$BINARIES_DIR/disk.img" | awk '{print $1}')", + "filename": "$DISK", + "filesize": $(stat --printf='%s' "$BINARIES_DIR/$DISK"), + "md5sum": "$(md5sum "$BINARIES_DIR/$DISK" | awk '{print $1}')", "version": "0.0" } ], @@ -89,7 +95,7 @@ cat <"$BINARIES_DIR/${NM}.gns3a" "name": "0.0", "images": { $(loader_img) - "hda_disk_image": "disk.img" + "hda_disk_image": "$DISK" } } ] diff --git a/board/common/post-image.sh b/board/common/post-image.sh index f74182c1..417f968f 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -1,12 +1,18 @@ #!/bin/sh +# shellcheck disable=SC2086 + common=$(dirname "$(readlink -f "$0")") . "$common/lib.sh" +# shellcheck disable=SC1091 +. "$TARGET_DIR/etc/os-release" + +load_cfg INFIX_ID load_cfg BR2_ARCH load_cfg BR2_DEFCONFIG load_cfg BR2_EXTERNAL_INFIX_PATH load_cfg BR2_TARGET_ROOTFS -NAME=infix-$(basename "$BR2_DEFCONFIG" _defconfig | tr _ - | sed 's/x86-64/x86_64/') +NAME="$INFIX_ID"-$(echo "$BR2_ARCH" | tr _ - | sed 's/x86-64/x86_64/') diskimg=disk.img ver() @@ -32,7 +38,7 @@ fi load_cfg DISK_IMAGE if [ "$DISK_IMAGE" = "y" ]; then ixmsg "Creating Disk Image" - + diskimg="${NAME}-disk.img" bootcfg= if [ "$DISK_IMAGE_BOOT_DATA" ]; then bootcfg="-b $DISK_IMAGE_BOOT_DATA -B $DISK_IMAGE_BOOT_OFFSET" @@ -45,14 +51,15 @@ if [ "$DISK_IMAGE" = "y" ]; then [ -f "$archive" ] || wget -O"$archive" "$DISK_IMAGE_RELEASE_URL" tar -xa --strip-components=1 -C "$BINARIES_DIR" -f "$archive" fi + $common/mkrauc-status.sh "$BINARIES_DIR/${NAME}.pkg" >"$BINARIES_DIR/rauc.status" - $common/mkdisk.sh -a $BR2_ARCH -s $DISK_IMAGE_SIZE $bootcfg + $common/mkdisk.sh -a $BR2_ARCH -n $diskimg -s $DISK_IMAGE_SIZE $bootcfg fi 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 $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM + $common/mkgns3a.sh $BR2_ARCH $NAME $diskimg $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM fi load_cfg FIT_IMAGE