2018-06-10 06:03:24 +03:00
|
|
|
{
|
2018-06-17 03:43:19 +03:00
|
|
|
device_config,
|
|
|
|
initrd
|
2018-06-10 06:03:24 +03:00
|
|
|
}:
|
|
|
|
let
|
2018-06-18 02:57:03 +03:00
|
|
|
pkgs = (import ../overlay);
|
2018-06-13 04:47:00 +03:00
|
|
|
in
|
|
|
|
with pkgs;
|
|
|
|
let
|
2018-06-17 02:21:41 +03:00
|
|
|
device_name = device_config.name;
|
|
|
|
device_info = device_config.info;
|
|
|
|
linux = device_info.kernel;
|
2018-06-10 06:03:24 +03:00
|
|
|
kernel = "${linux}/Image.gz-dtb";
|
|
|
|
dt = "${linux}/boot/dt.img";
|
|
|
|
|
2018-06-10 20:18:28 +03:00
|
|
|
# TODO : Allow appending / prepending
|
2018-06-17 02:21:41 +03:00
|
|
|
cmdline = device_info.kernel_cmdline;
|
2018-06-10 06:03:24 +03:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "nixos-mobile_${device_name}_boot.img";
|
|
|
|
|
|
|
|
src = builtins.filterSource (path: type: false) ./.;
|
|
|
|
unpackPhase = "true";
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
mkbootimg
|
|
|
|
dtbTool
|
|
|
|
linux
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkbootimg \
|
|
|
|
--kernel ${kernel} \
|
|
|
|
--dt ${dt} \
|
2018-06-10 20:18:28 +03:00
|
|
|
--ramdisk ${initrd} \
|
|
|
|
--cmdline "${cmdline}" \
|
2018-06-17 02:21:41 +03:00
|
|
|
--base ${device_info.flash_offset_base } \
|
|
|
|
--kernel_offset ${device_info.flash_offset_kernel } \
|
|
|
|
--second_offset ${device_info.flash_offset_second } \
|
|
|
|
--ramdisk_offset ${device_info.flash_offset_ramdisk} \
|
|
|
|
--tags_offset ${device_info.flash_offset_tags } \
|
|
|
|
--pagesize ${device_info.flash_pagesize } \
|
2018-06-10 06:03:24 +03:00
|
|
|
-o $out
|
|
|
|
'';
|
|
|
|
}
|