2020-10-10 01:19:34 +03:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
mobile.device.name = "razer-cheryl2";
|
|
|
|
mobile.device.identity = {
|
|
|
|
name = "Phone 2";
|
|
|
|
manufacturer = "Razer";
|
|
|
|
};
|
|
|
|
|
|
|
|
mobile.hardware = {
|
|
|
|
soc = "qualcomm-sdm845";
|
2020-10-10 01:21:37 +03:00
|
|
|
ram = 1024 * 8;
|
2020-10-10 01:19:34 +03:00
|
|
|
screen = {
|
2020-10-10 01:21:37 +03:00
|
|
|
width = 1440; height = 2560;
|
2020-10-10 01:19:34 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mobile.boot.stage-1 = {
|
2020-10-10 01:21:37 +03:00
|
|
|
kernel.package = pkgs.callPackage ./kernel { };
|
2020-10-10 01:19:34 +03:00
|
|
|
};
|
|
|
|
|
2021-02-27 06:40:59 +03:00
|
|
|
# cheryl2 is "ro.build.product";
|
|
|
|
# Different models of the Razer Phone 2 have different ro.product.device.
|
|
|
|
# It is unknown how supporting `bolt` or `linus` would actually differ.
|
|
|
|
mobile.system.android.device_name = "aura";
|
2020-10-10 01:19:34 +03:00
|
|
|
mobile.system.android = {
|
|
|
|
# This device has an A/B partition scheme.
|
|
|
|
ab_partitions = true;
|
|
|
|
|
|
|
|
bootimg.flash = {
|
|
|
|
offset_base = "0x00000000";
|
|
|
|
offset_kernel = "0x00008000";
|
|
|
|
offset_ramdisk = "0x01000000";
|
|
|
|
offset_second = "0x00f00000";
|
|
|
|
offset_tags = "0x00000100";
|
|
|
|
pagesize = "4096";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
mobile.system.vendor.partition = "/dev/disk/by-partlabel/vendor_a";
|
|
|
|
|
|
|
|
boot.kernelParams = [
|
|
|
|
# Extracted from an Android boot image
|
2020-10-10 01:46:15 +03:00
|
|
|
#"console=ttyMSM0,115200n8"
|
|
|
|
#"earlycon=msm_geni_serial,0xA84000"
|
2020-10-10 01:19:34 +03:00
|
|
|
"androidboot.hardware=qcom"
|
|
|
|
"androidboot.console=ttyMSM0"
|
2020-10-10 01:46:15 +03:00
|
|
|
#"video=vfb:640x400,bpp=32,memsize=3072000"
|
2020-10-10 01:19:34 +03:00
|
|
|
"msm_rtb.filter=0x237"
|
|
|
|
"ehci-hcd.park=3"
|
|
|
|
"lpm_levels.sleep_disabled=1"
|
|
|
|
"service_locator.enable=1"
|
|
|
|
"swiotlb=2048"
|
|
|
|
"androidboot.configfs=true"
|
2020-10-10 01:46:15 +03:00
|
|
|
#"firmware_class.path=/vendor/firmware_mnt/image"
|
2020-10-10 01:19:34 +03:00
|
|
|
"loop.max_part=7"
|
|
|
|
"androidboot.usbcontroller=a600000.dwc3"
|
|
|
|
"buildvariant=user"
|
|
|
|
];
|
|
|
|
|
|
|
|
mobile.system.type = "android";
|
|
|
|
|
2020-10-10 01:21:37 +03:00
|
|
|
mobile.usb.mode = "gadgetfs";
|
2020-10-10 01:19:34 +03:00
|
|
|
# Google
|
|
|
|
mobile.usb.idVendor = "18D1";
|
|
|
|
# "Nexus 4"
|
|
|
|
mobile.usb.idProduct = "D001";
|
|
|
|
|
2020-10-10 01:21:37 +03:00
|
|
|
mobile.usb.gadgetfs.functions = {
|
|
|
|
rndis = "gsi.rndis";
|
2021-01-28 05:53:37 +03:00
|
|
|
adb = "ffs.adb";
|
2020-10-10 01:21:37 +03:00
|
|
|
};
|
2020-10-10 01:21:51 +03:00
|
|
|
|
|
|
|
mobile.boot.stage-1.tasks = [
|
|
|
|
# This works around an issue with the default boot and the panel.
|
|
|
|
# Instead we reboot in recovery mode where it just works :/
|
|
|
|
(pkgs.writeText "reboot_recovery.rb" ''
|
|
|
|
class Tasks::MaybeRebootToRecovery < SingletonTask
|
|
|
|
def initialize()
|
|
|
|
add_dependency(:Files, "/proc/cmdline")
|
|
|
|
end
|
|
|
|
|
2020-12-20 01:44:38 +03:00
|
|
|
def booted_with_recovery_fdt?()
|
|
|
|
# TODO: actually detect FDT using /proc/device-tree
|
|
|
|
cmdline = File.read("/proc/cmdline")
|
|
|
|
[
|
|
|
|
# Assume presence of that cmdline means it booted with normal boot
|
|
|
|
!cmdline.match(/mdss_dsi_nt36830_wqhd_dualdsi_extclk_cmd_10bit/),
|
|
|
|
].any?()
|
|
|
|
end
|
|
|
|
|
2020-10-10 01:21:51 +03:00
|
|
|
def run()
|
2020-12-20 01:44:38 +03:00
|
|
|
unless booted_with_recovery_fdt?()
|
2020-10-10 01:21:51 +03:00
|
|
|
$logger.info("HACK!! Rebooting to recovery to have a working display...")
|
|
|
|
System.run("reboot", "recovery")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
'')
|
|
|
|
];
|
2020-10-10 01:19:34 +03:00
|
|
|
}
|