-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twrp: Initial basic support for TWRP builds #99
base: master
Are you sure you want to change the base?
Conversation
I've just tried this out and I've got it working on { pkgs, ... }:
{
flavor = "twrp";
device = "marlin";
# At least marlin needs this... https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/issues/33
envVars.ALLOW_MISSING_DEPENDENCIES = "true";
# https://forum.xda-developers.com/t/how-to-building-twrp-from-source-with-goodies.4029449/
source.dirs."device/google/marlin".src = pkgs.fetchFromGitHub {
owner = "TeamWin";
repo = "android_device_google_marlin";
rev = "72c4888ced18ffdbff962a3916cbd2a830f4c1ef";
sha256 = "06lf0p8gcm5ixsn08j54k79v55g1akaliyvjsws0v947kb4cs9md";
};
source.dirs."hardware/qcom/bootctrl".src = pkgs.fetchgit {
url = "https://android.googlesource.com/platform/hardware/qcom/bootctrl";
rev = "android-9.0.0_r61";
sha256 = "0zm2kqxk7pbn5ihbx3gz0w9ss28qjaxrcfcfx6s4l8gnn0afzk0j";
};
source.dirs."hardware/qcom/msm8998".src = pkgs.fetchgit {
url = "https://android.googlesource.com/platform/hardware/qcom/msm8998";
rev = "android-9.0.0_r61";
sha256 = "0qr2mjqwg947hlwvgy511ay4acziyclxz1l52dg2vgsndqhb9hmr";
}; Built with: As @samueldr mentioned in the earlier comment, |
BTW, I don't have plans to continue working on this branch in the close future. Looks like my main goal (a cheap way to make a TWRP build for unsupported devices) didn't work on a sample size of 1. But, as @danielfullmer observed, it's not far from working properly! So if anyone wants to take over and finish the work (in a fresh PR) feel free to do it. |
This currently does **not** handle devices. Fow now you'll have to provide your device tree manually.
Note that while it is deprecated by upstream, it may still be needed for some device trees that have not been updated to support the android-11 based builds. This has been verified to correctly build a `sofiar` (Moto g(8)) TWRP image that boots and works seemingly correctly.
This uses a TWRP device tree generated using - https://github.com/SebaUbuntu/TWRP-device-tree-generator And a known working recovery.img as a base. Though it does not boot. I guess one would need to investigate with other devices to have a better understanding of why. The recovery.img this produces has the same exact configuration and files, according to unpackbootimg, except for os level, os version and cmdline. Re-packing with those from the vendor recovery.img changed nothing. So, to recap, I have repacked from an unpackimg extraction BOTH this TWRP and the stock recovery. The repacked stock recovery still works, any TWRP will not. The only difference is the ramdisk.
7f337e0
to
d9f9781
Compare
I have verified with I'm not sure what should be done about device trees. The initial PR body has been updated, with a permanent spot for another known good config. |
This comment has been minimized.
This comment has been minimized.
This ensures overridden symlinks to directories are not attempted to be linked as a subdir by `ln`. e.g. with `build/core` already a symlink to something, the following would not work: ``` $ mkdir -p build $ ln -sf --relative build/make/core build/core ln: failed to create symbolic link 'build/core/core': Permission denied ``` Observe how the destination is `build/core`, but the link attempted to be created is `build/core/core`. From the manpage: > ``` > --no-dereference treat LINK_NAME as a normal file if it is a > symbolic link to a directory > ```
5f1656b
to
7a21c7f
Compare
( |
twrp = config.build.mkAndroid { | ||
name = "robotnix-${config.productName}-${config.buildNumber}"; | ||
makeTargets = [ "recoveryimage" ]; | ||
# Note that $ANDROID_PRODUCT_OUT is set by choosecombo above | ||
installPhase = '' | ||
mkdir -p $out | ||
cp --reflink=auto $ANDROID_PRODUCT_OUT/recovery.img $out/ | ||
''; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should we handle the need to provide either bootimage
or recoveryimage
, and $ANDROID_PRODUCT_OUT/recovery.img
or $ANDROID_PRODUCT_OUT/boot.img
conditionally on something I'm not even sure we can get?
Would adding an option be correct?
(Suprisingly) working config for cheeseburger: # SPDX-FileCopyrightText: 2022 Atemu
# SPDX-FileCopyrightText: 2021 Daniel Fullmer and robotnix contributors
# SPDX-License-Identifier: MIT
#
# Usage
# =====
#
# ```
# $ nix-build --arg configuration ./cheeseburger-twrp.nix -A config.build.twrp
# ```
#
{ pkgs, ... }:
{
device = "cheeseburger_dumpling";
androidVersion = 9;
flavor = "twrp";
envVars.ALLOW_MISSING_DEPENDENCIES = "true";
source.dirs = {
"device/oneplus/cheeseburger_dumpling" = {
src = pkgs.fetchFromGitHub {
owner = "TeamWin";
repo = "android_device_oneplus_cheeseburger_dumpling";
rev = "61f577680c941ca7c1e601105cad4c21cdc2fac9";
sha256 = "sha256-i+87wxWAqvnZOtDeiH1+fnvrjqMIedolbKNcS8S5lZ4=";
};
};
};
} |
Also works for an unsupported device ... in case it helps anyone else.
|
Read the commits.
TLDR:
on a limited sample size of one device tree, not even known working, does not workI guess next steps could be:
Build with a known working device treedone by @danielfullmerI don't know if I'll get back to this. It was mostly done so I could try and build the output of the TWRP Device Tree Generator thing, and it ended up not working for the device I tried it with.
Known issues
Reading material
That last thread with weird info has this bit:
and
So according to this old, yet updated thread, it looks like it's not turn-key. There may be some manual stuff to do to have upstream trees built.
Sample known working config