400 Commits

Author SHA1 Message Date
Michael Stapelberg
d0d0a0a6ae GitHub Actions: stick to go 1.22 until telemetry is fixed 2024-08-18 11:10:46 +02:00
Michael Stapelberg
9f81add3a9 kernelGlobs: include overlay_map.dtb
See “The overlay map file” in the Raspberry Pi Configuration docs:
https://www.raspberrypi.com/documentation/computers/configuration.html#part2.2.10

related to https://github.com/gokrazy/gokrazy/issues/273
2024-07-30 21:25:48 +02:00
oliverpool
05d1f9d1a0 Fix building when GOBIN is set in the GOENV file (#73)
compute basename manually when target is missing

fixes #71
2024-07-06 08:25:14 +02:00
Anup Chenthamarakshan
fe5fe168ac Support non-default FirstPartitionOffsetSectors (#70)
Support devices that require non-default space before the first partition
starts (4MiB). Required to enable booting Rock64 devices
2024-07-04 17:50:25 +02:00
oliverpool
e53ba4e609 Satisfy staticcheck (#74)
* remove deprecated ioutil usage

* use more suitable functions

* add missing error handling

* remove unused variables

* select{} instead of for{}
2024-07-04 17:35:15 +02:00
Michael Stapelberg
41f11fbe3a pull in latest gokrazy/internal for default kernel switch
related to https://github.com/gokrazy/gokrazy/issues/223
2024-06-23 11:10:41 +02:00
Michael Stapelberg
efa3f22802 packer: prevent accidental overwrites on boot partition
related to https://github.com/gokrazy/gokrazy/issues/264

Currently, both the gokrazy/firmware and the gokrazy/kernel.rpi repository
contain an overlays directory. The desired state is that only gokrazy/kernel.rpi
contains an overlays directory, as that is the repository from which the
overlays are built (whereas the are only copied into the firmware repository).

To prevent confusion between different versions, the packer now returns an error
instead of silently overwriting files on the boot partition when there are
multiple sources for a file.
2024-06-23 10:34:02 +02:00
Michael Stapelberg
3919dda31d packer: error out on invalid ExtraFilePaths
Before this change, the packer created an empty directory unconditionally,
which resulted in surprising errors in programs like breakglass.

closes https://github.com/gokrazy/breakglass/issues/19
2024-06-15 18:09:21 +02:00
Michael Stapelberg
0798935a7a packer: rename to addExtraFilesFromDir 2024-06-15 17:57:14 +02:00
Brad Fitzpatrick
ee071a0b95 internal/packer: use new UpdateOpts.NoPassword (#69)
Updates gokrazy/gokrazy#265
Updates tailscale/tailscale#1866

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-06-09 10:38:39 +02:00
Michael Stapelberg
34b02e215b include mount device config in /etc/gokrazy/mountdevices.json
related to https://github.com/gokrazy/gokrazy/issues/236
2024-05-10 19:03:41 +02:00
Michael Stapelberg
f7be03f9cb create mount device targets in /mnt
related to https://github.com/gokrazy/gokrazy/issues/236
2024-05-10 19:03:19 +02:00
Michael Stapelberg
06656d4340 bump language version to go 1.21 (oldest supported release) 2024-05-10 17:46:08 +02:00
Michael Stapelberg
04de7ab994 create /var as a symlink to /perm/var instead of empty directory
The /var directory is meant to hold data that changes (see hier(7)).

With the previous behavior, users had to bind-mount a writable
and persistent directory over /var, for example as documented in
https://gokrazy.org/packages/docker-containers/

With this commit, there is one fewer hurdle to get podman running.
2024-05-10 17:40:40 +02:00
Michael Stapelberg
80a59f1153 dirhash: use zip.CheckDir() to find valid files
The sumdb/dirhash package was built to work with extracted Go module zip files,
but we are working with directories on local disk (working copies).

So, to reflect what the Go tool would see as source code,
we now use the same code.

Specifically, the old approach failed with symbolic links to directories,
because it treated them as regular files (Go module zips do not contain
irregular files such as symlinks).
2023-12-22 09:00:07 +01:00
Michael Stapelberg
d7eafaef08 write BootloaderExtraLines to config.txt
related to https://github.com/gokrazy/gokrazy/issues/216
2023-12-15 15:19:30 +01:00
Mark Dietzer
60c9d51572 Copy .dtbo overlays from firmware repo as well (#67) 2023-12-15 08:59:47 +01:00
Michael Stapelberg
aa3507219c pull in latest gokrazy/internal for FAT writer fix 2023-12-15 08:58:53 +01:00
Michael Stapelberg
c2c21f612c warn about slow GOPROXY=direct setting 2023-11-05 16:24:03 +01:00
Michael Stapelberg
dceb56ee39 pull in gokrazy/internal for updateflag.BaseURL change 2023-10-31 19:32:10 +01:00
Damiano Donati
1c3069c7e6 fix sbom generation inconsistency, take 2 (#66) 2023-10-25 08:39:46 +02:00
Damiano Donati
84fe9d9358 fix: rerun go mod tidy (#65) 2023-10-22 13:11:07 +02:00
Mark Dietzer
c6f9ca1dab Add ability to have sub-path globs and include overlays (#63)
Add ability to have sub-path globs and include overlays/*.dtbo from kernel package
2023-10-20 10:48:15 +02:00
Damiano Donati
84c24f75e1 fix sbom generation inconsistency (#61)
prior to this commit SBOMs would have inconsistency in their hashing on
the configuration file.

The representation of the config file in fact would differ at certain
stages of the gok commands lifecycle, where at packer running time,
an extra InternalCompatibilityFlag, Sudo, would be added in memory
(while that not being the case at `gok sbom` time),
resulting in a differing config and as such differing SBOM hashes, same
goes for the differing pointer addresses that were skew the hashing
results.

This is now fixed by using the SudoOrDefault() accessor,
as well as converting the config into a string before computing the hash,
to avoid differing pointer problems.
2023-10-11 17:46:50 +02:00
Michael Stapelberg
231dea4b57 gok edit: run $EDITOR/$VISUAL through /bin/sh -c
This makes command line arguments in these environment variables work,
e.g. 'code -w', or 'emacs -q'

fixes https://github.com/gokrazy/gokrazy/issues/217
2023-09-21 19:13:28 +02:00
Michael Stapelberg
23cde3b0d8 fix build on non-linux: run go list with the required environment 2023-08-12 10:57:38 +02:00
Michael Stapelberg
c5e8689f03 build init in github.com/gokrazy/gokrazy
fixes https://github.com/gokrazy/gokrazy/issues/210

fixes https://github.com/gokrazy/gokrazy/pull/178
2023-07-28 08:45:52 +02:00
Michael Stapelberg
25116b2f79 GitHub Actions: switch to setup-go@v4, which enables caching 2023-07-23 17:37:27 +02:00
Michael Stapelberg
fa33ef8830 packer: set 022 umask to ensure the o+x bit is present
fixes https://github.com/gokrazy/gokrazy/issues/205
2023-07-13 18:06:18 +02:00
Michael Stapelberg
56839a456a packer: fix incorrect parent association in mkdirp()
A bug was triggered when the file system contained two directories with the same
basename, because all directories were incorrectly associated with the root
directory.

fixes https://github.com/gokrazy/tools/issues/58
2023-06-29 22:20:40 +02:00
Michael Stapelberg
522f5b0a23 packer: implement mkdirp() for tar directories
See the source comment for more details.

fixes https://github.com/gokrazy/tools/issues/58
2023-06-24 20:30:46 +02:00
Michael Stapelberg
d4eaa23f35 bump x/mod to work with go1.21rc1 2023-06-24 19:26:03 +02:00
Michael Stapelberg
cd4073ee85 improve error message when multiple packages install the same binary
This can happen when adding a program called "hello",
when the default config already pulls in github.com/gokrazy/hello.

The previous error message was confusing and non-deterministic,
because it contained the name of whichever package happens to be
validated first.
2023-06-01 22:58:05 +02:00
oliverpool
b44363c41f gok: improve the error message for wrong target arch (#56) 2023-05-26 10:36:33 +02:00
Nhân
78e00a0be6 gok: ignore error when updating over tailscale (#55)
This is not a real fix. I still haven't figured out why a `connection
reset by peer` happens in the first place. `target.Reboot()` will still
block for a bit before giving up. At least it doesn't falsely report a
fail now.

Also moved canc() up so the terminal isn't littered with `[update boot
file system] 0.00% of 16 MiB, uploading at 0 B/s` during the wait.

Related: https://github.com/gokrazy/gokrazy/issues/199
2023-05-19 08:43:20 +02:00
Michael Stapelberg
03c240ea00 extrafiles: verify none are configured for /perm
related to https://github.com/gokrazy/gokrazy/issues/197
2023-04-30 09:39:39 +02:00
Brad Fitzpatrick
fa27ee75eb validate target userspace architecture matches kernel's architecture (#54)
For gokrazy/gokrazy#191.

Perhaps we'll make it automatic in the future, though. This is a
guardrail meanwhile.
2023-04-06 20:00:02 +02:00
oliverpool
ea81144d87 gok: fix adding module with uppercase letters (#53) 2023-04-06 12:18:53 +02:00
oliverpool
763d4e4697 fix: prevent race condition in PackageDirs (#52) 2023-03-21 08:53:09 +01:00
Michael Stapelberg
69473ec010 pull in latest gokrazy/internal
fixes https://github.com/gokrazy/tools/issues/50
2023-03-13 08:50:33 +01:00
Michael Stapelberg
7b9dd260c5 sbom: chdir to build directory to make relative replace paths work
fixes https://github.com/gokrazy/tools/issues/49
2023-03-11 11:14:30 +01:00
Michael Stapelberg
2b2e2d9f24 gok: fix serial console default 2023-02-28 22:11:43 +01:00
Michael Stapelberg
c3d23a7a91 go get -u 2023-02-25 16:28:25 +01:00
dependabot[bot]
d5d8832eb9 Bump golang.org/x/sys from 0.0.0-20210820121016-41cdb8703e55 to 0.1.0 (#48)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.0.0-20210820121016-41cdb8703e55 to 0.1.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-25 16:27:12 +01:00
Michael Stapelberg
fe8d59ca7d add gok push
related to https://github.com/gokrazy/gokrazy/issues/167
2023-02-19 15:03:41 +01:00
Michael Stapelberg
626d0c7d06 sbom: include replace directives
We do this by using the dirhash package, but filtering out any hidden
files (starting with .) and using hash/fnv because we are not interested in
cryptographically secure hashes of local directory contents, just whether the
contents changed.

fixes https://github.com/gokrazy/gokrazy/issues/171
2023-02-16 22:48:10 +01:00
Michael Stapelberg
abef3a8e0b skip Raspberry Pi 4 EEPROM updates when the version is unchanged
This shaves about 10s off of the `gok update` time.
2023-02-15 18:29:25 +01:00
Michael Stapelberg
2b758083ad gok add: resolve Go module, use go.mod from upstream
fixes https://github.com/gokrazy/gokrazy/issues/172
2023-02-14 22:21:52 +01:00
Michael Stapelberg
9dac24b62d pull in latest gokrazy/internal for instance flag default from $PWD 2023-02-11 18:15:45 +01:00
Michael Stapelberg
b4784d268c pull in latest gokrazy/updater for Divert() fallback fix 2023-02-06 23:05:40 +01:00