Jump to content


Photo

Q&A regarding gellmar's notes on E400 development

- - - - -

  • Please log in to reply
85 replies to this topic

#21
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, thanks - but looks like mine and yours are identical. It means that MBR (the first part) is identical as expected and where is EBR - I need to reveal. Think we need an sfdisk command line tool to handle re-partitioning with partition lists from within script.

UPDATE: Grab file sfdisk from https://github.com/o...-arm/bin/sfdisk (it is a stripped static build for armv7l), place it to /system/bin/, assign 755 permissions and as root run:

/system/bin/sfdisk -d /dev/block/mmcblk0 > /sdcard/mmcblk0_stock.txt

and post a zipped file here.

The best bet of sfdisk is that we can dump and restore the partition table in command-line with

sfdisk -d /dev/block/mmcblk0 > mmcblk0_merge.txt

and

cat mmcblk0_merge.txt > sfdisk /dev/block/mmcblk0

Edited by gellmar, 15 March 2013 - 01:47 PM.

  • 0

#22
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
Try this, i don't have the phone here.

echo "l \n q \n" | fdisk /dev/block/mmcblk0

  • 0
There is no place like 127.0.0.1

#23
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
It works, but fdisk does not allow to set non cylinder-boundary layout... So I guess we need a rooted but stock phone or at least a phone with recovery installed.

UPDATE: Stock KDZ reflasher rewrites partition table back so we can revert the mod by KDZ or from recovery if we have a full dump.

Edited by gellmar, 14 March 2013 - 10:18 PM.

  • 0

#24
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

It works, but fdisk does not allow to set non cylinder-boundary layout... So I guess we need a rooted but stock phone or at least a phone with recovery installed.


Don't worry as i said this morning i rooted my girlfriend's phone and i gave you the mbr. Tomorrow you will have the stock partition layout. Using fdisk you could check in the install script if the device already has correct partition layout by counting the number of partitons. Maybe another user could do the same job if youre free to work now, if not we will have to wait until i see her.

  • 0
There is no place like 127.0.0.1

#25
hecatae

hecatae

    Hardcore

  • Moderator Team
  • PipPipPipPipPipPip
  • 3,195 posts
  • Gender:Male
  • Location:northampton
  • Devices:Samsung i9305
  • Twitter:@meritez
what do you need, and where do you need it?

anyone else seen the output if you
adb reboot bootloader


  • 0

#26
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
hecatae, I wrote the output of fastboot in updated post in notes... and reflashed KDZ stock and my partitions gone and now it is stock unrooted. Performed root, installed CWM, going to install cyanogenmod and then make a dump myself. The progress on dumping and instructions will be posted separately in notes thread.

What is it all for? We can make a full flash dump for cyanogenmod with normal and merge partitions, and write a script that will write its contents just like KDZ reflasher performs. Sounds great, isn't it? Assuming we use gzip and the /data and /sdcardpartitions are zeroed, the dump size should not excess 500 MB and will be quite flashable from CWM adb or script from inside zip.

PS: crazybyte, don't brick your GF's phone, or I am afraid of your relations :D

Edited by gellmar, 14 March 2013 - 10:33 PM.

  • 0

#27
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

It works, but fdisk does not allow to set non cylinder-boundary layout... So I guess we need a rooted but stock phone or at least a phone with recovery installed.

UPDATE: Stock KDZ reflasher rewrites partition table back so we can revert the mod by KDZ or from recovery if we have a full dump.


I tougth you already know this! KDZ reflash all the nand :D

what do you need, and where do you need it?

anyone else seen the output if you

adb reboot bootloader


gellmar needs:

sfdisk -d /dev/block/mmcblk0 > mmcblk0_merge.txt

I think that our phone don't have a proper bootloader mode.

  • 0
There is no place like 127.0.0.1

#28
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

hecatae, I wrote the output of fastboot in updated post in notes... and reflashed KDZ stock and my partitions gone and now it is stock unrooted. Performed root, installed CWM, going to install cyanogenmod and then make a dump myself. The progress on dumping and instructions will be posted separately in notes thread.

What is it all for? We can make a full flash dump for cyanogenmod with normal and merge partitions, and write a script that will write its contents just like KDZ reflasher performs. Sounds great, isn't it? Assuming we use gzip and the /data and /sdcardpartitions are zeroed, the dump size should not excess 500 MB and will be quite flashable from CWM adb or script from inside zip.


I think that it's a very dirty solution. It breaks the upgradeability of the rom! I think that sfdisk + mke2fs/mkfs.vfat it's the key to go!

  • 0
There is no place like 127.0.0.1

#29
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, I actually knew but.... you see, normal mode is slightly different from our.... hum... experiments :) So I was anxious about it, but I am glad to see exactly KDZ operates as it *should*.


I think that it's a very dirty solution. It breaks the upgradeability of the rom! I think that sfdisk + mke2fs/mkfs.vfat it's the key to go!


You are right, I have to admit.

Weird... now got dump with CWM adb shell :)

Great,,, really great... forcing the partition layout with sfdisk brought emergency mode on reboot. Blame.

Edited by gellmar, 14 March 2013 - 10:54 PM.

  • 0

#30
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

crazybyte, I actually knew but.... you see, normal mode is slightly different from our.... hum... experiments :) So I was anxious about it, but I am glad to see exactly KDZ operates as it *should*.




You are right, I have to admit. But, sfdisk does not work well with CWM recovery :( It works from within Cyanogenmod - exactly where I got the dump, but not inside CWM. I guess that build is not fully static.

I will focus on fixing this. I don't have the LG here but i can try in my GNexus. Maybe downloading the sources and crosscompiling will be enough. It was removed from android busybox long ago:

https://code.google....58fa529ecf1db34
* Removed sfdisk from BusyBox. It was buggy, fat, and we really couldn't maintain it very well, so including it was not really very appropriate. Those wanting an fdisk are invited to grab a copy from util-linux.


Also i will investigate why fdisk can't work as should.

Edited by crazybyte, 14 March 2013 - 10:52 PM.

  • 0
There is no place like 127.0.0.1

#31
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, the false positive... the build IS static, that was my fault but first sfdisk claimed the device is in use - re-partitioning is bad idea. I forced, and on reboot I got a yellow emergency. I just reflashed the stock again, and want going to bed. It is 1am in here, and it looks like we should rely on fdisk as the only reliable solution that works.

  • 0

#32
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

PS: crazybyte, don't brick your GF's phone, or I am afraid of your relations :D


I'm true lover. Often boyfrends give presents like roses to their girlfriends, as i'm a "little bit" geek i prefeer to give gigabytes .


crazybyte, the false positive... the build IS static, that was my fault but first sfdisk claimed the device is in use - re-partitioning is bad idea. I forced, and on reboot I got a yellow emergency. I just reflashed the stock again, and want going to bed. It is 1am in here, and it looks like we should rely on fdisk as the only reliable solution that works.


Sure, here it's midnight. So.. forget sfdisk, i will try to do with a fdisk script. Another option (the easy one) it's a "KDZ-like" first install. Then use normal zips that check the number of partitions before they try to install on the device! :)

Edited by crazybyte, 14 March 2013 - 11:05 PM.

  • 0
There is no place like 127.0.0.1

#33
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
sfdisk broke my baseband... no service / security error, so don't try to use it! In process of reviving now.

  • 0

#34
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

sfdisk broke my baseband... no service / security error, so don't try to use it! In process of reviving now.


s***. Hum does you need any kind of dump of my girlfriend phone? I think that KDZ maybe upgrades baseband, and maybe you can revive it. Anyway if you RMA it, i think that they could revive it using jtag.

  • 0
There is no place like 127.0.0.1

#35
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
Well till Wednesday the phone is on JTAG. I will compile custom kernel though for Suxsem's fans with my patches. And I want you crazybyte to implement a scripting feature in fdisk / busybox. That is simple - instead of fread from console in loop read from file.

I was able to get dump from baseband before RMA and it looks like sfdisk has overwritten the baseband ID header. fdisk runs fine :) So it is purely an sfdisk clause.

Edited by gellmar, 16 March 2013 - 03:01 PM.

  • 0

#36
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
I missunderstud do you want to modify the fdisk source? we could do the same easier with pipes, but if you want i will try to add this feature :)

  • 0
There is no place like 127.0.0.1

#37
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
If you can do it with pipes - even better. I could not.

  • 0

#38
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
As usual i will try to do this tonight. Pipes is esentially what do you want to do.

Based on my example this list the partition table and then exit.

echo -e "p\nq\n" | fdisk /dev/block/mmcblk0


If you add this you will delete the two problematic partitions and then it'll show the changes without writting to the fs:
echo -e "p\nd\n20\nd\n20\np\nq\n" | fdisk /dev/block/mmcblk0


Now we want to create the new partitions, in Linux fdisk we have to input this:
New partition (n) -> First Sector (regarding your fdisk output) 84482 -> Last Sector 236032, And we have to sort the partition in the disk according to the sector: Expert Mode (e) -> Fix (f)

This code removes the two partitions and makes the new one. This code is SAFE, because don't write changes to FS (only prints results), insert the write flag (w\n) before exit (q\n) for write into the disk.
echo -e "p\nd\n20\nd\n20\nn\n84482\n236032\nx\nf\nr\np\nq\n" | fdisk /dev/block/mmcblk0

Edited by crazybyte, 17 March 2013 - 02:48 PM.

  • 1
There is no place like 127.0.0.1

#39
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, going to get my phone back today. Your script also has to recreate two following Linux partitions, right?

  • 0

#40
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

crazybyte, going to get my phone back today. Your script also has to recreate two following Linux partitions, right?


Print original partition table, remove join the two partitions and prints the new partition table.
echo -e "p\nd\n20\nd\n20\nn\n84482\n236032\nx\nf\nr\np\nq\n" | fdisk /dev/block/mmcblk0


Print modified partition table, remove the new big partition, recreates the two original partitions, then should print the original partition map.
echo -e "p\nd\n20\nn\n84482\n215552\nn\n215553\n236032\nx\nf\nr\nt\n20\n83\nt\n21\n83\np\nq\n" | fdisk /dev/block/mmcblk0

None of this commands writes changes into the disk, it's only for debugging and see results. After you check the results i will write the final commands. The second one is untested, because i don't have here my phone, check the results by yourself please.

  • 0
There is no place like 127.0.0.1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users