420 Commits
Author SHA1 Message Date
Michael Stapelberg 2c805ed001 refactor cobra command initialization to avoid stale state
Before this commit, we held onto *cobra.Command objects,
but that is not actually supported: after the first Execute(),
commands like updateCmd are stuck on the first-ever provided ctx.

Instead, turn command initialization into functions.

I only noticed this when trying to do two 'gok update'
from within the same test, where the fake build timestamp
is injected via the context (the timestamp was always the same).
2025-11-29 10:47:48 +01:00
Michael Stapelberg d588a72286 integration: start QEMU VM for 'gok update' test
related to https://github.com/gokrazy/tools/pull/94
2025-11-29 09:56:11 +01:00
Michael Stapelberg 50ceea79c7 internal/packer: apply BootloaderExtraEEPROM
related to https://github.com/gokrazy/gokrazy/issues/338
2025-11-16 19:09:52 +01:00
Michael Stapelberg d57f04bf53 add internal/eeprom package (with test against other impls)
related to https://github.com/gokrazy/gokrazy/issues/338
2025-11-16 15:08:21 +01:00
Michael Stapelberg 4950fd73f6 add a flake.nix providing the two other rpi eeprom tools
see also: https://michael.stapelberg.ch/posts/2025-07-27-dev-shells-with-nix-4-quick-examples/

related to https://github.com/gokrazy/gokrazy/issues/338
2025-11-16 15:08:12 +01:00
Michael Stapelberg 57f559232c packer: eeprom: only write vl805-*.bin if present (Pi 4)
The rpi5-eeprom package no longer contains vl805, which is Pi 4-specific.

related to https://github.com/gokrazy/gokrazy/issues/332
2025-11-16 09:57:09 +01:00
Michael Stapelberg 2f0aac76a0 packer: include timestamp (ts: unixtime) in firmware .sig files
Otherwise the Pi 5 firmware will default to a timestamp of 0
and skip the update always.

related to https://github.com/gokrazy/gokrazy/issues/332
2025-11-16 09:08:03 +01:00
Michael Stapelberg 9a9519186b integration: add 'gok update' test
gokrazy CI / CI (macos-latest) (push) Has been cancelled
gokrazy CI / CI (ubuntu-latest) (push) Has been cancelled
gokrazy CI / CI (windows-latest) (push) Has been cancelled
2025-10-03 19:12:17 +02:00
Michael Stapelberg 5675dbb2eb packer: set Accept header (request), not Content-Type (response) 2025-10-03 19:11:55 +02:00
Michael Stapelberg ab29b81133 tests: use t.Chdir now that we are on Go 1.24 2025-10-03 18:32:43 +02:00
Michael Stapelberg 19d09ffb32 switch from breml/rootcerts to x/crypto fallback bundle
related to https://github.com/golang/go/issues/69898
2025-09-12 09:34:42 +02:00
dependabot[bot] 8143336564 build(deps): bump golang.org/x/oauth2 from 0.23.0 to 0.27.0 (#93)
---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-version: 0.27.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-19 10:26:58 +02:00
Michael Stapelberg 2979dc9b26 pull in latest gokrazy/updater 2025-07-05 15:59:45 +02:00
Michael Stapelberg ab76ef531d update to latest gokrazy/updater (now needs a context) 2025-06-01 08:57:36 +02:00
Michael Stapelberg 2e390edb12 gok vm run: print a tip for how to enable the serial console
This should make it a little easier for users.
2025-05-30 19:00:00 +02:00
Michael Stapelberg d145a5b689 go.mod: update to latest versions of dependencies 2025-05-30 16:58:56 +02:00
Michael Stapelberg a0558bc6a0 GitHub Actions: verify gok builds on Windows and macOS, too
related to https://github.com/gokrazy/tools/issues/89
2025-05-29 17:03:18 +02:00
Michael Stapelberg 6ae0267df2 gok add: use renameio/maybe on GOOS=windows
related to https://github.com/gokrazy/tools/issues/89
2025-05-29 16:23:38 +02:00
Michael Stapelberg 5b15ffbd42 packer: move unix-specific code into build tag guarded files
related to https://github.com/gokrazy/tools/issues/89
2025-05-29 16:17:58 +02:00
Michael Stapelberg f606b3de4f gok sbom: buffer build output and only print (to stderr!) on error
fixes https://github.com/gokrazy/tools/issues/91
2025-05-29 15:26:31 +02:00
Michael Stapelberg 105d190cbc internal/packer: introduce Pack.Env (with a logger) and log to it
related to https://github.com/gokrazy/tools/issues/91
2025-05-29 15:26:31 +02:00
Michael Stapelberg 8ff2f69410 measure: suppress output when stdout is not a terminal
related to https://github.com/gokrazy/tools/issues/91
2025-05-29 15:19:04 +02:00
Michael Stapelberg fc2e1562e8 packer: include KernelExtraArgs in the kernel cmdline
related to https://github.com/gokrazy/gokrazy/issues/312
2025-05-20 23:01:12 +02:00
Michael Stapelberg 97ed031a8e packer: refactor write phase out of logic() 2025-04-17 22:59:29 +02:00
Michael Stapelberg e1ed8d681f packer: refactor build phase out of logic() 2025-04-17 22:57:40 +02:00
Michael Stapelberg 4868f92932 packer: refactor preparation phase out of logic() 2025-04-17 22:48:39 +02:00
Michael Stapelberg ff72417a88 packer: add missing error assignment 2025-04-17 22:36:41 +02:00
Michael Stapelberg 9a554ea21e check whether partitions are mounted early on, improve error message
related to https://github.com/gokrazy/gokrazy/discussions/308
2025-04-17 22:30:32 +02:00
Michael Stapelberg 640a6ea131 clearly label errors as such
related to https://github.com/gokrazy/gokrazy/discussions/308
2025-04-17 22:30:19 +02:00
Michael Stapelberg bdb09ed67a gok vm run: pass extra arguments to QEMU as-is
fixes https://github.com/gokrazy/tools/issues/87
2025-04-17 17:03:41 +02:00
Michael Stapelberg 4f97436034 implement Package.GoBuildEnvironment option
This allows setting e.g. CGO_ENABLED=1 for only specific programs.
2025-03-30 11:14:56 +02:00
Olivier Mengué #openToWork-Paris b8127bc462 overwrite: show setfacl suggestion only on Linux (#90)
When acquiring access to partition the device, show message about use of
"setfacl" only on Linux. Not on Darwin where it is irrelevant.
2025-03-21 21:36:30 +01:00
thielepaul b0f9892141 allow overriding basename in package config (#86)
related to https://github.com/gokrazy/gokrazy/issues/303
2025-02-27 20:28:19 +01:00
Michael Stapelberg f608e1a4d0 pull in latest gokrazy/internal
related to https://github.com/gokrazy/gokrazy/issues/303
2025-02-24 07:16:10 +01:00
Olivier Mengué 356b1f85aa packer: upgrade fallback Root CA certificates (#85)
Upgrade the fallback CA certs used when running gok on non-Linux platform.
This is the Mozilla CA Certs list bundled as a Go module that must be kept up to date.
(Also gok should be rebuilt).
2025-02-23 09:32:54 +01:00
Michael Stapelberg a5127466af add gok ps — the output is still quite minimal
This command might become useful on its own in the future,
but for now mostly demonstrates how to use the gokapi package.
2025-02-22 09:05:31 +01:00
Michael Stapelberg ed3a455463 gok vm run: allocate 512 MB of /perm disk 2025-02-21 21:29:52 +01:00
Michael Stapelberg c3e6903b57 fix gokrun_test on macOS 2025-02-21 21:29:05 +01:00
Olivier Mengué 772c0a9421 packer: move call to unix.Sync behind Linux conditional compile (#84)
In RereadPartitions, move call to unix.Sync() in Linux specific code
as unix.Sync() is not portable (not available on Windows).
2025-02-21 20:39:03 +01:00
Michael Stapelberg 803c1f293b GitHub Actions: bump Go version and action versions 2025-02-21 20:24:20 +01:00
Michael Stapelberg 9e9952330e delete now-obsolete gokrpacker_test, too
related to https://github.com/gokrazy/gokrazy/issues/301
2025-02-21 20:18:56 +01:00
Michael Stapelberg ceba4a4391 delete cmd/gokr-packer and cmd/gokr-updater
Users who need to use gokr-packer to migrate an existing setup to the
instance-centric config can use the following command to install the
last version before it was deleted:

go install github.com/gokrazy/tools/cmd/gokr-packer@703a8605028963d13a9d00815ccedfae13f0ce6d

fixes https://github.com/gokrazy/gokrazy/issues/301
2025-02-21 20:10:23 +01:00
Michael Stapelberg 703a860502 sbom: do not hash source files, record buildid of binaries instead
Before this commit, the mere presence of files with certain names in local
package directories would make the build fail (see nonmodulefiles_test.go).

With this commit, we now record the buildinfo and buildid of all built Go
programs of this gokrazy instance.

related to https://github.com/gokrazy/gokrazy/issues/297

fixes https://github.com/gokrazy/gokrazy/issues/299
2025-02-21 18:51:16 +01:00
Michael Stapelberg 1b3cfe35b3 packer: do not compute SBOM twice when writing a GAF file
related to https://github.com/gokrazy/gokrazy/issues/299
2025-02-21 17:53:55 +01:00
Michael Stapelberg 4726b7d4b2 sbom: fix ExtraFileHashes paths (accidentally pointed to go.mod)
related to https://github.com/gokrazy/gokrazy/issues/299
2025-02-21 17:52:03 +01:00
Michael Stapelberg 8bcde52fb8 go.mod: set language version to go 1.24 2025-02-14 21:32:01 +01:00
Michael Stapelberg ef5cd4d241 pull in latest gokrazy/internal 2025-02-14 21:31:08 +01:00
Michael Stapelberg 30b9fe0c81 pull in latest golang.org/x/mod for tools directive
fixes https://github.com/gokrazy/gokrazy/issues/298
2025-02-12 17:19:15 +01:00
andig 6316042495 gok vm: add -netdev command-line flag (#79) 2025-01-28 21:01:51 +01:00
Damiano Donati 9a2d41569f use newest arm64 UEFI and amd64 OVMF CODE/VARS firmware (#81)
it updates the arm64 UEFI firmware to a version newer than 2023.11,
as running on qemu >= 9.0 can trigger a bug in the older versions of the EDK2 guest firmware,
causing Synchronous Exception and potential bootloops.

While doing so it updates the amd64 OVMF firmware, which now has removed
support for the 2M firmware and only supports the 4M one.
The 4M OVMF firmware comes with split CODE and VARS images, which need
to be loaded as pflash drives in the qemu vm, rather than via the -bios
flag.

For more details on the migration see: https://salsa.debian.org/qemu-team/edk2/-/blob/debian/latest/debian/howto-2M-to-4M-migration.md

Fixes https://github.com/gokrazy/tools/issues/80
2025-01-28 19:00:02 +01:00