mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-07 10:28:51 +08:00
rockchip: support generic firmware installation
This commit is contained in:
committed by
mergify[bot]
parent
ab84bd93a3
commit
0b2e2fe9b3
@@ -74,8 +74,8 @@ Below is an annoated flake example to create the initial boot image.
|
|||||||
# Override the default bootloader with a cross built one.
|
# Override the default bootloader with a cross built one.
|
||||||
# Use this if you do not have binfmt configured on your system.
|
# Use this if you do not have binfmt configured on your system.
|
||||||
# For NixOS, please add `boot.binfmt.emulatedSystems = [ "aarch64-linux" ];` to your system configuration.
|
# For NixOS, please add `boot.binfmt.emulatedSystems = [ "aarch64-linux" ];` to your system configuration.
|
||||||
# Update the system and the firmware package according to your device.
|
# Read the device module to see how it was configured.
|
||||||
# hardware.radxa.rock-4c-plus.platformFirmware = nixpkgs-unfree.legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform.ubootRock4CPlus;
|
# hardware.rockchip.platformFirmware = nixpkgs-unfree.legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform.ubootRock4CPlus;
|
||||||
|
|
||||||
users.users.radxa = {
|
users.users.radxa = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|||||||
@@ -2,29 +2,18 @@
|
|||||||
, pkgs
|
, pkgs
|
||||||
, config
|
, config
|
||||||
, ...
|
, ...
|
||||||
}:
|
}: {
|
||||||
let
|
|
||||||
cfg = config.hardware.radxa.rock-4c-plus;
|
|
||||||
rkCfg = config.hardware.rockchip;
|
|
||||||
in {
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
../.
|
||||||
../../rockchip
|
../../rockchip
|
||||||
];
|
];
|
||||||
|
|
||||||
options.hardware.radxa.rock-4c-plus = {
|
|
||||||
platformFirmware = lib.mkPackageOption pkgs "ubootRock4CPlus" { };
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
hardware = {
|
hardware = {
|
||||||
radxa.enable = true;
|
radxa.enable = true;
|
||||||
rockchip = {
|
rockchip = {
|
||||||
rk3399.enable = true;
|
rk3399.enable = true;
|
||||||
diskoExtraPostVM = ''
|
platformFirmware = pkgs.ubootRock4CPlus;
|
||||||
dd conv=notrunc,fsync if=${cfg.platformFirmware}/idbloader.img of=$out/${rkCfg.diskoImageName} bs=512 seek=64
|
|
||||||
dd conv=notrunc,fsync if=${cfg.platformFirmware}/u-boot.itb of=$out/${rkCfg.diskoImageName} bs=512 seek=16384
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,29 +2,18 @@
|
|||||||
, pkgs
|
, pkgs
|
||||||
, config
|
, config
|
||||||
, ...
|
, ...
|
||||||
}:
|
}: {
|
||||||
let
|
|
||||||
cfg = config.hardware.radxa.rock-5b;
|
|
||||||
rkCfg = config.hardware.rockchip;
|
|
||||||
in {
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
../.
|
||||||
../../rockchip
|
../../rockchip
|
||||||
];
|
];
|
||||||
|
|
||||||
options.hardware.radxa.rock-5b = {
|
|
||||||
platformFirmware = lib.mkPackageOption pkgs "ubootRock5ModelB" { };
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
hardware = {
|
hardware = {
|
||||||
radxa.enable = true;
|
radxa.enable = true;
|
||||||
rockchip = {
|
rockchip = {
|
||||||
rk3588.enable = true;
|
rk3588.enable = true;
|
||||||
diskoExtraPostVM = ''
|
platformFirmware = pkgs.ubootRock5ModelB;
|
||||||
dd conv=notrunc,fsync if=${cfg.platformFirmware}/idbloader.img of=$out/${rkCfg.diskoImageName} bs=512 seek=64
|
|
||||||
dd conv=notrunc,fsync if=${cfg.platformFirmware}/u-boot.itb of=$out/${rkCfg.diskoImageName} bs=512 seek=16384
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,29 +2,18 @@
|
|||||||
, pkgs
|
, pkgs
|
||||||
, config
|
, config
|
||||||
, ...
|
, ...
|
||||||
}:
|
}: {
|
||||||
let
|
|
||||||
cfg = config.hardware.radxa.rock-pi-4;
|
|
||||||
rkCfg = config.hardware.rockchip;
|
|
||||||
in {
|
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
../.
|
||||||
../../rockchip
|
../../rockchip
|
||||||
];
|
];
|
||||||
|
|
||||||
options.hardware.radxa.rock-pi-4 = {
|
|
||||||
platformFirmware = lib.mkPackageOption pkgs "ubootRockPi4" { };
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
hardware = {
|
hardware = {
|
||||||
radxa.enable = true;
|
radxa.enable = true;
|
||||||
rockchip = {
|
rockchip = {
|
||||||
rk3399.enable = true;
|
rk3399.enable = true;
|
||||||
diskoExtraPostVM = ''
|
platformFirmware = pkgs.ubootRockPi4;
|
||||||
dd conv=notrunc,fsync if=${cfg.platformFirmware}/idbloader.img of=$out/${rkCfg.diskoImageName} bs=512 seek=64
|
|
||||||
dd conv=notrunc,fsync if=${cfg.platformFirmware}/u-boot.itb of=$out/${rkCfg.diskoImageName} bs=512 seek=16384
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,12 +17,26 @@ in {
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "main.raw";
|
default = "main.raw";
|
||||||
description = ''
|
description = ''
|
||||||
The output image name for Disko.
|
The output image name of Disko.
|
||||||
Can be used by diskoExtraPostVM.
|
You need to match this value with the real image name. Setting it alone
|
||||||
|
won't change the output image name, as it is controlled by Disko module.
|
||||||
|
|
||||||
|
Can be used in diskoExtraPostVM.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
platformFirmware = lib.mkPackageOption pkgs "platform firmware" {
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
diskoExtraPostVM = lib.mkOption {
|
diskoExtraPostVM = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
|
default = ''
|
||||||
|
${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/idbloader.img of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=64
|
||||||
|
${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/u-boot.itb of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=16384
|
||||||
|
'';
|
||||||
|
defaultText = lib.literalExpression ''
|
||||||
|
${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/idbloader.img of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=64
|
||||||
|
${lib.getExe' pkgs.coreutils "dd"} conv=notrunc,fsync if=${config.hardware.rockchip.platformFirmware}/u-boot.itb of=$out/${config.hardware.rockchip.diskoImageName} bs=512 seek=16384
|
||||||
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
The post VM hook for Disko's Image Builder.
|
The post VM hook for Disko's Image Builder.
|
||||||
Can be used to install platform firmware like U-Boot.
|
Can be used to install platform firmware like U-Boot.
|
||||||
|
|||||||
Reference in New Issue
Block a user