1. Raul Iordache's Avatar
    Hello everyone!

    I ask for your help regarding unpacking-repacking system.img of an Android 7.0 Nougat.
    In order to start a porting process, I have just tested several system.img tools (for unpacking-repacking it).
    I have tried with the stock ROM (for testing purposes). Just unpacking-repacking the original ROM. But the system is unbootable, after flashing the new image.

    What I did:
    - From boot.img/ramdisk/fstab I have deleted the "verify" tag from /system partition ---> which should have disabled the dm-verity
    - I have unlocked the bootloader (via fastboot oem unlock). It is confirmed at Logo stage.
    - From boot.img/ramdisk/default.prop I have set the ro.secure to 0 (from 1), ro.adb.secure to 0 (from 1)

    What tools I have tried:
    - All Windows tools found on the Internet for packing-repacking system.img
    - Under Linux, simg2img and img2simg, etc.etc.

    Results:
    - EVERY time, the system.img file resulted is smaller (with several MB!!) than the original one! Without any modds!
    - System unbootable. (after flashing via SPFT)

    The problem is 99% with the image tool, because the output is smaller in size than the stock ROM.

    They are not relevant, but I provide some information about the device.
    [INFO]
    - MT6753 chipset
    - Device: VOYO Q101, 2GB/32GB
    - Android Nougat 7.0, kernel 3.18.35+

    PS. Unpacking-repacking a 5.1 Lollipop is okay. The repacked image has the SAME size as the original one. Unfortunately, something happens with Nougat images and ALL extracting tools.

    Any ideas? Thanks!
    09-17-2018 03:04 PM
  2. beardroid17's Avatar
    Hey Raul

    Still having this issue? I think we could get our heads together as I am working on an MT6750 Nougat phone and having some issues too.

    To be honest I have tried all kinds of tools, systems OS's etc over the years and the issue I think you have with using the make EXT4 tools to repack a system.img are that if it's not the same size exactly, it just boot loops. I tried this on a ROM using Ubuntu to unpack/repack and literally kept recompiling with different segment sizes all day until I got a few bytes smaller, then a few bytes bigger. It didn't work and my hair got a little thinner over those 10 hours too!!

    I also thought it was a dm-verity thing, but I don't think it is. So what you could try that I didn't do back then is to repack the image, but then you may need to stop dm-verity in the boot Loader too. So this involves unpacking the boot.img, removing the "veriy" terms from the mount line in the FSTAB file and also deleting the verity_keys file in the same directory. Repack and flash the boot and system.

    This would certainly stop verity from checking on boot and I know this works as I am using this on the device I have here right now.

    I'm only 40% confident on this, I still think the system.img has to be exact, but it's worth a try for the 10-15 mins it will take you. Gone are the days of Android 4/5 where you just repacked and as long as it fitted into the allocated area.

    One last thing to check is if the repacked system.img is actually bigger than the scatter file is allowing for? I still think the above applies, but it would be a big miss if your repacked image was bigger than the allocated size in the scatter file!

    WRT the default.prop settings. You cannot change ro.secure = 0 in user/release builds of the OS, only in eng builds. No matter how hard you try, adb shell getprop ro.secure will always be 0, trust me I spent about 1 week finally working that out. Good link here:

    https://stackoverflow.com/questions/...ild-in-android


    I have actually customised my device to how I want it and I actually used Magisk, it worked like a charm but had to remove dm-verity.

    My issue is that when I reset the device, the google play apps no longer let me sign up. Dreaded black screen when trying to sign in. (I have tried all the obvious stuff).

    Could you post back if you're still about, dm-verity and google play certification seems to have frightned off a lof hackers these days on Android.
    11-09-2018 11:40 AM

Similar Threads

  1. I need to hard reset my Note 8, but there is a problem.
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 09-17-2018, 03:18 PM
  2. Does "ENABLE Lock&Erase" automatically wipe the device?
    By Android Central Question in forum Ask a Question
    Replies: 0
    Last Post: 09-17-2018, 02:35 PM
  3. Replies: 0
    Last Post: 09-17-2018, 01:52 PM
  4. Replies: 0
    Last Post: 09-17-2018, 12:58 PM
  5. Questions about device icons on google account
    By keko keke in forum General Help and How To
    Replies: 2
    Last Post: 09-17-2018, 12:06 PM
LINK TO POST COPIED TO CLIPBOARD