yashsingh1/xdaforums huggingface dataset:
[Nexus 7 (2013) Q&A] Ifreet145:
Hello, i have a bricked nexus 7 2013 flo too and what only does is enter in download mode.

my symptom is: #3 - catastrophic eMMC failure, PC registers a new USB\VID_05C6&PID_9008 device, refer to QPST diagnostics below

When i click on "Get regions" it gives me a NAK error

I tried changing to diag mode as explained here, but it just connects as download mode.
[Nexus 7 (2013) Q&A] k23m:
Please follow the unbricking guide - https://xdaforums.com/showpost.php?p=75360854&postcount=199

Note, any "write" errors indicate faulty eMMC chip. If so, have a look around this thread for hardware solutions.

:good:
[Nexus 7 (2013) Q&A] Ifreet145:
Thanks for the reply.

I already tried that one too, it writes something but in the end it tells me to disable driver signature enforcement, as it is already disabled.

EDIT: This is the log from misflash:
[Nexus 7 (2013) Q&A] Ifreet145:
Let me tell you all... I got mine FIXED! :)

First PROBLEM:

Couldn't enter recovery nor boot into the ROM, only in bootloader. Used the nexus root kit tool, nothing. Always giving me "Failed" in flashing the bootloader. But at the time i didn't notice that. Using Miflash also flashes and in the end giving waiting for device error (that in the end i understood it was normal)

Second PROBLEM:

Battery low couldn't do anything in the bootloader, hours later couldn't enter in the bootloader either, only in download mode. Following QPST guides, only to give me NAK errors.

First SOLUTION:

Bought a a logic board on ebay, it was a hynix chip, installed, booted to stock rom, in the middle of the configuration the tablet rebooted never to enter ROM again, just a bootloop. This time i had access to recovery and bootloader, i could flash all the stock rom from google just to be stuck in a bootloop AGAIN! I gave up, send the logic board back.

Second and final SOLUTION:

As i switch the logic board that i bought (to later send it back) to the my original one, SURPRISE i have access to bootloader!!! As i try to flash again i returned to the FIRST PROBLEM. I was about to give up again, then i surf the internet one more time and try to understand what i can do to revive this tablet AGAIN! I found out that my tablet didn't have partitions mounted or they were broken. Don't remember what command i used in fastboot to give me the partitions info but they all were at 0. So i found this https://pastebin.com/aJJ1R4Be and mounted the partitions with success, after this when you reboot the tablet it only enters in the download mode. OK lets use the miflash tool with the SERVICE ROM. Then lets flash the stock rom. Nothing same ol'same. So i saw something in the nexus tool kit logs, (READING IS VERY IMPORTANT) "Flashing [ROM] failed, Need bootloader 4.08 version" or something like that, i had the 3.12 version from SERVICE ROM. I thought, maybe the first stock rom image from google have the 3.12 version. No it's the 3.14 version. What if i flash the service rom one more time but switch the bootloader version 3.12 with the 3.14 from the stock rom 4.3 android image zip file and this time use the cmd file named "debrick-flashall" from the SERVICE ROM folder?

SUCCESS!!! Got past that failed to flash bootloader and i could flash the STOCK ROM :D

Booted to the ROM, did the wizard configuration and updated all up to Marshmallow. MY TABLET IS ALIVE!!!!

PS: My original chip is a Hynix too.

PS2: With all that open and close the back of my tablet, that back cover have some rips and the touchscreen suffered a big crack, the swipes and taps won't work in a T zone. Just bought a touchscreen with frame from Ali and waiting til now.

Sorry for not going straight to the solution but i had to write my problems too, so someone with the same as mine may find some hope.

Thanks.
[Nexus 7 (2013) Q&A] jhford:
Excuse me, but isn't it easier and cheaper just to install a new motherboard? That's what I did.
[Nexus 7 (2013) Q&A] k23m:
Hi edovis, the partition table is not broken, no problem with it.

Your twrp-log.txt dmesg:

<3>[ 2.652587] mmc0: unrecognised EXT_CSD revision 8
<3>[ 2.652709] mmc0: error -22 whilst initialising MMC card

You have used a new eMMC version 5.1 revision 8, which is not recognized by the old N7 kernels. Revision 7 issues were fixed by a 1-byte patch of the kernel... https://patchwork.kernel.org/patch/2596591/ and https://git.kernel.org/pub/scm/linu.../?id=38ca285044be88a0fb47b6eb91deeeb729435fd0

It should be resolved by another patch, to revision 8, this time. Do this...

ask your favorite's ROM developer to recompile the kernel with revision 8 extension

or ask any other still active N7 developer

wait a while....

if there is no response, I will compile such kernel for you

OK?
[Nexus 7 (2013) Q&A] edovis:
Hi, everyone! Thanks for your replies!

Actually, there're several reasons while I'm doing it this way. First of all, I live in Argentina and here it's much more easy and cheaper to buy a new eMMC chip than to import a motherboard. Second, since my N7 was dead with the Kingston chip, I took this opportunity to improve my SMT soldering skills, learn about Linux and Android (it's my first time ever working with console and under the hood with Android) and because I really love this tablet. Third, it looks fun to me! :D

Sounds relieving that should be a solution for my problem! I thought there was an issue with its partition table, but obviously I was wrong (as I said earlier, it's my first time digging around with Linux and Android hehe). I'm trying to leave my N7 as stock as possible. I'd like to install it the latest factory image from Google (MOB30X). Would be too much to ask you for compiling that kernel for me?

Once again, thanks k23m!
[Nexus 7 (2013) Q&A] edovis:
Hi, guys.

So here's my update. I've been looking around how to compile Android kernel with eMMC 5.1 (REV 8) support as suggested by k23m. Following some XDA tutorials (xdaforums.com/android/software-hacking/reference-how-to-compile-android-kernel-t3627297) and a YouTube video (youtube.com/watch?v=5q9Cn3ixRns), I managed to get the latest Android Marshmallow 6.0.1 kernel from here:

android-msm-flo-3.4-marshmallow-mr2

android.googlesource.com/kernel/msm/+/refs/heads/android-msm-flo-3.4-marshmallow-mr2

and the toolchain from here:

arm-eabi-4.8 for marshmallow-mr2-release

android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/+/refs/heads/marshmallow-mr2-release

After that, I changed line 296 from mmc.c inside drivers/mmc/core from:

if (card->ext_csd.rev > 7) {

to:

if (card->ext_csd.rev > 8) {

Also, I had to change line 373 from timeconst.pl inside kernel from:

if (!defined(@val)) {

to:

if (!@val) {

because I kept getting a compiler error (deprecated use of...). Then, I compiled everything under Ubuntu 19.04 and got zImage. I used boot.img file from stock ROM (downloaded from: developers.google.com/android/images#razor), unpacked it and repacked using Android Image Tool. Finally, I follow post #199 one more time. However, I kept getting on my twrp-log the same error:

<3>[ 2.838623] mmc0: unrecognised EXT_CSD revision 8
<3>[ 2.838836] mmc0: error -22 whilst initialising MMC card

Any suggestions?
[Nexus 7 (2013) Q&A] k23m:
Well done, but the error comes from TWRP's own kernel which ALSO NEEDS the revision 8 patch. They use ElementalX and I did compile it in the past but with original kernel config file which makes the image too big for the recovery partition. The config is not embeded in the TWRP kernel binary and I could not find it online. If you can find and compile it, let me know. Anyway, as we need to

change just one single byte

in the kernel, why not try this:

unpack twrp.img file

extract the compressed portion of the zImage file

decompress it

disassemble it

find the revision 7 byte

patch it to revision 8

re-compress it (they use the XZ compressor)

generate checksum(s) for the code

re-assemble zImage (header+code+footer/checksum)

re-pack the zImage with ramdisk into a new twrp.img

I've done the hardest part already, here is the hex search for revision 7:

070052E32022C4E50600009A341090E5

The first byte "0x07" needs to be patched to "0x08", and this hex-search applies probably to all N7 kernels as they all use identical mmc.c code in their compilations. I am currently looking for info on zImage checksum generation method. You can either compile the kernel from source code or try to patch an existing binary.

:highfive:
[Nexus 7 (2013) Q&A] edovis:
Hi, k23m!

Ok, let's recap. This is what I did:

Downloaded from dl.twrp.me/flo TWRP image for N7 (2013) version twrp-3.3.1-0-flo.img

Unpacked it with Android Image Kitchen

Got the twrp-3.3.1-0-flo.img-zImage file and used binwalk to uncompressed it.

binwalk gave me three files: 34BB.xz, 3598, 3598.xz

Hexdumped 3598 file with hexed.it online tool, searched for:

070052E32022C4E50600009A341090E5

and changed it to:

080052E32022C4E50600009A341090E5

Compressed 3598 file with command xz

Since there, I'm lost :confused:. I don't know how to re-assemble zImage as you mentioned. Any help would appreciated.

Thanks for all your support!
[Nexus 7 (2013) Q&A] k23m:
Hi again, let's put aside this idea for now. I've just quickly compiled my old mod of TWRP with the mmc.c revision 8 patch. Do as follows:

download the modified twrp

complete the guide: "if it was a blank eMMC, do this extra step using: fastboot boot twrp.img"

flash your modified MOB30X

As I mentioned before, my TWRP is too big for the recovery partition, but works fine from RAM with fastboot boot twrp.img

Logs from the RAM-booted TWRP:

<5>[ 0.000000] Linux version 3.4.0 (root@a) (gcc version 4.8 (GCC) ) #9 SMP PREEMPT Thu Sep 19 21:32:58 AEST 2019
<5>[ 0.000000] Kernel command line: console=ttyHSL0,115200,n8 androidboot.hardware=flo user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.selinux=permissive androidboot.emmc=true androidboot.serialno=087102a4 bootreason=Reboot fuse_info=Y ddr_vendor=hynix androidboot.baseband=apq asustek.hw_rev=rev_e androidboot.bootloader=FLO-04.08

<6>[ 5.619628] mmc0: new HS200 MMC card at address 0001
<6>[ 5.625396] mmcblk0: mmc0:0001 HBG4e 29.1 GiB

ro.omni.version=6.0.1-20160404-flo-HOMEMADE
ro.twrp.boot=1
ro.twrp.version=3.0.2-0

:good: :fingers-crossed:
[Nexus 7 (2013) Q&A] edovis:
Hi, k23m!

Sorry for replying you now. I've been without Internet connection for the last 12 hours (ISP issues) :crying:. I've already found a solution for my N7 and it's exactly the same as you proposed in your last post hehe :victory:. I've use the stock kernel from Google with the mcc.c mod for rev 8 as the TWRP kernel. I boot TWRP from RAM, installed p4-restore-int.zip and, finally, flashed factory MOB30X. Now my N7 it's live again!!! :highfive:

I should point out that the mcc.c mod I've made differs from the one I mentioned back in post #341. I read in Texas Instruments forum that Peter Steinberg had the same issue with eMMC 5.1 (e2e.ti.com/support/legacy_forums/embedded/linux/f/354/t/545614). However, his approach was sightly different because he kept having the problem after applying rev 8 patch. So, he comment out all the if statement, from:

if (card->ext_csd.rev > 7) {
pr_err("%s: unrecognised EXT_CSD revision %d\n",
mmc_hostname(card->host), card->ext_csd.rev);
err = -EINVAL;
goto out;
}

to:

/*
if (card->ext_csd.rev > 7) {
pr_err("%s: unrecognised EXT_CSD revision %d\n",
mmc_hostname(card->host), card->ext_csd.rev);
err = -EINVAL;
goto out;
}
*/

k23m, I'm really grateful to you for all your support and time dedicated to solve my situation! And for those who own a N7 with a dead Kingstone eMMC, I encourage you to follow my steps and learn A LOT on the way :D.

Here goes link to download factory image MOB30X and TWRP-3.3.1-0, both with updated kernel to support eMMC 5.1: mega.nz/#F!zM9BzS7D!LANr3czGEz7IqY_MJnzQRg

P.D.: just some thought... would be possible to apply a new mcc.c to native support eMMC 5.1 HS400 (something like importing mcc.c from Android Pie)?
[Nexus 7 (2013) Q&A] k23m:
Congratulations on the very first adaptation of eMMC v5.1 on Nexus 7 2013! :victory:

Let's briefly compare original, old eMMC v4.5 to eMMC v5.1:

faster R/W performance

2x Interface Bandwidth

SMART (Health) Report

F/W Update option

But most importantly, there is no need to search for old stock of original or equivalent chips, as

new high-performance, cheap ICs can be used

(in FBGA 153/169 package of course). Furthermore, higher capacity memory like 64GB, works fine. While the advanced new features of eMMC v5.1 require additional kernel modifications and dedicated apps, we already have standard solutions for N7 ROMs. Links to stock ROM and RAM-bootable TWRP are in edovis' post, I also compiled a flashable TWRP and generic kernel for custom ROMs. More misc support files.
[Nexus 7 (2013) Q&A] edovis:
My new SanDisk eMMC 5.1 chip comes in FBGA153 package. eMMC standard does not use the extra pads FBGA169 has :o. They are there just for mechanical purposes. What it's more, N7 main board has footprint silkscreen for both packages, so it's very easy to properly align and solder FBGA153 packages. Take a look at this: pasteboard.co/Izix0fo.jpg
[Nexus 7 (2013) Q&A] k23m:
Good point - post updated!

Let's put your eMMC v5.1 to a few speed tests :D

First, get AndroBench app and run the 'micro' test - I attached my results from the old, original Hynix eMMC.

Next, run/install the attached zip from TWRP. I wrote it long time ago and modified now for v5.1 test - it will create "emmc2.txt" log in the root of internal storage. I get these, low-level speed results:

DRIVER=mmcblk
MMC_TYPE=MMC
MMC_NAME=HBG4e
MODALIAS=mmc:block
100+0 records in
100+0 records out
104857600 bytes (100.0MB) copied, 38.695496 seconds, 2.6MB/s
100+0 records in
100+0 records out
104857600 bytes (100.0MB) copied, 1.615295 seconds, 61.9MB/s

The first is write speed of random data and the last is read speed. Please post your results. :highfive:
[Nexus 7 (2013) Q&A] edovis:
Hi, again k23m! Sorry for the delay. This week was hell at work. Here is my result from the app: pasteboard.co/IAEJl5c.png. And here from your script:

DRIVER=mmcblk
MMC_TYPE=MMC
MMC_NAME=DG4032
MODALIAS=mmc:block
100+0 records in
100+0 records out
104857600 bytes (100.0MB) copied, 38.573303 seconds, 2.6MB/s
100+0 records in
100+0 records out
104857600 bytes (100.0MB) copied, 2.541626 seconds, 39.3MB/s
[Nexus 7 (2013) Q&A] delachurch:
My symptom is #4 works up to fastboot stage or Google logo

(bootloader)	partition[30].name = userdata

(bootloader)	partition[30].first_lba = 4718592

(bootloader)	partition[30].last_lba = 30212062

(bootloader)	partition[30].size 12746735 KB

...

OKAY [ 0.150s]

Finished. Total time: 0.151s

I' ve provided some more details here, https://xdaforums.com/nexus-7-2013/nexus-7-2013-qa/help-nexus-7-rebooting-google-logo-t3979083

I'm trying to re-flash stock image. The only error I see, is when fastboot flash data userdata.img

Sending 'data' (136890 KB) OKAY [ 4.749s]

Writing 'data' FAILED (remote: 'partition table doesn't exist')

Can someone help me to solve this issue. Tablet will continue to loop.
[Nexus 7 (2013) Q&A] k23m:
Hello edovis. Great results - random write IOPS is 1.7x more on eMMC 5.1 ! As for the worse low-level write, it may be because I did a fresh eMMC fstrim prior to the test.

:highfive:

Well, your command "fastboot flash data userdata.img" is incorrect. There is no partition named "data" hence the error.

We need more logs, please do the following....

go to your folder with fastboot.exe and adb.exe

download twrp-3.2.3-0-flo.img to the folder

also unzip and copy the attached "twrp-log2.bat" to the folder

in the folder open a DOS command window and copy/paste: fastboot boot twrp-3.2.3-0-flo.img [Enter]

when TWRP is up and running (may ask for ADB driver) and you see the menu, double-click on

twrp-log2.bat

Note, the above steps must be done withn 3 minutes to ensure complete dmesg log

then you will find a new file

twrp.txt

in the folder

zip up

twrp.txt

and attach it to your next post

Alternatively, upload twrp.txt to http://pastebin.com and post the link.

:fingers-crossed:
[Nexus 7 (2013) Q&A] riyan65:
Hi, my device got bricked after keeping on charge for whole night, don't know how it got bricked as charger is working, but device is not connecting to PC or any light is blinking, taken to service center, but they told the board need to replace,can anyone point out how to repair it.thanks in advance.
[Nexus 7 (2013) Q&A] k23m:
Hi, please test it out:

disconnect the battery

connect N7 to a PC

after 20 sec press all 3 buttons for 1 sec

check if N7 registers in USB Device Tree Viewer

Note: first make sure the USB cable and PC work properly with a different device.

Also, if the battery measures less than 3.5V, recharge it externally, reconnect it and check if N7 starts up.
[Nexus 7 (2013) Q&A] riyan65:
I will give it a try:)
[Nexus 7 (2013) Q&A] riyan65:
Didn't work, nothing shown in PC, but the motherboard get warm. Any other way.
[Nexus 7 (2013) Q&A] Aprate:
mmc0:0001 016G92 14.6 GiB, checked with dmesg | grep mmc0.

The only problems i have is that the autoturning aint working anymore.

And MTP is not working, but no problems with adb and fastboot. even after a cleanup from restock.
[Nexus 7 (2013) Q&A] k23m:
Yes, with Restock diagnostics is easy.

autoturning - it is a (simple) hardware issue, I wrote about it here

MTP - first please check this thread. Also try MTP provided by TWRP as it has a different USB ID.

:highfive:
[Nexus 7 (2013) Q&A] Aprate:
Thanks for the suggestion! For me it was the bottom connector which wasn't seated correctly. And a corner broke off with disassembling the tablet :( probably already degraded or cracked there. Got it second hand.

About mtp; even in twrp it is not working but I'll try again now that i have reseated the flex.

EDIT: mtp/ptp still aint working in lineage14.1 and twrp. adb driver installs without a problem.
[Nexus 7 (2013) Q&A] k23m:
The corners on my N7 are much worse after dozens of disassemblies :D

USB hardware of your N7 is OK (fastboot and ADB work). MTP stack is also OK (tested Stock, LOS and TWRP). So, let's focus on your PC. What Windows version are you using? If you always hibernate/suspend it, do reboot it first. Try this:

connect to PC

in LOS, pull down the notification bar and switch USB mode from Charging to MTP

run this app https://www.uwe-sieber.de/usbtreeview_e.html

does it detect your N7?

if yes, please post the +++ Device Information +++ section about "Friendly Name : Nexus 7"

I can assure you that if the app detects N7, then it is just a Windows issue. Do add/remove the driver, reboot, repeat - it will work.
[Nexus 7 (2013) Q&A] Aprate:
Yeah it's probably something in my pc. I use Windows 10. But I don't care that much.

I tried it on my laptop and it seems to work normally.

Only when I want to reflash the tablet it would be handy to have mtp, sideloading works as well tho ?

Thanks for the great help and clear instructions!
[Nexus 7 (2013) Q&A] k23m:
Hello, I really appreciate the detailed description and relevant logs. Unfortunately, I have bad news...

<6>[ 5.700775] mmc0: new HS200 MMC card at address 0001
<6>[ 5.701538] mmcblk0: mmc0:0001 MMC32G 28.8 GiB

<3>[ 25.493347] mmcblk0: error -110 sending stop command, original cmd response 0x900, card status 0x2400e00

<3>[ 7.845855] EXT4-fs (mmcblk0p31): ext4_check_descriptors: Checksum for group 0 failed (6097!=0)
<3>[ 7.853576] EXT4-fs (mmcblk0p31): group descriptors corrupted!

So, you have the infamous Kingston eMMC chip (MMC32G 28.8 GiB is its signature) known for incredibly high failure rate. The mmcblk0 error -110 is a typical indicator of partial hardware fault. Consequently, there are numerous ext4 corruption errors all over your logs.

If left undisturbed, this Kingston could have worked much longer on the old Android. The process of flashing new LineageOS involves massive flash memory re-writes and triggers accelerated NAND wear-out of the awful IC responsible for numerous, premature N7 deaths. You will find advice on eMMC replacement in the first post of this thread.
[Nexus 7 (2013) Q&A] gorilla p:
Fortunately, if you're still using this device, it's time for a replacement.

Finding an affordable device however with the community support that the Nexus devices had however is pretty much impossible.

I just settled on a Mi Pad4. Solid hardware, good price at around 170 but no manufacturer support (Xiaomi is horrible when it comes to firmware support on anything) but there are good build available for 8.1 and 9.0 in the forums if you just need something that you want to make stable
[Nexus 7 (2013) Q&A] ipdev:
[MENTION=7182780]k23m[/MENTION]

Might not be to the replacing emmc part yet. ;)

The script [MENTION=1977153]crypticc[/MENTION] used is very heavy handed.

Changes partitions 22,23,24,25,30 and adds 31.

system, cache, misc, recovery. 30 becomes vendor, 31 is userdata.

Free space between conjoining partitions is mostly used.

(I'd have to double check but, I believe misc is repositioned and resides partially were cache originally is.)

So unless all affected partitions are removed and recreated (including free space), in the proper location, I'm not sure a stock gpt would work.

Would probably need at least a misc.img to flash back.

Since fastboot and TWRP are still accessible (and nothing else gets borked along the way), may still be able to recover.

I might be wrong with this line of thought though.

Cheers. :cowboy:
[Nexus 7 (2013) Q&A] ipdev:
I still use my Nexus 7(s) daily. :D

[Take a glance at the attached image.]
[Nexus 7 (2013) Q&A] crypticc:
Thanks all for your interest and looking.

I have just remembered I do have another broken Nexus7 (I think - need to have a rummage in the kitchen drawer) from where I nabbed this screen hoping it would resolve the responsiveness and autorotate issue. I had done that before I realised there was a "Parrot" fix. [Edit : Screen broken - only slightly more involved switch)

The device itself is terminal but I think is more because of the charging daughter board and therefore also a useless battery. Will try quick switch-aroo.

Updated dmesg and recovery.log from a more well-behaved boot into Recovery this morning - for the curious.

Still MMC errors.

Going to retry the "format data" in TWRP which is the step that wasn't completing before - just in case I'm lucky.

Recovery

https://pastebin.com/JgsLWnwk

DMESG

https://pastebin.com/aiv2K9ss
[Nexus 7 (2013) Q&A] k23m:
The repartition scheme is indeed heavy handed but that's what LineageOS 16.0 users have been successfully using for over a year now. In fact, I had flashed the same Clamor script, UA TWRP and LOS16 as a Restock test case before releasing it. Yes, stock GPT was restored flawlessly. Note that Restock GPT works the same way as in N7 unbricking and it does not care about any existing partitions at all - it can create them on a blank, new eMMC chip after all.

:good:
[Nexus 7 (2013) Q&A] hypochondrej:
For your stats:

My Nexus 7 2013 deb, locked, has symptom #4.

I used standalone fastboot as well as the RESTOCK tool to confirm it has the Kingston eMMC.

The "format cache" command hangs. When invoked during the RESTOCK process, it also hangs, but it was possible to continue by restarting bootloader. Then it however got stuck during unlock at "(bootloader) erasing userdata...".

I guess I'll need to replace the eMMC, or just say goodbye to my beloved device. :(

Thanks for the excellent guide and tool! :good:
[Nexus 7 (2013) Q&A] k23m:
Thanks for your comprehensive report, stats updated. Apart from eMMC replacement, there are other options, for example right now I see these on eBay:

https://www.ebay.com/itm/143491504475

- $10, flo model, you could use your LCD and battery with it

https://www.ebay.com/itm/143415099767

- $48, deb mobo, the "missing pin" is from either NFC or wireless charging, easy fix or irrelevant, depending on usage needs

:fingers-crossed:
[Nexus 7 (2013) Q&A] hypochondrej:
I will check those, thanks a lot for the heads up!
[Nexus 7 (2013) Q&A] flobelle:
For your stats

SD Insight:

hynix model HBG4E 31 GB Manufactured June 2013

Still on original Android 6.0.1 but getting pretty laggy.

The charging port rarely ever works so I now charge wirelessly.

I still think this is/was a great tablet.