400 Commits

Author SHA1 Message Date
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
Michael Stapelberg
28d96f8788 gok new: add GOOS and GOARCH by default
related to https://github.com/gokrazy/gokrazy/issues/191
2025-01-26 22:49:25 +01:00
Michael Stapelberg
5f4d95c2d4 gok: apply Environment from config.json
For gok vm run, this means an explicit -arch=amd64 or -arch=arm64
might become necessary. In general, I recommend configuring
GOOS and GOARCH in config.json explicitly:

    {
        "Hostname": "repro",
        "Environment": [
            "GOOS=linux",
            "GOARCH=amd64"
        ],
    […]

related to https://github.com/gokrazy/gokrazy/issues/191
2025-01-26 22:43:19 +01:00
Michael Stapelberg
70c48e594c sbom: use absolute instancePath, not (relative) config.InstancePath
fixes https://github.com/gokrazy/gokrazy/issues/292
2025-01-25 21:02:04 +01:00
Michael Stapelberg
f1a87939e4 GitHub Actions: create dummy SSH key for breakglass.authorized_keys 2025-01-22 21:54:04 +01:00
Michael Stapelberg
5762235ac5 make ExtraFilePaths absolute earlier to fix sbom in relative parents
fixes https://github.com/gokrazy/gokrazy/issues/289
2025-01-22 21:49:32 +01:00
Michael Stapelberg
ea613267ff gok new: use relative path for breakglass.authorized_keys
related to https://github.com/gokrazy/gokrazy/issues/289
2025-01-22 21:41:48 +01:00
Bill Doyle
8edbabf668 Preserve GOKRAZY_PARENT_DIR when executing sudo (#76)
This should fix `gok overwrite` not fully utilizing this environment
variable as mentioned in a comment on gokrazy/gokrazy#222.
2025-01-20 08:18:36 +01:00
Michael Stapelberg
ca8464f58d overwrite: add --trace_file flag for performance analysis
related to https://github.com/gokrazy/gokrazy/issues/287
2025-01-13 21:56:14 +01:00
Michael Stapelberg
37e2f95c5c create an empty /bin mount point
This is useful for mounting a tmpfs and installing busybox
(e.g. the version that comes with the serial-busybox package):

    mount -t tmpfs tmpfs /bin
    ln -s /tmp/serial-busybox/ash busybox
    ./busybox --install -s /bin

Afterwards, TRAMP (transparent remote access) in Emacs works:

    emacs /ssh:scan2drive:/perm/keep/index.md
2024-12-29 16:36:13 +01:00
Michael Stapelberg
6bec690fe5 add embedded version of edk2 firmware files
Whether edk2 is available on operating systems varies,
so the best choice is to embed the amd64/arm64 EFI files.

We need these files to boot amd64 images in EFI mode,
and also for arm64 images to boot at all.
2024-09-27 08:21:46 +02:00
Michael Stapelberg
b8ffcd451e gok: add vm run subcommand
This is inspired by https://github.com/damdo/gokrazy-machine :)
2024-09-26 22:12:36 +02:00
Michael Stapelberg
0c67e08b0a packer: partially restore buildPackagesFromFlags()
Commit a59c9ad5f4 was not entirely correct:
It is desired to call getGokrazySystemPackages(), but we should also
keep looking at cfg.Packages (which the commit didn’t).
2024-09-11 18:27:24 +02:00
Michael Stapelberg
feda2a35da sbom: move too-late os.Chdir call earlier
This fixes errors such as:

2024/09/11 08:41:50 Error: build directory
"/home/michael/gokrazy/router7/builddir/github.com/stapelberg/prober7/cmd/probe"
does not exist in
"/home/michael/gokrazy/router7/builddir/github.com/gokrazy/serial-busybox"
2024-09-11 08:47:35 +02:00
Michael Stapelberg
a59c9ad5f4 FindExtraFiles: unify packages to consider with sbom logic
This fixes 'gok -i hello sbom' when the hello instance
directory (~/gokrazy/hello) has an empty build directory.

related to #51
2024-09-09 17:20:29 +02:00
Michael Stapelberg
a2dd9b9a09 sbom: move os.Chdir into 'gok sbom' (but not gokr-packer)
fixes #51
2024-09-09 17:20:07 +02:00
Michael Stapelberg
d9a4bf387a update gokrazy/internal: fix bootloader 15/16 MB kernel size limit
related to https://github.com/gokrazy/gokrazy/issues/248
2024-08-27 21:09:36 +02:00
Michael Stapelberg
fbd9e5d9cc GitHub Actions: delete unused LSIF workflow 2024-08-27 20:45:50 +02:00
Michael Stapelberg
809775d2b7 go.mod: bump language version to go 1.22 (oldest supported release) 2024-08-27 20:45:30 +02:00
Michael Stapelberg
f7db22daab gotool: add missing -tags=gokrazy for list
I noticed this while working on the integration test.
2024-08-18 21:39:22 +02:00
George Hopkins
de5f76c883 Support i386/x86 platforms (#75) 2024-08-18 16:15:51 +02:00