chore: upgrade grokrazy (#18209)

This commit is contained in:
andig 2025-02-01 11:48:29 +01:00 • committed by GitHub
parent 24ae29eb27
commit 31e476cdaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 121 deletions

View file

@ -0,0 +1,44 @@
{
"Hostname": "evcc",
"Update": {
"HTTPPort": "8080",
"HTTPPassword": "HjJv6aBX51G4wT8EueCc"
},
"Packages": [
"github.com/gokrazy/breakglass",
"tailscale.com/cmd/tailscaled",
"tailscale.com/cmd/tailscale",
"github.com/gokrazy/mkfs",
"github.com/gokrazy/fbstatus",
"github.com/gokrazy/serial-busybox",
"github.com/gokrazy/wifi"
],
"PackageConfig": {
"github.com/evcc-io/evcc": {
"GoBuildFlags": null,
"Environment": [
"EVCC_NETWORK_PORT=80",
"EVCC_DATABASE_DSN=/perm/evcc.db"
],
"ExtraFileContents": {
"/etc/evcc.yaml": " "
}
},
"github.com/gokrazy/breakglass": {
"CommandLineFlags": [
"-authorized_keys=/etc/breakglass.authorized_keys",
"-forward=private-network"
],
"ExtraFileContents": {
"/etc/breakglass.authorized_keys": " "
}
},
"tailscale.com/cmd/tailscale": {
"CommandLineFlags": [
"up",
"--ssh=true"
]
}
},
"SerialConsole": "ttyAMA0,115200"
}

View file

@ -1,102 +0,0 @@
#!/usr/bin/env bash
imagefile="${IMAGE_FILE:=drive.img}"
arch="${MACHINE:=amd64}"
os=""
if [ "$(uname)" == "Darwin" ]; then
os="darwin"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
os="linux"
fi
case $arch in
# arm64 emulator with kernel auto loading
arm64)
args=(
-name gokrazy-arm64
-m 3G
-smp 2
-M virt,highmem=off
-cpu cortex-a72
-nographic
-drive file=${imagefile},format=raw
-bios ./packaging/gokrazy/QEMU_EFI.fd
)
if [[ "$os" == "darwin" ]]; then
args+=(-nic vmnet-shared)
else
args+=(-netdev user,id=net0,hostfwd=tcp::8080-:80,hostfwd=tcp::2222-:22)
args+=(-device e1000,netdev=net0)
fi
qemu-system-aarch64 "${args[@]}"
;;
# raspi3b emulator with manual kernel loading
# requires kernel (./vmlinuz) and dtb file extraction from the drive.img,
# to be used as an arg (with -dtb, -kernel and -append)
# to instruct the vm on how to load the kernel
raspi3b)
if [[ "$os" == "darwin" ]]; then
args+=(-nic vmnet-shared)
fi
# Only works with qemu === v5.2.0
# because for lower versions networking is missing.
# It was introduced in qemu v5.2.0 via usb networking (-device usb-net), but it is very very slow at the point that gokrazy network updates fail.
# For qemu versions >= v6.0.0, the /gokrazy/init process crashes early at gokrazy.Boot(). To be investigated.
qemu_version="$(qemu-system-aarch64 --version | sed -nr 's/^.*version\s([.0-9]*).*$/\1/p')"
if [[ "$qemu_version" != "5.2.0" ]]; then
echo "error: incompatible qemu-system-aarch64 version: $qemu_version. gokrazy on raspi3b can only run on 5.2.0"
exit 1
fi
# Extract the kernel (vmlinuz) and the dtb file from the drive.img first
./extract_kernel.sh
args=(
-name gokrazy-arm64-raspi3b
-m 1024
-no-reboot
-M raspi3b
-append "console=tty1 console=ttyAMA0,115200 dwc_otg.fiq_fsm_enable=0 root=/dev/mmcblk0p2 init=/gokrazy/init rootwait panic=10 oops=panic"
-dtb ./bcm2710-rpi-3-b-plus.dtb
-nographic
-serial mon:stdio
-drive file=${imagefile},format=raw
-kernel vmlinuz
-netdev user,id=net0,hostfwd=tcp::8080-:80,hostfwd=tcp::2222-:22
-device usb-net,netdev=net0
)
qemu-system-aarch64 "${args[@]}"
;;
# amd64 emulator with kernel auto loading
amd64)
args=(
-name gokrazy-amd64
-m 3G
-smp $(nproc)
-usb
-nographic
-serial mon:stdio
-boot order=d
-drive file=${imagefile},format=raw
)
if [[ "$os" == "darwin" ]]; then
args+=(-nic vmnet-shared)
else
args+=(-netdev user,id=net0,hostfwd=tcp::8080-:80,hostfwd=tcp::2222-:22)
args+=(-device e1000,netdev=net0)
fi
qemu-system-x86_64 "${args[@]}"
;;
*)
echo -n "unsupported arch ${arch}"
exit
;;
esac