make(sic) it easier to flash boot image

main
Daniel Barlow 2024-02-18 22:07:37 +00:00
parent 07a29f8004
commit 60dcd5c39a
1 changed files with 18 additions and 8 deletions

View File

@ -1,17 +1,27 @@
DEVICE=root@biscuit.lan
# NFLAGS=-I nixpkgs=../nixpkgs
.PHONY: toplevel android-bootimg default update
.PHONY: toplevel android-bootimg default update android-recovery
default:
nix-build -A outputs.$@ -o $@
default toplevel:
nix-build $(NFLAGS) -A outputs.$@ -o $@
android-bootimg:
nix-build -A outputs.android.$@ -o $@
toplevel:
nix-build -A outputs.$@ -o $@
android-bootimg android-recovery:
nix-build $(NFLAGS) -A outputs.android.$@ -o $@
update: toplevel android-bootimg
nix-copy-closure --to $(DEVICE) -v --include-outputs ./toplevel
ssh $(DEVICE) "nix-env --profile /nix/var/nix/profiles/system --set `readlink toplevel` && /nix/var/nix/profiles/system/bin/switch-to-configuration switch"
cat android-bootimg | ssh $(DEVICE) "cat >/boot/boot.img"
boot-in-system.img: default
dd if=/dev/zero of=$@ bs=1M count=50
mkdir -p boot-in-system
-rm -f boot-in-system/boot.img
(cd boot-in-system && cp ../default/boot.img .)
mke2fs -d boot-in-system boot-in-system.img
flash: default boot-in-system.img
fastboot flash system boot-in-system.img
fastboot flash userdata default/system.img