10 Commits

Author SHA1 Message Date
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
George Hopkins
de5f76c883 Support i386/x86 platforms (#75) 2024-08-18 16:15:51 +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
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
Anmol Khirbat
360a12cb46 Pass fs-size to mkfs.ext4 so it doesn't scribble over secondary GPT (#42) 2022-12-06 10:44:48 +01:00
oliverpool
07643813fd packer: fail on small device (#33) 2022-03-31 09:10:30 +02:00
Michael Stapelberg
0721be4715 move (*os.File).Sync() call into linux-specific packer_linux.go
This fixes the following error on macOS:

sync /dev/disk2: inappropriate ioctl for device

related to https://github.com/gokrazy/gokrazy/issues/22
2022-03-01 18:04:43 +01:00
Anup Chenthamarakshan
8bb7e491ea packer: allow using MBR partition tables (#28)
Some ARM devices (like Odroid XU4/HC1/HC2) only support MBR booting.
Allow generating MBR partition table for such devices.
2022-01-13 09:20:34 +01:00
Michael Stapelberg
bea67498b5 Switch to GPT partition tables, add systemd-boot for UEFI boot
This is useful for running gokrazy on PC platforms (e.g. for
https://router7.org/), where the first systems without legacy BIOS support are
starting to ship.

The existing boot methods (Legacy BIOS MBR boot, Raspberry Pi) are unaffected by
this change and keep working.

Regardless of the bootloader (BIOS, UEFI, Raspberry Pi), we now use a GPT
partition table with hybrid MBR (= protective MBR + FAT32 /boot partition
which the Raspberry Pi bootloader requires).

This change should have no effect on existing installations.

To switch to GPT, you’ll need to use the -overwrite= flag to partition the
device (e.g. SD card). If you want to keep your /perm partition, you’ll need to
shrink the file system (using resize2fs) by 1 MB to make space for the secondary
GPT partition table copy at the end of the device.

Previously, the partition *table* contained a UUID that we used as root=
parameter for the Linux kernel, e.g. root=PARTUUID=471cad93-03

Now, individual partitions (not the partition *table*) have a UUID that begins
with 60c24cc1-f3f9-427a-8199,
e.g. root=PARTUUID=60c24cc1-f3f9-427a-8199-2e18c40c0004

fixes https://github.com/gokrazy/gokrazy/issues/87
2021-06-24 13:52:55 +02:00