Commit Graph
100 Commits
Author SHA1 Message Date
Michael Stapelberg c74b4e7749 httpclient: use os.ReadFile instead of deprecated ioutil.ReadFile 2025-12-09 17:36:00 +01:00
Michael Stapelberg fc385a9e3d httpclient: remove now-unused GetRemoteScheme 2025-12-09 17:35:39 +01:00
Michael Stapelberg 3c1aa9087c tlsflag,httpclient: remove global state 2025-12-08 21:31:10 +01:00
Michael Stapelberg 2e8be894f6 updateflag: remove global state
related to https://github.com/gokrazy/tools/pull/68
2025-12-06 08:41:40 +01:00
Michael Stapelberg cbfb18ae26 httpclient: use updateflag.Value instead of global access 2025-12-05 17:50:16 +01:00
Michael Stapelberg 95a29c8f05 updateflag: introduce Value type to avoid global state
related to https://github.com/gokrazy/tools/pull/68
2025-12-05 17:43:05 +01:00
Michael Stapelberg 839bc69fbd remove tlsflag and updateflag Register functions
These flags are no longer used.

related to https://github.com/gokrazy/tools/pull/68
2025-12-05 17:37:09 +01:00
Michael Stapelberg 05cd6a8b1b config: add BootloaderExtraEEPROM
related to https://github.com/gokrazy/gokrazy/issues/338
2025-11-16 19:07:01 +01:00
Michael Stapelberg c2e4e2b4f6 config: add KernelExtraArgs (will end up in cmdline.txt)
related to https://github.com/gokrazy/gokrazy/issues/312
2025-05-20 22:59:45 +02:00
Michael Stapelberg 05ac5603c1 go mod tidy (the x/crypto dependency came from an untracked file) 2025-04-15 08:48:45 +02:00
Michael Stapelberg b6303a2c6b go.mod: bump language version to 1.24 2025-04-15 08:47:51 +02:00
Michael Stapelberg c7693c3bef GitHub Actions: bump action versions 2025-03-30 11:15:54 +02:00
Michael Stapelberg d5a706e350 config: add PackageConfig.GoBuildEnvironment 2025-03-30 11:13:25 +02:00
Michael Stapelberg 41d5d8fffb config: group PackageConfig struct fields into build time / run time 2025-03-30 11:03:52 +02:00
Michael Stapelberg b1610a6e72 go mod tidy 2025-02-14 21:30:01 +01:00
Michael Stapelberg 423a5b587b config: add Environment, rename ReadFromFile to ApplyInstanceFlag
It now does more and is more descriptively named,
freeing the ReadFromFile name for a side-effect free entrypoint.

related to https://github.com/gokrazy/gokrazy/issues/191
2025-01-26 22:39:49 +01:00
Michael Stapelberg 6ab9fef830 bootloader: fix 15/16 MB kernel size limit
The adc instruction fix was contributed by abbeyj on lobsters (thank you!).

fixes https://github.com/gokrazy/gokrazy/issues/248
2024-08-27 21:00:26 +02:00
Michael Stapelberg 95c24add2d config: switch to gokrazy/kernel.rpi as default kernel
This kernel has the broadest device compatibility (incl. Pi 5).

related to https://github.com/gokrazy/gokrazy/issues/223
2024-06-23 11:08:36 +02:00
Michael Stapelberg 71d9c6c36b fat: add Exists method for detecting accidental overwrites 2024-06-23 10:32:20 +02:00
Michael Stapelberg 68dd68393b gpt: fix test 2024-05-10 18:55:00 +02:00
Michael Stapelberg eb715ca0bb gpt: return all partition UUIDs
related to https://github.com/gokrazy/gokrazy/issues/236
2024-05-10 18:52:02 +02:00
Michael Stapelberg a48c0b92e8 config: define MountDevices
related to https://github.com/gokrazy/gokrazy/issues/236
2024-05-10 18:27:12 +02:00
Michael Stapelberg cfc6cfe7d0 bump language version to go 1.21 (oldest supported release) 2024-05-10 17:49:18 +02:00
Michael Stapelberg d29c615f07 build bootloader with make; generate ELF with debug symbols
This doesn’t change the bootloader bytes themselves (bootloader.img),
but helps with debugging in GDB+QEMU.
2024-02-03 19:25:42 +01:00
Michael Stapelberg 76ca7a09ea switch from generating go source to go:embed 2024-02-03 19:22:38 +01:00
Michael Stapelberg cd6fdff7bb mbr: write bootloader to bootloader.img as well 2024-02-03 19:20:49 +01:00
Michael Stapelberg b4318213fb config: add BootloaderExtraLines
This is an array of strings because JSON does not support multi-line strings
natively, and working with a single long line with multiple \n is error-prone.

related to https://github.com/gokrazy/gokrazy/issues/216
2023-12-15 15:17:37 +01:00
Michael Stapelberg cb94242910 writer: fix writing directories with many entries
This fixes writing out (for example) device tree overlay directory.

We now write the directory entries twice:
Once for figuring out the correct firstCluster values,
then again for writing out the correct firstCluster values.

related to https://github.com/gokrazy/gokrazy/issues/216
related to https://github.com/gokrazy/tools/pull/67
2023-12-15 08:53:26 +01:00
Michael Stapelberg a645001f8b BaseURL: select port based on schema, plumb through custom httpsPort
Thanks to Christian Schlögl for the report.
2023-10-31 19:29:44 +01:00
Michael Stapelberg 235d00ca48 GitHub Actions: use setup-go@v4, which enables caching 2023-10-13 08:53:56 +02:00
Michael Stapelberg a51d461685 fat: fix padding (for FAT16): need to use usable FAT entries 2023-10-13 08:52:06 +02:00
Michael Stapelberg 5aab2d692f fat: fix data sector calculation
The FAT contains two unusable entries at the beginning that do not represent
data, so those shouldn’t be counted when determining the number of data sectors.
2023-10-13 08:52:06 +02:00
Michael Stapelberg 4e41a6d1cc add minimal fuzz test 2023-10-13 08:52:06 +02:00
Michael Stapelberg 5f469e7488 instanceflag: make ParentDir() absolute
related to https://github.com/gokrazy/tools/issues/50
2023-03-13 08:49:23 +01:00
Michael Stapelberg 5c1bb011aa add SerialConsoleOrDefault() accessor 2023-02-28 22:10:39 +01:00
Michael Stapelberg 9608422911 initialize instance flag to $PWD if inside an instance dir
(for convenience)
2023-02-11 18:14:10 +01:00
Michael Stapelberg 05b4335416 config.ReadFromFile: include path in JSON error message
fixes https://github.com/gokrazy/tools/issues/47
2023-02-06 08:43:49 +01:00
Michael Stapelberg 7f0148dbcd include gokrazy/cmd/heartbeat as gokrazy system package
heartbeat is a no-op if not configured.

related to https://github.com/gokrazy/gokrazy/issues/167
2023-02-05 16:03:18 +01:00
Michael Stapelberg fd31300b8b gpt: implement reading partition entries 2023-01-25 22:12:14 +01:00
Michael Stapelberg a6cc5568b3 httpclient.For: fall back to cfg.Hostname 2023-01-22 18:31:18 +01:00
Michael Stapelberg 8b3fd7aed8 config: ensure Update and InternalCompatibilityFlags are not nil
related to https://github.com/gokrazy/tools/issues/43
2023-01-17 19:04:42 +01:00
Michael Stapelberg e09e239138 WithFallbackToHostSpecific: work when called on nil UpdateStruct 2023-01-15 16:41:05 +01:00
Michael Stapelberg c51f6b8f94 httpclient: remove now-unused GetHTTPClientForInstance 2023-01-15 16:38:56 +01:00
Michael Stapelberg 79b761a8d0 httpclient: add For() function working with a *config.Struct 2023-01-15 16:37:09 +01:00
Michael Stapelberg ce9754d612 tlsflag: remove httpclient wrapper
This makes it possible to import package tlsflag from httpclient in a follow-up
commit.
2023-01-15 16:27:14 +01:00
Michael Stapelberg 063b533a8f instanceflag: initialize even when not registered on pflags
This fixes using instanceflag from breakglass (which is not on pflags).
2023-01-15 13:35:31 +01:00
Michael Stapelberg d172888a87 instanceflag: make overrideable 2023-01-15 13:35:25 +01:00
Michael Stapelberg cd72f827ba updateflag: refactor to reduce duplication 2023-01-15 13:35:14 +01:00
Michael Stapelberg f5c7fc51ab clarify comment regarding InternalCompatibilityFlags purpose 2023-01-14 08:52:06 +01:00
Michael Stapelberg 8ce5e37830 remove CertPEM and KeyPEM fallback from WithFallbackToHostSpecific
This resulted in TLS being on despite "UseTLS": "off".
2023-01-07 18:17:58 +01:00
Michael Stapelberg 67ef7c05d4 config: fix copy & paste error: cert.pem → key.pem 2023-01-07 17:50:20 +01:00
Michael Stapelberg f7440a1551 implement support for instance configuration
related to https://github.com/gokrazy/gokrazy/issues/147
2023-01-07 15:39:36 +01:00
Michael Stapelberg 6c14a9bfe6 add instanceflag package
related to https://github.com/gokrazy/gokrazy/issues/147
2023-01-07 15:39:30 +01:00
Michael Stapelberg 7b8403f423 add getters/setters for updateflag and tlsflag 2022-10-02 23:10:28 +02:00
Michael Stapelberg d964fb95b0 document result of zstd experiment: not worth the trouble here 2022-09-18 22:19:49 +02:00
Michael Stapelberg 5675ab8eae go.mod: update to language version go 1.18, tidy 2022-08-07 10:40:07 +02:00
Michael Stapelberg ead56cf00a GitHub Actions: bump to Go 1.19 2022-08-07 10:12:19 +02:00
Michael Stapelberg 3a50f98bee treat -tls="" as enabled if certs exist, add -tls=off
This allows using breakglass without explicitly setting -tls=self-signed.

fixes https://github.com/gokrazy/gokrazy/issues/131
2022-07-09 19:25:10 +02:00
Michael Stapelberg 1821f343e4 allow specifying the name of the -update flag
related to https://github.com/gokrazy/breakglass/issues/13
2022-04-30 21:25:44 +02:00
Michael Stapelberg b97ccfa731 refactor gokr-packer’s -tls flag into internal
related to https://github.com/gokrazy/breakglass/issues/13
2022-04-30 21:20:58 +02:00
Michael Stapelberg 12864f6aa2 go mod tidy 2022-04-30 21:20:40 +02:00
Michael Stapelberg 707cfb1f7d remove unnecessary use of pointers 2022-04-30 21:20:34 +02:00
Michael Stapelberg 5d31fd3805 GitHub Actions: bump to Go 1.18 2022-03-20 16:02:38 +01:00
Michael Stapelberg 81842290f3 go.mod: set go version to 1.17 2021-11-21 16:43:48 +01:00
Michael Stapelberg df151cdf75 update go.mod 2021-11-21 16:43:26 +01:00
Michael Stapelberg 4587bc3af7 gofmt 2021-11-21 16:42:19 +01:00
Michael Stapelberg 2e7d058148 GitHub Actions: switch to Go 1.17 2021-11-21 16:41:29 +01:00
Michael Stapelberg c5a0bcc07c add progress package to internal 2021-11-21 16:40:27 +01:00
Michael Stapelberg f699bca2f3 add humanize package to internal 2021-11-21 16:40:22 +01:00
Michael Stapelberg 92d32e572d refactor -update flag into internal package (for upcoming reuse) 2021-11-21 15:57:32 +01:00
Michael Stapelberg 1b3b5687a0 (fat.Reader).Extents: implement support for subdirectories 2021-06-21 18:25:16 +02:00
Michael Stapelberg 8f28a81e30 rootdev: remove left-over debug log message 2021-06-20 22:40:40 +02:00
Michael Stapelberg 3382b18a32 rootdev: implement support for GPT partitions
related to https://github.com/gokrazy/gokrazy/issues/87
2021-06-20 22:22:48 +02:00
Michael Stapelberg 4716d3fefe fat: fix: calculate offset instead of keeping track
Keeping track of the offset depends on the order in which entries are written,
i.e. breaks as soon as you have multiple nested directories.
Calculating the offset is shorter and more robust.

related to https://github.com/gokrazy/internal/issues/6
2021-06-20 14:43:41 +02:00
Michael Stapelberg 1f95c50d27 fat: skip long file name (LFN) entries for . and .. 2021-06-19 20:29:54 +02:00
Michael Stapelberg f2bd9b32d8 fat: fix writing directories and subdirectories
When writing directory entries, we now allocate the FAT entries
before writing, so that we can synthesize the . and .. entries
which need FirstCluster and parent.FirstCluster to be set.

This code currently assumes each directory consumes only 1 cluster
(space for 64 directory entries, I think).
2021-06-19 20:29:54 +02:00
Michael Stapelberg 3567162db3 fat: pad the file system for now-stricter dosfsck 2021-06-19 20:29:54 +02:00
Michael Stapelberg 4a4698a463 fat: fix empty file handling (do not consume FAT entries) 2021-06-19 20:29:54 +02:00
Michael Stapelberg 613eeb147f fat: set fw.pending = nil to avoid accidental double Close() 2021-06-19 20:29:54 +02:00
Michael Stapelberg de61a87169 fat: use attrDirectory instead of 0x10 throughout 2021-06-19 20:29:54 +02:00
Michael Stapelberg cf2fc1492b fat: write volume id root directory entry
This is required to make fsck.vfat happy.
2021-06-19 20:29:54 +02:00
Michael Stapelberg 6c741aa40a rootdev: correctly construct NVMe paths 2021-06-04 09:19:09 +02:00
Michael Stapelberg 549f1e76c5 remove updater in favor of new github.com/gokrazy/updater package 2021-01-06 22:21:30 +01:00
Michael Stapelberg e2046189e5 switch from travis to GitHub actions 2020-12-30 14:55:41 +01:00
Michael Stapelberg 539bb61868 updater: use crc32 for checksumming when available
This is significantly faster than sha256 on the Raspberry Pi 4:
update speeds increase from ≈12 MB/s to ≈55 MB/s.
2020-06-26 11:05:05 +02:00
Michael Stapelberg 6897d2a79a move API to Target struct 2020-06-26 10:54:33 +02:00
Michael Stapelberg 71ca43da01 introduce updater.Target struct 2020-06-26 10:46:47 +02:00
Michael Stapelberg dd941cf696 set InsecureSkipVerify if -insecure is specified 2020-06-01 14:00:25 +02:00
Michael Stapelberg d96421c600 handle upgrade path (location: header missing) 2020-05-31 21:46:36 +02:00
Michael Stapelberg 0ad69b1961 remove status code check after all
I was about to add Unauthorized to the list, but I think we should just remove
it after all , as it seems brittle.
2020-05-31 21:46:12 +02:00
Michael Stapelberg bcf56cab3e don’t use TLS at all if -tls is empty 2020-05-31 21:45:59 +02:00
Michael Stapelberg d0cf397b47 GetTLSHttpClientByTLSFlag: check if tls flag is non-empty 2020-05-31 21:29:35 +02:00
Michael Stapelberg 5369c1985e config: don’t require os.UserConfigDir() to work at func init
This broke the packer’s sudo privilege elevation code path.
2020-05-30 20:59:35 +02:00
Michael Stapelberg 389acc6d08 add PARTUUID() 2020-05-30 19:04:18 +02:00
Michael Stapelberg 2cb9182fef factor host-specific config reading into internal/ 2020-05-27 18:35:28 +02:00
Michael Stapelberg 7e4057347a move iface package from github.com/gokrazy/gokrazy to internal
related to https://github.com/gokrazy/gokrazy/issues/57
2020-05-27 08:34:29 +02:00
Michael Stapelberg 9da9028582 travis: use go 1.14 2020-04-07 10:02:21 +02:00
Michael Stapelberg 660ad467b7 updater: add TargetSupports()
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:58:22 +02:00
Michael Stapelberg 37efc446ad declare a go module 2020-04-07 08:55:09 +02:00
Michael Stapelberg f93ff050da rootdev: add accessors for partitions, deal with PARTUUID=
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 08:54:35 +02:00