1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2025-01-02 13:07:37 +03:00

Makes rootfs configuratble by device_config...

This is a WIP, but this already should allow device-specific fb.modes
This commit is contained in:
Samuel Dionne-Riel 2018-06-12 23:14:55 +00:00
parent e56da86a90
commit 6fcd7a09e0
3 changed files with 26 additions and 13 deletions

View File

@ -4,16 +4,16 @@
with (import ./overlay);
let
deviceinfo = (lib.importJSON ./devices/postmarketOS-devices.json).${device_name};
device_config = import (./devices + ("/" + device_name)) {inherit lib;};
linux = pkgs."linux_${device_name}";
kernel = "${linux}/Image.gz-dtb";
dt = "${linux}/boot/dt.img";
# TODO : Allow appending / prepending
cmdline = deviceinfo.kernel_cmdline;
cmdline = device_config.kernel_cmdline;
# TODO : make configurable?
initrd = callPackage ./rootfs.nix { inherit device_name; };
initrd = callPackage ./rootfs.nix { inherit device_config; };
in
stdenv.mkDerivation {
name = "nixos-mobile_${device_name}_boot.img";
@ -33,12 +33,12 @@ stdenv.mkDerivation {
--dt ${dt} \
--ramdisk ${initrd} \
--cmdline "${cmdline}" \
--base ${deviceinfo.flash_offset_base } \
--kernel_offset ${deviceinfo.flash_offset_kernel } \
--second_offset ${deviceinfo.flash_offset_second } \
--ramdisk_offset ${deviceinfo.flash_offset_ramdisk} \
--tags_offset ${deviceinfo.flash_offset_tags } \
--pagesize ${deviceinfo.flash_pagesize } \
--base ${device_config.flash_offset_base } \
--kernel_offset ${device_config.flash_offset_kernel } \
--second_offset ${device_config.flash_offset_second } \
--ramdisk_offset ${device_config.flash_offset_ramdisk} \
--tags_offset ${device_config.flash_offset_tags } \
--pagesize ${device_config.flash_pagesize } \
-o $out
'';
}

View File

@ -0,0 +1,12 @@
{
lib,
}:
let
config = (lib.importJSON ../postmarketOS-devices.json).asus-z00t;
in
config // {
name = config.pm_name;
rootfs = {
fb_modes = ./fb.modes;
};
}

View File

@ -1,5 +1,5 @@
{
device_name,
device_config,
stdenv,
makeInitrd,
@ -22,6 +22,7 @@
# TODO : configurable through receiving device-specific informations.
let
device_name = device_config.name;
extraUtils = runCommandCC "extra-utils"
{
buildInputs = [ nukeReferences ];
@ -265,9 +266,9 @@ let
{ object = stage1; symlink = "/init"; }
{ object = ./temp-splash.png; symlink = "/splash.png"; }
{ object = ./loading.png; symlink = "/loading.png"; }
# FIXME : configurable rootfs additions from device config.
{ object = ./devices/asus-z00t/fb.modes; symlink = "/etc/fb.modes"; }
];
]
++ lib.optional (device_config ? rootfs.fb_modes) { object = device_config.rootfs.fb_modes; symlink = "/etc/fb.modes"; }
;
};
in
stdenv.mkDerivation {