mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-11-12 13:13:02 +03:00
Reads device informations / configuration from json file.
This allows many more devices to be implicitly working, once their kernel and device-specific quirks have been ported over.
This commit is contained in:
parent
d6f632d427
commit
7ec11f4bdf
@ -10,7 +10,7 @@ WIP notes
|
||||
---------
|
||||
|
||||
```
|
||||
nix-build bootimg.nix
|
||||
nix-build bootimg.nix --arg device_name '"asus-z00t"'
|
||||
# Maybe `nix copy ./result --to ssh://another-host`
|
||||
adb wait-for-device && adb reboot bootloader
|
||||
fastboot boot result # or full path
|
||||
|
33
bootimg.nix
33
bootimg.nix
@ -1,24 +1,19 @@
|
||||
{
|
||||
device_name ? "asus-z00t"
|
||||
device_name
|
||||
}:
|
||||
with (import ./overlay);
|
||||
|
||||
let
|
||||
# TODO : import this from device description
|
||||
deviceinfo = (lib.importJSON ./devices/postmarketOS-devices.json).${device_name};
|
||||
linux = pkgs."linux_${device_name}";
|
||||
kernel = "${linux}/Image.gz-dtb";
|
||||
dt = "${linux}/boot/dt.img";
|
||||
cmdline = "androidboot.hardware=qcom ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 androidboot.selinux=permissive";
|
||||
ramdisk = callPackage ./rootfs.nix { inherit device_name; };
|
||||
|
||||
base = "0x10000000";
|
||||
kernel_offset = "0x00008000";
|
||||
second_offset = "0x00f00000";
|
||||
ramdisk_offset = "0x02000000";
|
||||
tags_offset = "0x00000100";
|
||||
pagesize = "2048";
|
||||
|
||||
# TODO : Allow appending / prepending
|
||||
cmdline = deviceinfo.kernel_cmdline;
|
||||
|
||||
# TODO : make configurable?
|
||||
initrd = callPackage ./rootfs.nix { inherit device_name; };
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "nixos-mobile_${device_name}_boot.img";
|
||||
@ -36,14 +31,14 @@ stdenv.mkDerivation {
|
||||
mkbootimg \
|
||||
--kernel ${kernel} \
|
||||
--dt ${dt} \
|
||||
--ramdisk ${ramdisk} \
|
||||
--cmdline "${cmdline}" \
|
||||
--base ${base } \
|
||||
--kernel_offset ${kernel_offset } \
|
||||
--second_offset ${second_offset } \
|
||||
--ramdisk_offset ${ramdisk_offset} \
|
||||
--tags_offset ${tags_offset } \
|
||||
--pagesize ${pagesize } \
|
||||
--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 } \
|
||||
-o $out
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user