15 Commits

Author SHA1 Message Date
Michael Stapelberg
f16a76357f update: use crc32 for checksumming when the client requests it
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:03:54 +02:00
Michael Stapelberg
f3445e01a9 fix switchRootPartition on non-PARTUUID installations
The first update always worked, but a subsequent update would not.

To manually switch an installation to PARTUUID, mount its boot partition and
replace the root= kernel parameter in cmdline.txt, like so:

/tmp/breakglass669384965 # mkdir boot
/tmp/breakglass669384965 # mount /dev/mmcblk0p1 boot
/tmp/breakglass669384965 # cat boot/cmdline.txt
console=ttyAMA0,115200 root=/dev/mmcblk0p2 init=/gokrazy/init elevator=deadline rootwait
/tmp/breakglass669384965 # sed -i 's,root=/dev/mmcblk0p,root=PARTUUID=471cad93-0,g' boot/cmdline.txt
/tmp/breakglass669384965 # cat boot/cmdline.txt
console=ttyAMA0,115200 root=PARTUUID=471cad93-02 init=/gokrazy/init elevator=deadline rootwait
/tmp/breakglass669384965 # umount boot
/tmp/breakglass669384965 # reboot

The PARTUUID= for your installation is printed by gokr-packer:
[…]
2020/05/01 10:05:34 write.go:366: writing MBR (LBAs: vmlinuz=51789, cmdline.txt=119561, PARTUUID=471cad93)
[…]
2020-05-01 10:06:17 +02:00
Michael Stapelberg
057fc9dcb0 add /update/features handler for feature negotiation
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:52:12 +02:00
Michael Stapelberg
ffc8928d2e update to new rootdev API
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:00:10 +02:00
Michael Stapelberg
99287f68e3 update rootRe for running in user-mode linux 2018-11-01 17:54:23 +01:00
Michael Stapelberg
9770d4408f move root device finding function to internal/rootdev 2018-07-14 23:37:12 +02:00
Michael Stapelberg
d8206c507c /update/mbr: strip p suffix from mmcblk0p 2018-07-13 23:53:46 +02:00
Michael Stapelberg
24c8ad07b5 streamRequestTo: call f.Sync()
When calling reboot shortly after /update/*, the kernel should flush its cache,
but if you’re not calling reboot, it would be good to persist the data on disk
nevertheless.
2018-07-13 23:16:26 +02:00
Michael Stapelberg
0f8d40d7f6 add /update/mbr 2018-07-12 09:27:32 +02:00
Michael Stapelberg
4f0e427025 reboot: use kexec where possible
This doesn’t work on the Raspberry Pi yet (due to missing kexec_file_load), but
I tested it in qemu.
2018-06-17 09:29:29 +02:00
Michael Stapelberg
91da7026f8 reboot: send SIGTERM to processes, wait for 1s
This way, programs can flush state to permanent storage if they need to.
2018-06-17 08:53:19 +02:00
Michael Stapelberg
34f12d9ada update: find root device instead of hard-coding /dev/mmcblk0p*
This should allow using gokrazy from a USB drive.
2018-06-12 22:19:13 +02:00
Michael Stapelberg
6063608b2b update: introduce a /bootonly handler for bakery
Regular updates hit /boot, /root, then /switch.

bakery only updates /boot, so we need to take care of persisting the active root
partition across /boot updates.
2018-05-17 09:08:25 +02:00
Michael Stapelberg
b96471c05d update FAT16B writer import path 2017-07-14 03:19:15 +02:00
Michael Stapelberg
38af7fd18d Initial commit 2017-03-04 11:22:48 +01:00