star64: init
Mostly based on the visionfive 2 config. No GPU yet.
This commit is contained in:
parent
429f232fe1
commit
30f71ba6e0
14 changed files with 695 additions and 0 deletions
52
pine64/star64/sd-image.nix
Normal file
52
pine64/star64/sd-image.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ config, pkgs, lib, modulesPath, ... }:
|
||||
|
||||
let firmware = pkgs.callPackage ./firmware.nix { };
|
||||
in {
|
||||
imports = [
|
||||
"${modulesPath}/profiles/base.nix"
|
||||
"${modulesPath}/installer/sd-card/sd-image.nix"
|
||||
./default.nix
|
||||
];
|
||||
|
||||
sdImage = {
|
||||
imageName =
|
||||
"${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-pine64-star64.img";
|
||||
|
||||
# Overridden by postBuildCommands
|
||||
populateFirmwareCommands = "";
|
||||
|
||||
firmwarePartitionOffset = 4;
|
||||
firmwareSize = 4;
|
||||
|
||||
postBuildCommands = ''
|
||||
# preserve root partition
|
||||
eval $(partx $img -o START,SECTORS --nr 2 --pairs)
|
||||
|
||||
# increase image size for gpt backup header
|
||||
truncate -s '+2M' $img
|
||||
|
||||
sfdisk $img <<EOF
|
||||
label: gpt
|
||||
unit: sectors
|
||||
sector-size: 512
|
||||
|
||||
start=4096, size=4096, type=2E54B353-1271-4842-806F-E436D6AF6985
|
||||
start=8192, size=8192, type=5B193300-FC78-40CD-8002-E86C45580B47
|
||||
start=$START, size=$SECTORS, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, attrs="LegacyBIOSBootable"
|
||||
EOF
|
||||
|
||||
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
|
||||
dd conv=notrunc if=${firmware.spl}/share/pine64-star64/spl.bin of=$img seek=$START count=$SECTORS
|
||||
|
||||
eval $(partx $img -o START,SECTORS --nr 2 --pairs)
|
||||
dd conv=notrunc if=${firmware.uboot-fit-image}/share/pine64-star64/star64_fw_payload.img of=$img seek=$START count=$SECTORS
|
||||
'';
|
||||
|
||||
populateRootCommands = ''
|
||||
mkdir -p ./files/boot
|
||||
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [ firmware.updater-flash ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue