2018-06-17 06:43:11 +03:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
with import ./initrd-order.nix;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.mobile.boot.stage-1.splash;
|
2018-07-05 20:06:25 +03:00
|
|
|
mkSplash = at: name:
|
2018-07-05 07:52:36 +03:00
|
|
|
{
|
|
|
|
init = lib.mkOrder at ''
|
|
|
|
show_splash ${name}
|
|
|
|
'';
|
|
|
|
contents = [
|
|
|
|
{
|
2018-07-05 20:06:25 +03:00
|
|
|
object = (builtins.path { path = ../artwork + "/${name}.png"; });
|
2018-07-05 07:52:36 +03:00
|
|
|
symlink = "/${name}.png";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2018-06-17 06:43:11 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.mobile.boot.stage-1.splash = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Enables splash screen.
|
|
|
|
'';
|
|
|
|
};
|
2018-07-05 07:52:36 +03:00
|
|
|
rgb-debug = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Enables a special splash with RGB debug components.
|
|
|
|
'';
|
|
|
|
};
|
2018-06-17 06:43:11 +03:00
|
|
|
};
|
|
|
|
|
2018-06-21 03:18:44 +03:00
|
|
|
config.mobile.boot.stage-1 = lib.mkIf cfg.enable (mkMerge [
|
|
|
|
{
|
2018-07-05 07:52:36 +03:00
|
|
|
init = lib.mkOrder BEFORE_FRAMEBUFFER_INIT ''
|
2018-06-21 03:18:44 +03:00
|
|
|
show_splash() {
|
2018-07-05 07:52:36 +03:00
|
|
|
ply-image --clear=0x000000 /$1.png > /dev/null 2>&1
|
2018-06-21 03:18:44 +03:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
extraUtils = [
|
2018-07-04 06:50:16 +03:00
|
|
|
{ package = pkgs.ply-image; extraCommand = "cp -pv ${pkgs.glibc.out}/lib/libpthread.so.* $out/lib"; }
|
2018-06-21 03:18:44 +03:00
|
|
|
];
|
|
|
|
}
|
2018-07-05 07:52:36 +03:00
|
|
|
|
2018-07-05 20:06:25 +03:00
|
|
|
(mkSplash AFTER_FRAMEBUFFER_INIT "loading")
|
|
|
|
(mkSplash (READY_INIT - 1) "splash")
|
|
|
|
(mkIf cfg.rgb-debug (mkSplash (READY_INIT) "rgb-debug"))
|
2018-06-21 03:18:44 +03:00
|
|
|
]);
|
2018-06-17 06:43:11 +03:00
|
|
|
}
|