Skip to content
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

No response (time out?) after at step 6 booting from APX to fastboot #9

Open
Smurfjet opened this issue Apr 1, 2022 · 27 comments
Open

Comments

@Smurfjet
Copy link

Smurfjet commented Apr 1, 2022

Steps 1 to 5 working properly from what I can tell, they executed as per instructions, however after executing step 6

smurfjet@ubuntu:~/tegra30_debrick$ sudo ./utils/nvflash_v1.13.87205_miniloader_patched --setbct --bct ./bct/nexus_7_grouper_bct.bin --configfile ./utils/flash.cfg --bl ./bootloader/bootloader-grouper-4.23.img --go
Nvflash v1.13.87205 started

The command appears to hang, and after 45 minutes I had to force close the terminal.
Any ideas what might cause this behaviour?
P.S. I'm a beginner.
Thanks!

@tofurky
Copy link
Owner

tofurky commented Apr 1, 2022

try skipping step 5. see note from step 5: "Note: APX/nvflash will become unresponsive after this completes successfully - you'll need to cycle power and repeat steps 1 through 4"

@Smurfjet
Copy link
Author

Smurfjet commented Apr 2, 2022

Skip the quote and go to below.

Progress update. Did as suggested and there is progress, however, the battery must have been low as I reached the boot screen (?) with the Google logo and unlocked padlock, but there were 7 message saying battery low, even though I had it charging over 3 hours. Anyway I'm now at this prompt:

smurfjet@ubuntu:~/tegra30_debrick$ sudo ./utils/nvflash_v1.13.87205_miniloader_patched --setbct --bct ./bct/nexus_7_grouper_bct.bin --configfile ./utils/flash.cfg --bl ./bootloader/bootloader-grouper-4.23.img --go
Nvflash v1.13.87205 started
chip uid from BR is: 0x0000000000000000015d2109ec640a05
rcm version 0X30001
System Information:
   chip name: unknown
   chip id: 0x30 major: 1 minor: 3
   chip sku: 0x83
   chip uid: 0x0000000000000000015d2109ec640a05
   macrovision: disabled
   hdcp: enabled
   jtag: disabled
   sbk burned: true
   dk burned: true
   boot device: emmc
   operating mode: 3
   device config strap: 1
   device config fuse: 17
   sdram config strap: 0

sending file: ./bct/nexus_7_grouper_bct.bin
- 6128/6128 bytes sent
./bct/nexus_7_grouper_bct.bin sent successfully
downloading bootloader -- load address: 0x80108000 entry point: 0x80108000
sending file: ./bootloader/bootloader-grouper-4.23.img
- 2150992/2150992 bytes sent
./bootloader/bootloader-grouper-4.23.img sent successfully
waiting for bootloader to initialize
bootloader downloaded successfully

...and wondering if I can go to step 7?
Before reaching this step the tablet always had a blank black screen, and this is the first time in at least 4 years the screen appears 'alive'. It is going to be very satisfying to get it out of it's coma :D

Basically what I'm asking is can I run the command from step 7 at the Google Screen with unlocked padlock, or do I need to reboot the tablet?

Thanks again!

Ok disregard the above I carefully reviewed the process. However now after running the command (step 7) with nv3pserver to reflash bootloader:

smurfjet@ubuntu:~/tegra30_debrick$ sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --download EBT bootloader/bootloader-grouper-4.23.img --configfile ./utils/flash.cfg
[sudo] password for smurfjet: 
Nvflash v1.13.87205 started
[resume mode]
failed executing command 20 NvError 0x120002
Unable to retrieve Partition table from device NvError 0x0
command failure: partition not found in partition table (bad data)
bootloader status: partition table is required for this command (code: 8) message: nverror:0x5 (0x1000005) flags: 0

Looks like there is a corrupt partition table? If so, is this the end?
Running commands Through Ubuntu 18 in vmware on Win10.
...............................
Had some time to research more after posting the above - is the /utils/flash.cfg specific to 16GB vs 32GB nakasi?

@tofurky
Copy link
Owner

tofurky commented Apr 2, 2022

may be bad emmc :/ see #8

my suggestion there was to run the following in lieu of step 7: sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdeviceread 0 2048 mmc-0-2048.bin

that should fetch the BCT and partition table using raw emmc read commands. if it fails to fetch, it hints at a hardware issue. if it does fetch without error, it might be that the flash was erased somehow.

the flash.cfg is for 16GB, but i have not tried repartitioning a device using that. it's just to make nvflash happy (some of the commands require a .cfg to be provided, even though it's not otherwise used).

@Smurfjet
Copy link
Author

Smurfjet commented Apr 5, 2022

Thank you for the recommendation, I will see what can be done and if I can get my hands on a non VM Linux. Will report back.

@Smurfjet
Copy link
Author

Smurfjet commented Apr 6, 2022

Here is the result:

smurfjet@ubuntu:~/tegra30_debrick$ sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdeviceread 0 2048 mmc-0-2048.bin
Nvflash v1.13.87205 started
[resume mode]
failed executing command 31 NvError 0x120002
command failure: readdeviceraw failed (bad data)

This is from VM Linux. (haven't t had time to setup a USB bootable Linux yet but is on the to-do list).

End of the road or not yet? I can also get my hands on another working N7 in a week, will that help? (saw there is a method to revive bricked N7s using another working N7).

Thanks!

@tofurky
Copy link
Owner

tofurky commented Apr 6, 2022

i think the --rawdeviceread failing with readdeviceraw failed means emmc is toast :/

if emmc is bad then probably the other method using another n7 to generate a nvflash blob wouldn't help, but i'd be curious of the result regardless.

@Smurfjet
Copy link
Author

Smurfjet commented Apr 7, 2022

Agree. I'll attempt the other method as a hail mary and report back.

Would you know if the emmc replacement is plug and play or solder and burn fingers?

@tofurky
Copy link
Owner

tofurky commented Apr 7, 2022

it'd require soldering. it would also require somehow getting the correct filesystem/partitions onto the chip. see my reply here: #8 (comment)

@afliw
Copy link

afliw commented Jun 13, 2022

Hi @tofurky,

First, let me thank for this great work of yours.

I'm having a similar problem.

Every step goes as expected, but when I run the command from step 7:

sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --download EBT bootloader/bootloader-grouper-4.23.img --configfile ./utils/flash.cfg

I get this output:

vflash v1.13.87205 started
     [resume mode]
     sending file: bootloader/bootloader-grouper-4.23.img

And it just sits there doing nothing.

I ran the command you suggested:

sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdeviceread 0 2048 mmc-0-2048.bin

And it runs just fine. I attach to this posts the zip result of this command.

Is there anything that can be done to recover it or is it just bricked for good?

Thanks in advance!

mmc-0-2048.bin.gz

@tofurky
Copy link
Owner

tofurky commented Jun 14, 2022

@afliw at a glance the file you posted looks like it had an intact bct and bootloader, though the apparent partition layout doesn't quite line up with what i'd expect per https://github.com/tofurky/tegra30_debrick/blob/master/utils/flash.cfg

do you know how the tablet was originally bricked? and can you clarify the model #?

@afliw
Copy link

afliw commented Jun 14, 2022

Hey @tofurky, thanks for your answer and your time.

The table is a Nexus 7 32GB (grouper).

I bricked on 2014, trying to do something like this:
https://forum.xda-developers.com/t/tutorial-change-your-nexus-7-2012-files-system-to-f2fs.4096131/

If I recall correctly, I messed up some step and boom, bricked... 😅

I recently found the tablet lying around and though of try to bring it back. In 2014, the only way was with a previously saved blob as you know, and when I found your guide, well, I just had to try it.

I have tried with both configfiles, yours (16GB) and another one I've found for the 32GB version, but with no luck.

Every time I try to flash anything, it just get stuck. I can do rawdeviceread just fine, but it won't flash anything, just shows the Google logo (no battery low warning).

@tofurky
Copy link
Owner

tofurky commented Jun 14, 2022

were you able to boot into fastboot/recovery before running any of the nvflash commands in this repo? or was it booting directly to APX mode?

@afliw
Copy link

afliw commented Jun 14, 2022

No, can't boot into fastboot nor recovery.

If I connect it bare, I get this:

[72304.817352] usb 1-3: device descriptor read/64, error -110
[72310.193907] usb 1-3: device descriptor read/64, error -71
[72310.429705] usb 1-3: new high-speed USB device number 7 using xhci_hcd
[72315.570631] usb 1-3: device descriptor read/64, error -110
[72320.947092] usb 1-3: device descriptor read/64, error -71
[72321.055481] usb usb1-port3: attempt power cycle
[72321.467085] usb 1-3: new high-speed USB device number 8 using xhci_hcd
[72326.708061] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[72326.916265] usb 1-3: Device not responding to setup address.
[72327.124031] usb 1-3: device not accepting address 8, error -71
[72327.251831] usb 1-3: new high-speed USB device number 9 using xhci_hcd
[72332.340694] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[72332.548744] usb 1-3: Device not responding to setup address.
[72332.756484] usb 1-3: device not accepting address 9, error -71
[72332.756762] usb usb1-port3: unable to enumerate USB device

And keeps doing that.

When I pressed Vol Up + Power, I get the APX mode:

[72426.465205] usb 1-3: new high-speed USB device number 14 using xhci_hcd
[72426.625190] usb 1-3: New USB device found, idVendor=0955, idProduct=7330, bcdDevice= 1.03
[72426.625219] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[72426.625231] usb 1-3: Product: APX
[72426.625240] usb 1-3: Manufacturer: NVIDIA Corp.

When I ran the command 6 of your guide, I got the Google logo screen, which made me think maybe there's hope.
I even was able to run the 5th step in your guide (BCT backup) with no errors.

But no matter how much I try, can get step 7 to work... not with backed up BCT or the repo's one, --sync or no --sync, flash16 o flash32 config file, it just doesn't want to flash any image. Every time it gets stuck in "sending file".

@afliw
Copy link

afliw commented Jun 14, 2022

After several retries, it also has thrown this error:

> sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --download EBT bootloader/bootloader-grouper-4.23.img --configfile ./utils/flash32.cfg

Nvflash v1.13.87205 started
[resume mode]
failed executing command 20 NvError 0x120002
Unable to retrieve Partition table from device NvError 0x0
command failure: partition not found in partition table (bad data)
bootloader status: partition table is required for this command (code: 8) message: nverror:0x5 (0x1000005) flags: 0


@tofurky
Copy link
Owner

tofurky commented Jun 15, 2022

could you try these steps from a fresh power cycle into APX mode and post partitions.txt if it reads it?

sudo ./fusee-launcher/fusee-launcher.py ./payload/uart_payload_n7.bin -P 7330
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --setbct --bct ./bct/nexus_7_grouper_bct.bin --configfile ./utils/flash.cfg --bl ./bootloader/bootloader-grouper-4.23.img --go
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --getpartitiontable partitions.txt

i found a 32gb n7 nvflash cfg at https://www.mediafire.com/file/j90hc1dfz58aytq/flashcfg.zip (from https://forum.xda-developers.com/t/tutorial-how-to-unbrick-nexus-7-without-blob-bin-requires-another-nexus-7-2012.4083879/) and it matches up to what i see in the --rawdeviceread output you posted, but it seems like the LNX partition at that URL is too small (1MB).

anyways, my thought was taking a step from the the ouya debrick process (flashing 8MB of zeroes - dependent on the size of LNX) to get it to switch from nv3pserver mode to fastboot mode and trying to reflash it from there (fastboot flash bootloader). i do not know how the presence of f2fs data would cause nv3pserver mode to hang, though. uart output would for sure be the most useful diagnostic output to figure out where it's being hung up.

if for some odd reason it was f2fs data on other partitions causing the bootloader to bug out, you could use fastboot to erase them after doing the LNX zeroes trick.

assuming the f2fs data is causing an issue somehow, nvflash also has a --format_partition command (which i've not used) that might stand in for 'fastboot erase' if it's not possible to enter via the LNX trick.

@afliw
Copy link

afliw commented Jun 15, 2022

Ok, here's the partitions.txt file, the command ran just fine.

I'm seeing a difference. In this output, there's no RDO partition and yes, LNX size is different than the flash32.cfg file I was using (it's the same you pointed out in your post)

As I write this, I fixed the size of LNX partition in the flash32.cfg that you pointed out, replacing its size from 1Mb to 8Mb, and I used this command:

> sudo ./utils/nvflash_v1.13.87205 --resume --format_partition 8

Nvflash v1.13.87205 started
[resume mode]
Formatting partition 8 LNX please wait.. done!
failed executing command 26 NvError 0x120002
command failure: sync failed (bad data)
bootloader status: Bct Write Failed (code: 22) message: nverror:0x42008 (0x6042008) flags: 0

In dmesg I saw this:

[Tue Jun 14 23:25:31 2022] usb 1-3: USB disconnect, device number 43
[Tue Jun 14 23:25:31 2022] usb 1-3: new high-speed USB device number 44 using xhci_hcd
[Tue Jun 14 23:25:31 2022] usb 1-3: New USB device found, idVendor=18d1, idProduct=4e40, bcdDevice= 0.00
[Tue Jun 14 23:25:31 2022] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Tue Jun 14 23:25:31 2022] usb 1-3: Product: Android
[Tue Jun 14 23:25:31 2022] usb 1-3: Manufacturer: Google, Inc
[Tue Jun 14 23:25:31 2022] usb 1-3: SerialNumber: 015d2856b65c0015

Looks like it worked, now I can see the device in fastboot, also a "Start" button appeared in the screen above the Google logo.

I'm unsure what to do next, should I try to flash the full stock image or do I have to flash the bootloader first?

EDIT:

Tried flashing bootloader with no luck:

> fastboot flash bootloader bootloader/bootloader-grouper-4.23.img

Sending 'bootloader' (2100 KB)                     OKAY [  0.285s]
Writing 'bootloader'                               FAILED (remote: '(Unknown error code)')
fastboot: error: Command failed

😔

@tofurky
Copy link
Owner

tofurky commented Jun 15, 2022 via email

@tofurky
Copy link
Owner

tofurky commented Jun 16, 2022

running low on ideas here. can you provide the original BCT you hopefully backed up from the tablet before overwriting it with --sync?

i suppose it's worth a shot to try an older version of the grouper bootloader (rather than bootloader-grouper-4.23.img) but it's a shot in the dark.

could also try erasing the partitions you converted to f2fs. you could dump them with nvflash and examine the beginning of the partitions with a hex editor (e.g. xxd file.bin|less) to see if it has ext4 or f2fs magic bytes.

a possible last ditch effort would be to erase both the BCT and bootloader partitions and try to start fresh (rewrite bootloader + BCT in one go).

uart would be most useful to identify the issue, but it was really quite difficult to solder wires on there, it's very small solder pads.

@tofurky
Copy link
Owner

tofurky commented Jun 16, 2022

also, i was able to obtain a copy of a known-good 32G partition table, so if you provide a dump of PT i can check to see if it was somehow messed up.

sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --read PT PT.bin

@afliw
Copy link

afliw commented Jun 17, 2022

Me too, I've a tried a lot by now, with nvflash, fastboot, whelie and even managed to boot the flatline_grouper.img from fastboot and was able to use adb, but nothing seems to work from there either.

Here's the BCT_READBACK_N7.BIN.gz, but I'm pretty sure is useless, I think the first time I skipped step 5, sorry.

It occurred to me too to use an older bootloader, but got the same results.

What do you mean by erasing partitions? Format them? If that is the case, I have already formatted every partition that nvflash and fastboot have let me.

a possible last ditch effort would be to erase both the BCT and bootloader partitions and try to start fresh (rewrite bootloader + BCT in one go).

How would I have to proceed in that case?

uart would be most useful to identify the issue, but it was really quite difficult to solder wires on there, it's very small solder pads.

I'm sure it would, but it's way beyond my capabilities...

also, i was able to obtain a copy of a known-good 32G partition table, so if you provide a dump of PT i can check to see if it was somehow messed up.

I will post it as soon as I can, but now I'm seeing something that I didn't see before. I got the message battery is too low in the Google logo screen, and the terminal is stuck in waiting for bootloader to initialize.

@tofurky
Copy link
Owner

tofurky commented Jun 17, 2022

er, did you erase every partition? not all can be restored via android stock restore. others like PT (partition table) and GPT ("backup" gpt partition table at end of flash) should not be touched.

i've erased bct in the past with this, i wouldn't suggest doing it before verifying the integrity of your partition table though:

truncate -s 3145728 BCT_all_zeroes.bin
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdevicewrite 0 768 BCT_all_zeroes.bin

@afliw
Copy link

afliw commented Jun 17, 2022

Well, I did this:

> fastboot erase boot
> fastboot erase cache
> fastboot erase recovery
> fastboot erase system
> fastboot erase userdata

And also tried the --format_all command from nvflash, but I don't think it came to do anything...

Here is the PT.bin.gz I got from running:
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --read PT PT.bin

Is it possible that there's something physically wrong with it? I mean, some hardware fault?
Maybe it was just a coincidence that it got bricked just when I was trying the f2fs conversion... a huge coincidence...

@tofurky
Copy link
Owner

tofurky commented Jun 17, 2022

partition table looks correct. the one i compared it to was 3g i guess (had RDO radio partition, yours doesn't).

you could try a rawdevicewrite of zeroes to the EBT (bootloader) partition. if it fails, then yeah, probably a hardware issue.

note that rawdevicewrite is risky in general (relatively easy to get the wrong offset and nuke something you didn't mean to).

from the partitions.txt you provided:

PartitionId=4
Name=EBT
DeviceId=18
StartSector=896
NumSectors=1536
BytesPerSector=4096

this also matches up to what i get when running a utility to parse the PT.bin.gz you provided.

truncate -s 6291456 EBT_all_zeroes.bin
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdevicewrite 896 1536 EBT_all_zeroes.bin

@afliw
Copy link

afliw commented Jun 17, 2022

truncate -s 6291456 EBT_all_zeroes.bin
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdevicewrite 896 1536 EBT_all_zeroes.bin

I ran this command several times, sometimes it throws this error:

Nvflash v1.13.87205 started
[resume mode]
failed executing command 32 NvError 0x120002
command failure: writedeviceraw failed (bad data)

And sometimes it gets stuck with this:

Nvflash v1.13.87205 started
[resume mode]
sending file: EBT_all_zeroes.bin

I also tried this:

sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdeviceread 896 1536 EBT.bin
Nvflash v1.13.87205 started
[resume mode]
Bytes to receive 6291456
receiving file: EBT.bin, expected size: 6291456 bytes
/ 6291456/6291456 bytes received
file received successfully

Can you make anything of this?

Here's what was read: EBT.bin.gz

@tofurky
Copy link
Owner

tofurky commented Jun 17, 2022

it successfully overwrote EBT with zeroes per the EBT.bin.gz.

but no, i can't make sense of it. i suppose the inconsistent success/failure could hint at a usb signal integrity issue (try a different cable?).

did you try re-writing the bootloader after zeroing out the EBT partition?

if that still fails, you could try the last ditch effort of wiping BCT+EBT:

truncate -s 6291456 EBT_all_zeroes.bin
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdevicewrite 896 1536 EBT_all_zeroes.bin
truncate -s 3145728 BCT_all_zeroes.bin
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdevicewrite 0 768 BCT_all_zeroes.bin

then power cycle the tablet (it should boot straight to APX without coercing) and go through the steps, making sure to use the --sync option where applicable

@afliw
Copy link

afliw commented Jun 21, 2022

Sorry for the delay, hadn't had time to try your suggestions.

Regrettably, it didn't work. Trying to flash all zeros in the BCT partition works normally, but not with the EBT, same problem as before. Every time I try to do some write operation with (or format) the EBT partition, it fails.

Also tried with 4 different cables, same results with each of them... 😔

Is it possible that the EBT partition is broken for writing but not for reading? Is it possible to repartition and move the EBT to another sector?

@tofurky
Copy link
Owner

tofurky commented Jun 24, 2022

i've not tried repartioning. i do not know if it would work with the patched nvflash.

i was under the impression that you were able to successfully write the EBT partition with --rawdevicewrite - the readback showed all zeroes. you could try again with a file filled with a pattern - e.g.

perl -e 'print("\xAA" x 6291456)' > EBT_all_AA.bin
sudo ./utils/nvflash_v1.13.87205_miniloader_patched --resume --rawdevicewrite 896 1536 EBT_all_AA.bin

then read it back. the resulting file should do this if read back successfully:

matt@aquos:~$ hexdump EBT.bin
0000000 aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
*
0600000

anyways, i'm unfortunately not sure what the issue might be. i suppose it could be misbehaving emmc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants