feat: add MontaukOS Imager tool for Raspberry Pi
This commit is contained in:
1 parent
7e036c94e7
commit
b781cf8c97
4 files changed
+1770
No files matched your search
@@ -429,6 +429,12 @@ ifneq ($(ARCH),aarch64)
|
||||
endif
|
||||
./scripts/mk-rpi4-sd.sh kernel/bin-$(ARCH)/kernel ramdisk.tar $@ $(ROOTFS) $(PROGRAMS_BIN)-rpi
|
||||
|
||||
# Graphical imager: write montauk-rpi4.img to an SD card, or update the
|
||||
# installation on one in place (scripts/montauk-imager.py, docs/raspberry-pi.md).
|
||||
.PHONY: rpi4-imager
|
||||
rpi4-imager:
|
||||
./scripts/montauk-imager.py
|
||||
|
||||
$(IMAGE_NAME).hdd: limine/limine kernel ramdisk
|
||||
rm -f $(IMAGE_NAME).hdd
|
||||
dd if=/dev/zero bs=1M count=0 seek=64 of=$(IMAGE_NAME).hdd
|
||||
|
||||
@@ -12,6 +12,50 @@ make ARCH=aarch64 rpi4-sd # -> montauk-rpi4.img
|
||||
sudo dd if=montauk-rpi4.img of=/dev/sdX bs=4M conv=fsync
|
||||
```
|
||||
|
||||
Or use the imager, which also updates a card in place:
|
||||
|
||||
```bash
|
||||
make rpi4-imager # = ./scripts/montauk-imager.py
|
||||
```
|
||||
|
||||
### The imager
|
||||
|
||||
`scripts/montauk-imager.py` is a Tk window (`python3-tk`) that lists the SD
|
||||
cards and USB drives attached (never the host's own disks) and what is on
|
||||
them, and either writes a fresh image or updates the MontaukOS on a card. It
|
||||
runs as the user and does the writing by starting itself again through
|
||||
`pkexec` (it asks for the password each time). The same operations work from
|
||||
a terminal: `list`, and as root `flash`, `update` and `expand`
|
||||
(`--help` for the options). Images can be raw or `.gz`, `.xz` or `.zip`
|
||||
compressed; **Build** runs `make ARCH=aarch64 rpi4-sd`.
|
||||
|
||||
- **Write a fresh image** erases the card, writes the image, clears the last
|
||||
MiB of the card (a backup GPT from an earlier OS) and reads the card back to
|
||||
verify it. *Expand* grows the root to fill the card right away instead of
|
||||
leaving it to `firstboot.elf`.
|
||||
- **Update** leaves the partition table alone and finds both partitions by
|
||||
label, so a root that has grown to fill the card (or was resized by hand)
|
||||
stays as it is. On the ESP every file is written except `RPI_EFI.fd`, which
|
||||
holds the firmware's own settings (*Update the UEFI firmware* replaces it);
|
||||
a changed `config.txt` is kept as `config.txt.bak`. On the root, `os/`,
|
||||
`apps/`, `sdk/`, `boot/` get the image's new and changed files; `config/`
|
||||
and `www/` only get files the card lacks, `users/` and `state/` are not
|
||||
touched. `init.toml` becomes the image's, keeping each service's `enabled`
|
||||
from the card and appending services only the card has; `capabilities.toml`
|
||||
becomes the image's plus grants only the card has (old copies: `.old`).
|
||||
`os/firstboot.elf` is only written if the card still has it, so a grown
|
||||
card does not grow again. *Remove system files the new image no longer
|
||||
ships* prunes `os/`, `apps/`, `sdk/` and `boot/` (keeping `os/btkeys.bin`,
|
||||
the Bluetooth bonds). Unchanged files are skipped and each file is
|
||||
replaced by a rename; the volume is checked with `e2fsck` before and after,
|
||||
and its features against what `Fs/Ext2.cpp` mounts.
|
||||
- **Expand** (a host-side first boot) grows the root partition to the end of
|
||||
the card, at most 1 TiB, and the volume with `resize2fs`; `firstboot.elf`
|
||||
then finds nothing to do and deletes itself.
|
||||
|
||||
While it works, a runtime udev rule keeps the desktop from automounting the
|
||||
card's partitions (Linux writes to an ext2 volume as soon as it mounts it).
|
||||
|
||||
`scripts/mk-rpi4-sd.sh` downloads the firmware release once into
|
||||
`rpi4-firmware/` (`PFTF_VERSION=v1.53` by default) and builds an MBR image:
|
||||
|
||||
|
||||
Binary file not shown.
Executable
+1720
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user