at 24.11-pre 1.7 kB view raw
1# To build, use: 2# nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-powerpc64le.nix -A config.system.build.sdImage 3{ config, lib, pkgs, ... }: 4 5{ 6 imports = [ 7 ../../profiles/base.nix 8 ../../profiles/installation-device.nix 9 ./sd-image.nix 10 ]; 11 12 boot.loader = { 13 # powerpc64le-linux typically uses petitboot 14 grub.enable = false; 15 generic-extlinux-compatible = { 16 # petitboot is not does not support all of the extlinux extensions to 17 # syslinux, but its parser is very forgiving; it essentially ignores 18 # whatever it doesn't understand. See below for a filename adjustment. 19 enable = true; 20 }; 21 }; 22 23 boot.consoleLogLevel = lib.mkDefault 7; 24 boot.kernelParams = [ "console=hvc0" ]; 25 26 sdImage = { 27 populateFirmwareCommands = ""; 28 populateRootCommands = '' 29 mkdir -p ./files/boot 30 ${config.boot.loader.generic-extlinux-compatible.populateCmd} \ 31 -c ${config.system.build.toplevel} \ 32 -d ./files/boot 33 '' 34 # https://github.com/open-power/petitboot/blob/master/discover/syslinux-parser.c 35 # petitboot will look in these paths (plus all-caps versions of them): 36 # /boot/syslinux/syslinux.cfg 37 # /syslinux/syslinux.cfg 38 # /syslinux.cfg 39 + '' 40 mv ./files/boot/extlinux ./files/boot/syslinux 41 mv ./files/boot/syslinux/extlinux.conf ./files/boot/syslinux/syslinux.cfg 42 '' 43 # petitboot does not support relative paths for LINUX or INITRD; it prepends 44 # a `/` when parsing these fields 45 + '' 46 sed -i 's_^\(\W\W*\(INITRD\|initrd\|LINUX\|linux\)\W\)\.\./_\1/boot/_' ./files/boot/syslinux/syslinux.cfg 47 ''; 48 }; 49}