tofurky / tegra30_debrick

fusee-gelee payload, supporting files, and guide for debricking Tegra 3 devices (2012 Nexus 7 and Ouya)
GNU General Public License v2.0
42 stars 15 forks source link

Bootloader not initializing -- No EFI system partition #16

Open greggoryrussell opened 1 month ago

greggoryrussell commented 1 month ago

Hello,

I'm attempting to flash UBoot onto my Nexus 7 (2012 / Grouper). Ultimately, my goal is to flash PostMarketOS onto it. One of the requirements for that is to flash uboot onto it.

This is what I see on my Ubuntu laptop when I attempt to flash my u-boot image to the device

sudo ./run_bootloader.sh -s T30 -t ./bct/grouper.bct -b u-boot-dtb-tegra.bin

Important note: on desktop Linux systems, we currently require an XHCI host controller.
A good way to ensure you're likely using an XHCI backend is to plug your
device into a blue 'USB 3' port.

Identified a Linux system; setting up the appropriate backend.
Detected a T30 SoC
VendorID=0x955 & ProductID=0x7330
Found a Tegra with Device ID: 0bea1fa409215d01
Uploading payload...
Smashing the stack...
The USB device stopped responding-- sure smells like we've smashed its stack. :)
Launch complete!
Nvflash v1.13.87205 started
chip uid from BR is: 0x0000000000000000015d2109a41fea0b
rcm version 0X30001
System Information:
   chip name: unknown
   chip id: 0x30 major: 1 minor: 3
   chip sku: 0x83
   chip uid: 0x0000000000000000015d2109a41fea0b
   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/grouper.bct
- 6128/6128 bytes sent
./bct/grouper.bct sent successfully
downloading bootloader -- load address: 0x80108000 entry point: 0x80108000
sending file: u-boot-dtb-tegra.bin
/ 742197/742197 bytes sent
u-boot-dtb-tegra.bin sent successfully
waiting for bootloader to initialize
usb read error (71): Protocol error
bootloader failed NvError 0x0
command failure: bootloader download failed

Right before the usb read error happens, the tablet flashes the following text on screen before turning off. I had to take a picture of it with my phone to read it:

Net:    No ethernet found.

Autoboot in 0 seconds
No EFI system partition
No EFI system partition
Failed to persist EFI variables
Bus usb@7d000000: USB EHCI 1.00
scanning bus usb@7d000000 for devices... 1 USB Device(s) found
No ethernet found.
No ethernet found.
poweroff ...

Have you ran into this issue before? Do you have any advice on how to add and structure EFI partitions onto the tablet?

And I can also confirm that it seems to be fine at a hardware level. I've managed to do the following without issue:

Any advice would be appreciated.

Thanks.

-Gregg

greggoryrussell commented 1 month ago

Another question comes to mind, Is it complaining there's no EFI partition found in the boot image? Or is it expecting the tablet to have an EFI partition?

tofurky commented 1 month ago

so i've not tried u-boot on it, but on the tegra3 devices gpt isn't at the start of the disk, just towards the end i believe. unsure if u-boot can be coerced into looking there.

what is run_bootloader.sh?

its not normal for u-boot to poweroff automatically i think, normally it will enter a cli prompt awaiting a boot cmd if it can't boot. maybe see if the default environment is doing something weird if it can't run the bootcmd? https://docs.u-boot.org/en/latest/board/asus/grouper_common.html#boot shows it looking for extlinux.conf in emmc. maybe it expects to be flashed; there are instructions in this repo for how to fastboot flash boot to upload a new bootloader, dunno if it works for u-boot though.

the error you see after uploading u-boot would be expected; nvflash is trying to communicate with the uploaded code using nv3pserver protocol which doesn't exist in u-boot, only the tegra fastboot.

if you build u-boot yourself you could enable both a preset environment (e.g. enter fastboot mode by default) or try enabling usb console (unsure if it'd work on tegra). maybe a usb keyboard via otg could work as well.

greggoryrussell commented 1 month ago

My apologies about run_bootloader.sh, that's from another repo (https://gitlab.com/grate-driver/fusee-tools/-/blob/master/run_bootloader.sh?ref_type=heads), I had gotten it mixed up with yours, as both repo's have fusee-launcher submodule in them.

The bootloader script basically runs these commands

./fusee-launcher-new/fusee-launcher.py ./payloads/out/"$gen"/patch_irom.bin

sleep 1

./utils/"$nvflash" --setbct --bct "$bct" --configfile ./utils/flash.cfg --bl "$bootloader" --go

As for extlinux.conf, it doesn't exist on the tablet, per a find command in adb shell.

And how would I build uboot to put it into fastboot mode? Is there a flag I'd need to pass it? And by the USB console, do you mean enabling UART output?

tofurky commented 1 month ago

ah, yeah that repo - they took code from here without attribution and relicensed it 🤔

i was using postmarketos on the ouya for a few years and it worked fine via fastboot (albeit with a kexec chainloader, iirc). i checked an old revision of the postmarketos wiki page: https://wiki.postmarketos.org/index.php?title=Google_Nexus_7_2012_(asus-grouper)&oldid=41047

it actually has flash instructions. i don't think u-boot is required.