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

Idea to restore partition table #15

Open
philicibine opened this issue Jun 2, 2024 · 13 comments
Open

Idea to restore partition table #15

philicibine opened this issue Jun 2, 2024 · 13 comments

Comments

@philicibine
Copy link

Hi

I am currently stuck in the same position as some others here. Without a partition table and unable to progress. But I had an idea. I can get rawdevicewrite to work with nvflash so maybe I could write the whole emmc and progress further. I am wondering if anyone watching this repository could run "adb pull /dev/block/mmcblk0 emmc.bin" for me?

Thanks in advance

@philicibine
Copy link
Author

So, finally made progress on this! I made a custom u-boot for my device and it boots into the boot menu!! Now what i need is the original partition layout, with sizes and names because u-boot has mounted my internal storage so my linux machine and gparted can see it.

Can anyone help with the above? Im googling myself but info is sporadic!

@tofurky
Copy link
Owner

tofurky commented Jun 4, 2024

what device/model/size is it?

@philicibine
Copy link
Author

philicibine commented Jun 4, 2024

So, more progress. I found a PT.img (attached) and flashed it with --rawdevicewrite and it was enough to allow the bootloader to be written and to boot. From there I am now able to "fastboot boot" twrp. But it still cant mount internal storage. I still need the full partition layout.

pt.tar.gz

I should add.. I have adb pushed a working version of parted to /sbin and can create / modify partitions

@philicibine
Copy link
Author

what device/model/size is it?

It is n7 2012 16gb

@tofurky
Copy link
Owner

tofurky commented Jun 4, 2024

https://github.com/tofurky/tegra30_debrick/blob/master/utils/flash.cfg

i think --create can do it, but i'm not sure of the specifics.

$ utils/nvflash_v1.13.87205 --cmdhelp --create
Nvflash v1.13.87205 started

--create command usage ->
nvflash --bct <bct> --setbct --configfile <cfg> --create --odmdata <N> --bl <bootloader> --go
-----------------------------------------------------------------------
used to do full initialization of the target device using the config file
cfg start from creating all partitions, formatting them all, download
images to their respective partitions and syncing bct at end
-----------------------------------------------------------------------

bad odmdata can cause issues with nvflash communication.

@philicibine
Copy link
Author

I have previously tried --create. But that was before successfully flashing PT.bin. So will try again.

Where could I get the odmdata?

@tofurky
Copy link
Owner

tofurky commented Jun 4, 2024

matt@aquos:~/devel/ouya/tegra30_debrick/bct$ bct_dump nexus_7_grouper_bct.bin|grep -i odm
OdmData       = 0x40000000;

@philicibine
Copy link
Author

philicibine commented Jun 4, 2024

nvflash just hangs with the above. Shame. i'm a step further tho at least.

I also looked at using parted to set the partitions, but in the flash.cfg file it mentions about "basic" filesystems for some of them... not sure how to do this in parted as it lists ext* fat* etc

@philicibine
Copy link
Author

tried power cycling and it says setbct failed

@pgwipeout
Copy link

pgwipeout commented Jun 4, 2024 via email

@philicibine
Copy link
Author

philicibine commented Jun 5, 2024

U-boot did write succesfully. I used the guide here for writing it. Only thing required to build is your sbk. I guess if all else fails I can put some form of linux on it. I tried to write postmarketos, but it needs extlinux.conf to boot. Will take some figuring out. u-boot was definitely persistent tho.

edit: found this guide to install pmos. Will try later after work.

@philicibine
Copy link
Author

philicibine commented Jun 5, 2024

I got it to boot fully with PMos!! It was a generic tegra build though, so currently rebuilding one thats more up to date.

Happy with that! The device was only a display for my solar system. Dashboard type thing. So long as chromium installs it'll do fine!

@tofurky
Copy link
Owner

tofurky commented Jun 5, 2024

I also looked at using parted to set the partitions, but in the flash.cfg file it mentions about "basic" filesystems for some of them... not sure how to do this in parted as it lists ext* fat* etc

seems like you're OK with u-boot/pmos so it shouldn't matter, but there are 2 partition tables on the device:

  • nvidia partition table
  • "protective" gpt which is used by linux

nvflash miniloader/fastboot use the nvidia partition table, and in linux, i think it was using (or at least aware of) the gpt stored towards the end of the disk. there was a kernel cmdline parameter added to give the gpt location.

from flash.cfg:

[partition]
name=GPT
id=16
type=GPT
allocation_policy=sequential
filesystem_type=basic
size=0xFFFFFFFFFFFFFFFF
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

so i guess for a full restore to stock, you'd need to both rewrite the nvidia partition table, AND restore the contents of the GPT partition.

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