pinephone-pro: ship a binary helper to install (or update) u-boot on an existing (or new) device

moby is now updated to u-boot 2025.07
This commit is contained in:
2025-09-01 22:25:48 +00:00
parent 9979289be1
commit f645005b45
4 changed files with 51 additions and 0 deletions

View File

@@ -216,6 +216,7 @@
./tcpdump.nix ./tcpdump.nix
./tor-browser.nix ./tor-browser.nix
./tuba.nix ./tuba.nix
./u-boot-pinephone-pro
./unl0kr ./unl0kr
./uptime.nix ./uptime.nix
./v4l-utils.nix ./v4l-utils.nix

View File

@@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.u-boot-pinephone-pro;
in
{
sane.programs.u-boot-pinephone-pro = {
packageUnwrapped = pkgs.runCommandNoCC "u-boot-pinephone-pro-program" {
preferLocalBuild = true;
} ''
install -Dm644 ${pkgs.u-boot-pinephone-pro}/idbloader.img $out/share/boot/idbloader.img
install -Dm644 ${pkgs.u-boot-pinephone-pro}/u-boot.itb $out/share/boot/u-boot.itb
install -Dm755 ${./install-u-boot} $out/bin/install-u-boot
# ln -sv $out/bin/install-u-boot $out/share/boot/install-u-boot
'';
sandbox.autodetectCliPaths = "existingFile";
};
environment.pathsToLink = lib.mkIf cfg.enabled [
"/share/boot"
];
}

View File

@@ -0,0 +1,25 @@
#!/bin/sh
set -eu
drive=$1
if ! [[ -e "$drive" ]]; then
echo "usage: install-u-boot /dev/sdX"
exit 1
fi
bootfiles_dir=
for d in ${XDG_DATA_DIRS//:/ }; do
if [[ -e "$d/boot/idbloader.img" ]] && [[ -e "$d/boot/u-boot.itb" ]]; then
bootfiles_dir=$d/boot
fi
done
if [[ -z "$bootfiles_dir" ]]; then
echo "boot/{idbloader.img,u-boot.itb} not found on XDG_DATA_DIRS"
exit 1
fi
set -x
dd if="$bootfiles_dir/idbloader.img" of="$drive" bs=512 seek=64 conv=notrunc,sync oflag=direct status=progress
dd if="$bootfiles_dir/u-boot.itb" of="$drive" bs=512 seek=16384 conv=notrunc,sync oflag=direct status=progress

View File

@@ -61,6 +61,10 @@ in
dd if=${pkgs.u-boot-pinephone-pro}/u-boot.itb of=$out bs=512 seek=16384 conv=notrunc dd if=${pkgs.u-boot-pinephone-pro}/u-boot.itb of=$out bs=512 seek=16384 conv=notrunc
''; '';
sane.programs.sysadminUtils.suggestedPrograms = [
"u-boot-pinephone-pro"
];
sane.programs.alsa-ucm-conf.suggestedPrograms = [ sane.programs.alsa-ucm-conf.suggestedPrograms = [
"pine64-alsa-ucm" # upstreaming: https://github.com/alsa-project/alsa-ucm-conf/pull/375 "pine64-alsa-ucm" # upstreaming: https://github.com/alsa-project/alsa-ucm-conf/pull/375
]; ];