Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

TWRP for Amlogic devices.

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Warning! TL/DR - stop here!

    https://forum.xda-developers.com/sho....php?t=2450045
    Within a root shell the concatenation of these commands and multiplying the blocks by 1024 was:
    Code:
    cat /proc/partitions
    ls -al /dev/block/platform/*.emmc/by-num
    ls -al /dev/block/platform/*.emmc/
    ls -al /dev/block/platform/*.sd/by-num
    ls -al /dev/block/platform/*.emmc/
    
    major    minor  #blocks  name            mount                     blks*1024
    
       7        0      65536 loop0                                     67108864
     253        0     512000 zram0                                     524288000
     179        0   15155200 mmcblk0                                   15518924800
     179        1       4096 mmcblk0p1    -> /dev/block/bootloader     4194304
     179        2      65536 mmcblk0p2    -> /dev/block/reserved       67108864
     179        3     524288 mmcblk0p3    -> /dev/block/cache          536870912
     179        4       8192 mmcblk0p4    -> /dev/block/env            8388608
     179        5      32768 mmcblk0p5    -> /dev/block/logo           33554432
     179        6      32768 mmcblk0p6    -> /dev/block/recovery       33554432
     179        7       8192 mmcblk0p7    -> /dev/block/rsv            8388608
     179        8       8192 mmcblk0p8    -> /dev/block/tee            8388608
     179        9      32768 mmcblk0p9    -> /dev/block/crypt          33554432
     179       10      32768 mmcblk0p10   -> /dev/block/misc           33554432
     179       11      32768 mmcblk0p11   -> /dev/block/boot           33554432
     179       12    2097152 mmcblk0p12   -> /dev/block/system         2147483648
     179       13   12152832 mmcblk0p13   -> /dev/block/data           12444499968
     179       32       4096 mmcblk0boot0 -> /dev/block/mmcblk0boot0   4194304
     179       64       4096 mmcblk0boot1 -> /dev/block/mmcblk0boot1   4194304
     179       96        128 mmcblk0rpmb  -> /dev/block/mmcblk0rpmb    131072
    BoardConfig.mk
    Code:
    # Partitions
    BOARD_RECOVERYIMAGE_PARTITION_SIZE := 33554432
    BOARD_BOOTIMAGE_PARTITION_SIZE := 33554432
    BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648
    BOARD_USERDATAIMAGE_PARTITION_SIZE:= 12444499968
    BOARD_CACHEIMAGE_PARTITION_SIZE := 536870912
    BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
    BOARD_FLASH_BLOCK_SIZE := 131072
    https://www.cnx-software.com/2016/11...ogic-tv-boxes/
    Using that to build the .img extractor as "amlxtract" I uncompress original image file flashed to device.
    Code:
    _aml_dtb.PARTITION
    _aml_dtb.VERIFY
    aml_sdc_burn.ini
    aml_sdc_burn.UBOOT
    bootloader.PARTITION
    bootloader.VERIFY
    boot.PARTITION
    boot.VERIFY
    DDR.USB
    logo.PARTITION
    logo.VERIFY
    meson1.dtb
    platform.conf
    recovery.PARTITION
    recovery.VERIFY
    system.PARTITION
    system.VERIFY
    UBOOT.USB
    _aml_dtb.PARTITION and meson1.dtb are identical so renamed one of them to "dtb" and placed it in device/amlogic/p212_N/ overwriting the existing.


    Extract recovery.img (recovery.PARTITION) then initrd.img.
    Code:
    bootimg.cfg
    initrd.img
    zImage
    initrd.img:
    Code:
    acct
    boot
    bugreports -> /data/user_de/0/com.android.shell/files/bugreports
    cache
    charger -> /sbin/healthd
    config
    d -> /sys/kernel/debug
    data
    default.prop
    dev
    etc
    file_contexts.bin
    fstab.amlogic
    init
    init.rc
    init.recovery.amlogic.rc
    mnt
    oem
    proc
    property_contexts
    res
    sbin
    sdcard
    seapp_contexts
    selinux_version
    sepolicy
    service_contexts
    storage
    sys
    system
    tmp
    ueventd.amlogic.rc
    ueventd.rc
    vendor -> /system/vendor
    Rename zImage to kernel and move to device/amlogic/p212_N/ .
    Could take contents of initrd.img and place in device/amlogic/p212_N/recovery/root

    This is where things complicate. Essentially anything in device/amlogic/p212_N/ is an override. In other words, whatever kernel the TWRP build process creates will be ignored in favor of the override kernel provided. Overwriting the entire contents of device/amlogic/p212_N/recovery/root would negate the entire build process. It'd be the same as rebuilding stock recovery.

    I figure first step (in Linux) is to do "rmdir *" to remove empty folders, then delete any symbolic links. Of course we'd want to retain init-recovery.amlogic.rc and etc twrp.fstab. Theoretically it makes sense to override only those files absolutely necessary and let TWRP build what it requires. The more overrides, the more conflicts.

    Not sure if twrp.fstab should be edited with the initial filesystem information gleaned. If so it looks more like this:
    Code:
    /cache          ext4        /dev/block/cache       /dev/block/mmcblk0p3   flags=backup=1;display=Cache
    /system         ext4        /dev/block/system      /dev/block/mmcblk0p12  flags=backup=1;display=System
    /data           ext4        /dev/block/data        /dev/block/mmcblk0p13  flags=backup=1
    
    /boot           emmc        /dev/block/boot        /dev/block/mmcblk0p11  flags=backup=1;display=Boot
    /recovery       emmc        /dev/block/recovery    /dev/block/mmcblk0p6   flags=backup=1;display=Recovery
    /logo           emmc        /dev/block/logo        /dev/block/mmcblk0p5   flags=backup=1;display=Logo;flashimg
    /misc           emmc        /dev/block/misc        /dev/block/mmcblk0p10
    
    /external_sd    auto        /dev/block/mmcblk1p1                          flags=wipeingui;storage;removable;display="External SD"
    /usb-otg        auto        /dev/block/sda1                               flags=display="USB OTG";removable;storage

    https://github.com/minimal-manifest-...fest_twrp_omni
    Code:
    To initialize a shallow clone, which will save even more space, use a command like this:
    
    repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-5.1
    
    Then to sync up:
    
    repo sync
    
    Then to build:
    
     cd <source-dir>; . build/envsetup.sh; lunch omni_<device>-eng; mka recoveryimage
    Pull Magendanz repo directly into twrp-5.1 tree
    Code:
    cd <source-dir>
    git clone https://github.com/Magendanz/android_device_amlogic.git --depth 1 --branch master device/amlogic
    device/amlogic/p212_N/vendorsetup.sh
    Code:
    add_lunch_combo omni_p212_N-userdebug
    add_lunch_combo omni_p212_N-user
    add_lunch_combo omni_p212_N-eng
    Now build
    Code:
    cd <source-dir>
    . build/envsetup.sh
    lunch omni_p212_N-userdebug
    mka recoveryimage
    Build is successful and I use android app named "rashr" to flash custom recovery then reboot into it. Hasn't worked so far [success! see next post] whether I build against twrp-5.1 or twrp-7.1.

    From my observation, the choice of twrp tree has a major impact on cross-compilation, with included tool-chain. Since we're going to use the kernel from stock recovery (which matches that found in stock boot.img (boot.PARTITION)) it's important that the build process outputs software compatible with the provided kernel.

    Pretty sure everything is correct. I don't edit the dtb or kernel but may use too many overrides. Will keep at it no matter how long it takes to figure this out.
    Last edited by noabody; 12-21-2017, 19:33.

    Comment


      My previous post may be useful as a more detailed process/tutorial.

      I decided to start over with a shallow twrp-5.1 repo and the additional local_manifest.xml http://freaktab.com/forum/tv-player-...427#post693427 as .repo/local_manifests/local_manifest.xml

      Made no changes whatsoever to device/amlogic/p212_N device tree and built the recovery.img. Flashed it with the android app "flashify" and this time it worked for
      Code:
      [URL="https://mega.nz/#F!F9xjTSSa!R0vJfTC2U6Qc2skNMrr1iQ!YhIgTbiK"]https://mega.nz/#F!F9xjTSSa!R0vJfTC2...rr1iQ!YhIgTbiK[/URL] >
      Nexbox A95x (s905x) Android 7.1 > Firmware > November 2017 >
      Firmware for NEXBOX A95X (S905X, 2-16G) 9377 Wifi Only Nov 2017 >
      NEXBOX-A95X_S905X_7.1_qca9377_16g2g_171120preview_SD_USB. rar
      So far this is the newest OS that I could get fully working on my TX5Pro.

      Used UPDATE-unSU.zip (CRC32=ca26b037) to unroot and installed Magisk 14 (Magisk 14.5 beta failed). It was kind of odd to be able to run Animal Crossing Pocket Camp on my TX5 (albeit, without touch input, you can't do anything in-game).

      Thanks again Magendanz. I figure your git files, and kernel in particular, are perfectly suited to the twrp-5.1 tree. That, along with the additions you made for p212_N, must have ironed out the trouble I had trying to graft stock kernel/dtb/and initrd.img files into the device tree.


      P.S.
      It's always interesting to follow the hack-ish like instructions provided by really intelligent people. Filling in the knowledge gaps is most entertaining.
      Last edited by noabody; 12-18-2017, 20:32.

      Comment


      • Guest's Avatar
        Guest commented
        Editing a comment
        Well, most of the credit goes to abdul_pt. He blazed the trail here. (And yes, our instructions are not geared for noobs. A certain knowledge level is assumed, and even then we can be quite cryptic.)

      • trebor
        trebor commented
        Editing a comment
        Cryptic that's an understatement
        Keep on reading it will hit you...

      Someone here who s able to confirm a working TWRP or Clockwrkmod for K1 PRO Android 7.1 AMLOGIC S905D/W

      Comment


        Originally posted by ssarava9 View Post
        I have nexbox a95x and after flashing a zip file im unable to boot into system, it keeps bringing to twrp recovery, any suggestions on how to load into systems from TWRP recovery ?
        Please help as im stuck
        Any good soul who can help me im stuck again, i dont want to flash again and redo all the process over and over again, there should be an easy way out of boot loop, please help

        Comment


          Originally posted by Magendanz View Post

          Okay, I've figured out what was wrong with processing command-line arguments in the bootloader control block (BCB) here. The offset to the bootloader message block on these Rockchip devices is 16384, rather than the usual zero or 2048. Unfortunately, BOARD_RECOVERY_BLDRMSG_OFFSET is set in the BoardConfig.mk, which I can't easily hack in the image file like I did earlier with the fstab. I really need AbduL's help to fix this.

          If you get stuck in this TWRP boot loop, the workaround is to wipe the /misc partition (which contains the BCB). Just go to terminal and type this:

          Code:
          dd if=/dev/zero of=/dev/block/platform/ff520000.rksdmmc/by-name/misc bs=1M
          You'll still need to do the factory wipe in TWRP, but it will then reboot to the system partition.
          Any command for Nexbox S905x , i used twrp 3.1.1 and got stuck in recovery boot loop, please help

          Comment


            Originally posted by Magendanz View Post
            Okay, I generated a few builds of TWRP 3.2.1-0 just to see if I could get it working, and I'm happy to report success:There aren't many changes, but I've updated the GitHub repo here: https://github.com/Magendanz/android_device_amlogic

            Also, in order to build version 3.2.1-0, you've got to use the following local_manifest.xml:

            Code:
            <?xml version="1.0" encoding="UTF-8"?>
            <manifest>
            <remote name="omnirom"
            review="gerrit.omnirom.org"
            fetch="https://github.com/omnirom" />
            
            <remove-project name="android_bootable_recovery" />
            <project path="bootable/recovery" name="android_bootable_recovery" remote="omnirom" revision="android-8.0" groups="pdk-cw-fs"/>
            </manifest>
            Remember, the "_N" suffix is for Nougat projects, which have a separate DTB partition. The ones ending in "x" are VideoStrong variations on the Amlogic q201 and p212 reference boards.
            I used the q201 twrp to install magisk 14.0. Not sure if there were errors but magiskis installed and working. But now there is a 15..0 version, i install it using the same TWRP, it says 'unable to detect boot image'. And update failed.Â*
            Could it be at all the TWRP app unable to detect the device file for the bootloader ?
            P/s: Also encountered strange problem with otg HDD. Under certain conditions the otg HDD appear to be 0 byte but if go to terminal, and do a 'df', the otg is mounted properly.
            Last edited by mctiew; 12-30-2017, 10:17.

            Comment


              Originally posted by mikhoul View Post
              Guest Do you know if somebody have built a TWRP V3.1.1.0 for the Nexbox A95X 2gb/16gb (P212) ?


              Regards
              If the stock p212 version I made doesn't work, just let me know. I've actually got one of those for testing, but it's only 1GB DRAM and so I don't use it much.
              Hi Guest I've tested the stock p212 version and sadly it don't work they boot directly in the stock recovery

              I will really appreciate if you can try to build one with your Nexbox A95X, let me know by quoting when it will be done and I will try it .

              In meantime I wish you Happy Holidays

              Comment


              • Guest's Avatar
                Guest commented
                Editing a comment
                Thanks, and I apologize for the late response. Just got back from holiday on Saturday and am digging out from back email.

                If it's running Nougat, try the p212_N variant.

              Hello everybody,

              I have an MXIII 1G tv box with android 4.4.2, and I would like to try some custom roms.
              Do to that I first want to flash a new recovery, and I am happy to see that this topic offer to download a large choice of recovery images for AmLogic platform.

              I successfully download my image: TWRP_2.8.7.0_MXIII_1G.img, but the problems begin now.

              I first try to flash the recovery with the ¨USB Burning Tool¨ provided by the box manufacturer. The box is well detected (after booting in flash mode), but I am unable to open the img file. I try with various version of the tool, and each time I try to import the image I have the same error message: ¨parse burning iamge fail¨ (typo included).

              Then I try to flash the image by using the stock recovery. After booting in recovery mode, the main display show this:

              Android system recovery <3e>
              KOT49H.20150815 test-keys

              Volume up/down to move highlight;
              enter button to select.

              reboot system now
              apply update from ADB
              apply update from ETX
              apply update from cache
              wipe data/factory reset
              wipe cache partition


              I try to flash using an USB stick (update from ETX), but the stock recovery do not recognize the img file but only zip files. So I search and found on internet how to create a flashable zip using a template, and I use SignApk to sign my zip.
              But the problem is all my try ends with the same error message:

              Verifying update package...
              E:footer is wrong
              E:signature verification failed
              Installation aborted


              Probably that my sign method is wrong.
              So my question is (finally): is anybody can give me the good way to create a flashable zip file? May be that my version of testkey.pk8 is wrong or something like that.

              Else, is anybody can give me an other way to flash the recovery image?

              Thanks.

              Comment


                I have the p201 and would try building my own but I see only options for


                m201
                p200
                p212
                p212_N
                p21x
                q201
                q201_N
                q20x

                also would I still have to use TWRP 5.1 branch? 8.1 seems to be the current branch?

                I am assuming TWRPMXQ-Pro-4K-p201 will not work for me as I have different memory / disk sizes?
                just after TWRP so I can try and root this darn JVC Smart TV LT-55n685A

                Comment


                • Guest's Avatar
                  Guest commented
                  Editing a comment
                  Try the p200 on that. I seem to remember that it worked.

                Originally posted by mikhoul View Post



                Hi Guest I've tested the stock p212 version and sadly it don't work they boot directly in the stock recovery

                I will really appreciate if you can try to build one with your Nexbox A95X, let me know by quoting when it will be done and I will try it .

                In meantime I wish you Happy Holidays

                Guest
                Where is the link for the P212_N variant ? This link https://1drv.ms/u/s!AoqocX31ecnXgZoGWZhOXl_aTXAbLg don't work.

                Regards !

                Comment


                  Hi everybody.

                  I have an KM8 Pro tv box with android 6.0.1. I can use it on him?



                  Comment


                    Originally posted by miguelosgcv View Post
                    Hi everybody.
                    I have an KM8 Pro tv box with android 6.0.1. I can use it on him?


                    TWRP FOR KM8 PRO / Yoka KB2 ANDROID 6.0.1


                    OR THIS


                    FOR KM8 PRO / Yoka KB2 ANDROID 7.1.1

                    Comment


                      I am trying to download a copy of TWRP recovery image from the first post in this thread. I only get a page full of code. I have an M8S older box m8s ap6330

                      Comment


                        Hello everybody
                        I have a ExcellVan t95z with amlogic s912, 2/16GB, MM 6.0.1. I want flash TWRP but i don't know where i can download the right version. Can anyone help me please?
                        Last edited by Specy; 01-26-2018, 11:05.

                        Comment


                          Originally posted by Specy View Post
                          Hello everybody
                          I have a ExcellVan t95z with amlogic s912, 2/16GB, MM 6.0.1. I want flash TWRP but i don't know where i can download the right version. Can anyone help me please?
                          what is your rom version: q20x, q2..., p..... ?

                          Comment

                          Working...
                          X