Split sd-card configuration into new image

This commit is contained in:
Daniel Fullmer 2020-12-23 14:00:05 -08:00
parent e992ecb107
commit 15f95ca074
3 changed files with 30 additions and 23 deletions

View File

@ -2,5 +2,5 @@
nix-build "<nixpkgs/nixos>" \
-I nixpkgs=https://github.com/danielfullmer/nixpkgs/archive/e69838e006a7271006ab834b521187891bf93ff4.tar.gz \
-I nixos-config=./configuration.nix \
-I nixos-config=./sd-image.nix \
-A config.system.build.sdImage

View File

@ -1,18 +1,6 @@
{ config, lib, pkgs, ... }:
let
uboot = pkgs.callPackage ./uboot {};
in
{
imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix> ];
nixpkgs.crossSystem = lib.recursiveUpdate lib.systems.examples.armv7l-hf-multiplatform {
platform = {
name = "pinecube";
kernelBaseConfig = "sunxi_defconfig";
};
};
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
boot.consoleLogLevel = 7;
@ -20,15 +8,6 @@ in
# cma is 64M by default which is waay too much and we can't even unpack initrd
boot.kernelParams = [ "console=ttyS0,115200n8" "cma=32M" ];
sdImage.populateFirmwareCommands = "";
sdImage.populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
sdImage.postBuildCommands = ''
dd if=${uboot}/u-boot-sunxi-with-spl.bin of=$img bs=1024 seek=8 conv=notrunc
'';
# See: https://lore.kernel.org/patchwork/project/lkml/list/?submitter=22013&order=name
boot.kernelPackages = pkgs.linuxPackages_5_9;
boot.kernelPatches = [
@ -75,7 +54,15 @@ in
networking.wireless.enable = true;
###
### Cross-compilation stuff ###
# Natively compiling on the pinecube is infeasible
nixpkgs.crossSystem = lib.recursiveUpdate lib.systems.examples.armv7l-hf-multiplatform {
platform = {
name = "pinecube";
kernelBaseConfig = "sunxi_defconfig";
};
};
nixpkgs.overlays = [ (self: super: {

20
sd-image.nix Normal file
View File

@ -0,0 +1,20 @@
{ config, pkgs, ... }:
let
uboot = pkgs.callPackage ./uboot {};
in
{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix>
./configuration.nix
];
sdImage.populateFirmwareCommands = "";
sdImage.populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
sdImage.postBuildCommands = ''
dd if=${uboot}/u-boot-sunxi-with-spl.bin of=$img bs=1024 seek=8 conv=notrunc
'';
}