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

@ -19,8 +19,10 @@ DOCKER_TAG := testing
PLATFORM := linux/amd64,linux/arm64,linux/arm/v6
# gokrazy image
IMAGE_FILE := evcc_$(TAG_NAME).image
IMAGE_OPTIONS := -hostname evcc -http_port 8080 github.com/gokrazy/serial-busybox github.com/gokrazy/breakglass github.com/gokrazy/mkfs github.com/gokrazy/wifi github.com/evcc-io/evcc
GOK_DIR := packaging/gokrazy
GOK_NETDEV := user,id=net0,hostfwd=tcp::8080-:80,hostfwd=tcp::8022-:22,hostfwd=tcp::8888-:8080
GOK := gok -i evcc --parent_dir $(GOK_DIR)
IMAGE_FILE := evcc_$(TAG_NAME).img
# deb
PACKAGES = ./release
@ -104,25 +106,32 @@ apt-release::
cloudsmith push deb evcc/stable/any-distro/any-version $(file); \
)
# gokrazy image
gokrazy::
go install github.com/gokrazy/tools/cmd/gokr-packer@main
mkdir -p flags/github.com/gokrazy/breakglass
echo "-forward=private-network" > flags/github.com/gokrazy/breakglass/flags.txt
mkdir -p env/github.com/evcc-io/evcc
echo "EVCC_NETWORK_PORT=80" > env/github.com/evcc-io/evcc/env.txt
echo "EVCC_DATABASE_DSN=/perm/evcc.db" >> env/github.com/evcc-io/evcc/env.txt
mkdir -p buildflags/github.com/evcc-io/evcc
echo "$(BUILD_TAGS),gokrazy" > buildflags/github.com/evcc-io/evcc/buildflags.txt
echo "-ldflags=$(LD_FLAGS)" >> buildflags/github.com/evcc-io/evcc/buildflags.txt
gokr-packer -hostname evcc -http_port 8080 -overwrite=$(IMAGE_FILE) -target_storage_bytes=1258299392 $(IMAGE_OPTIONS)
# gokrazy
gok::
which gok || go install github.com/gokrazy/tools/cmd/gok@main
# https://stackoverflow.com/questions/1250079/how-to-escape-single-quotes-within-single-quoted-strings
sed 's!"GoBuildFlags": null!"GoBuildFlags": ["$(BUILD_TAGS) -trimpath -ldflags='"'"'$(LD_FLAGS)'"'"'"]!g' $(GOK_DIR)/config.tmpl.json > $(GOK_DIR)/evcc/config.json
${GOK} add .
# ${GOK} add tailscale.com/cmd/tailscaled
# ${GOK} add tailscale.com/cmd/tailscale
# build image
gok-image:: gok
${GOK} overwrite --full=$(IMAGE_FILE) --target_storage_bytes=1258299392
# gzip -f $(IMAGE_FILE)
gokrazy-run::
MACHINE=arm64 IMAGE_FILE=$(IMAGE_FILE) ./packaging/gokrazy/run.sh
# run qemu
gok-run:: gok
${GOK} vm run --netdev $(GOK_NETDEV)
gokrazy-update::
gokr-packer -update yes $(IMAGE_OPTIONS)
# run qemu on mac
gok-mac:: gok
mv $(GOK_DIR)/evcc/config.json $(GOK_DIR)/evcc/linux.json
sed 's!"SerialConsole": "ttyAMA0,115200"!"KernelPackage": "github.com/gokrazy/kernel.arm64",'\\n' "SerialConsole": "ttyAMA0,115200"!g' $(GOK_DIR)/evcc/linux.json > $(GOK_DIR)/evcc/config.json
${GOK} vm run --netdev $(GOK_NETDEV)
gok-update::
${GOK} update yes $(IMAGE_OPTIONS)
soc::
@echo Version: $(VERSION) $(SHA) $(BUILD_DATE)