Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aarch64 gns3 appliance and improved branding support #164

Merged
merged 9 commits into from
Oct 12, 2023
55 changes: 46 additions & 9 deletions board/common/mkgns3a.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
#!/bin/sh

# The aarch64 build currently has no "loader" but instead starts Linux
# directly, so we need to add a basic cmdline.
loader_args()
{
if [ "$ARCH" != "x86_64" ]; then
troglobit marked this conversation as resolved.
Show resolved Hide resolved
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 [ -n "$INFIX_RELEASE" ]; then
rel="-${INFIX_RELEASE}"
fi

NM="${1:-custom}${rel}"
RAM=${2:-512}
IFNUM=${3:-1}
ARCH=$1
NM="${2:-custom}${rel}"
RAM=${3:-512}
IFNUM=${4:-1}

if [ "$ARCH" = "x86_64" ]; then
loader=OVMF.fd
accel=allow
opts=
else
loader=Image
accel=disable
opts="-M virt -cpu cortex-a72"
fi

cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
{
Expand All @@ -29,15 +64,17 @@ cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
"ram": ${RAM},
"cpus": 1,
"hda_disk_interface": "virtio",
"arch": "x86_64",
"arch": "$ARCH",
"console_type": "telnet",
"kvm": "allow"
$(loader_args)
"kvm": "$accel",
"options": "$opts"
},
"images": [
{
"filename": "OVMF.fd",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/OVMF.fd"),
"md5sum": "$(md5sum "$BINARIES_DIR/OVMF.fd" | awk '{print $1}')",
"filename": "$loader",
"filesize": $(stat --printf='%s' "$BINARIES_DIR/$loader"),
"md5sum": "$(md5sum "$BINARIES_DIR/$loader" | awk '{print $1}')",
"version": "0.0"
},
{
Expand All @@ -51,7 +88,7 @@ cat <<EOF >"$BINARIES_DIR/${NM}.gns3a"
{
"name": "0.0",
"images": {
"bios_image": "OVMF.fd",
$(loader_img)
"hda_disk_image": "disk.img"
}
}
Expand Down
2 changes: 1 addition & 1 deletion board/common/post-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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 $NAME $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM
$common/mkgns3a.sh $BR2_ARCH $NAME $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM
fi

load_cfg FIT_IMAGE
Expand Down