mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 01:37:24 +08:00
rockchip/rk3399: init
This commit is contained in:
committed by
mergify[bot]
parent
c5666d9cd6
commit
52047449bf
33
rockchip/default.nix
Normal file
33
rockchip/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.hardware.rockchip;
|
||||
in {
|
||||
options.hardware.rockchip = {
|
||||
enable = lib.mkEnableOption "Rockchip SoC support";
|
||||
diskoImageName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "main.raw";
|
||||
description = ''
|
||||
The output image name for Disko.
|
||||
Can be used by diskoExtraPostVM.
|
||||
'';
|
||||
};
|
||||
diskoExtraPostVM = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The post VM hook for Disko's Image Builder.
|
||||
Can be used to install platform firmware like U-Boot.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
boot = {
|
||||
kernelParams = [ "console=ttyS2,1500000n8" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
62
rockchip/disko.nix
Normal file
62
rockchip/disko.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.hardware.rockchip;
|
||||
in {
|
||||
imports = [
|
||||
rk3399/disko.nix
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
disko = {
|
||||
imageBuilder = {
|
||||
extraRootModules = [ "bcachefs" ];
|
||||
extraPostVM = cfg.diskoExtraPostVM;
|
||||
};
|
||||
memSize = lib.mkDefault 4096; # Default 1024 MB will throw "Cannot allocate memory" error
|
||||
devices.disk.main = {
|
||||
type = "disk";
|
||||
imageSize = lib.mkDefault "2G";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
type = "EF00";
|
||||
# Firmware backoff
|
||||
start = "16M";
|
||||
size = "500M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0022" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "bcachefs";
|
||||
mountpoint = "/";
|
||||
extraArgs = [
|
||||
"--metadata_checksum=xxhash"
|
||||
"--data_checksum=xxhash"
|
||||
"--compression=zstd"
|
||||
"--background_compression=zstd"
|
||||
"--str_hash=siphash"
|
||||
"--wide_macs"
|
||||
"--encrypted"
|
||||
"--no_passphrase"
|
||||
"--discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
20
rockchip/rk3399/default.nix
Normal file
20
rockchip/rk3399/default.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.hardware.rockchip.rk3399;
|
||||
in {
|
||||
imports = [
|
||||
../.
|
||||
];
|
||||
|
||||
options.hardware.rockchip.rk3399 = {
|
||||
enable = lib.mkEnableOption "Rockchip RK3399 support";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.rockchip.enable = true;
|
||||
};
|
||||
}
|
||||
14
rockchip/rk3399/disko.nix
Normal file
14
rockchip/rk3399/disko.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.hardware.rockchip.rk3399;
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||
"arm-trusted-firmware-rk3399"
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user