What is the boot process on the Minix Neo x5/x7? And the file partitions? - Android Q&A, Help & Troubleshooting

What is the boot process used on the Minix Neo x5/x7? And what are the formats/contents of each NAND (aka ROM) partitions?
Code:
misc /dev/block/mtdblock0 4194304
kernel /dev/block/mtdblock1 8388608
boot /dev/block/mtdblock2 16777216
recovery /dev/block/mtdblock3 16777216
backup /dev/block/mtdblock4 402653184
cache /dev/block/mtdblock5 134217728 - /cache 126M ext4
userdata /dev/block/mtdblock6 4294967296 - /data 3.9G ext4
kpanic /dev/block/mtdblock7 4194304
system /dev/block/mtdblock8 536870912 - /system 511M ext4
user /dev/block/mtdblock9 11010048000- /mnt/sdcard 10.2G
What is the boot process for the Minix Android sticks and boxes? I want to know so I can understand/manipulate the configuration. I know that people to make up new 'rom's for the systems know how to produce these '.img's, but I haven't seen it documented for those who want to get in on the act. I know how this is done on some other Linux installations, but want to know how Minix does it for their Android system.
I can see that the 'system', 'cache', 'userdata' and 'user' are normal linux filesystems that can been seen by mounting them. I assume 'boot' is some compressed bootloader code -- perhaps not the usual Android bootloader. 'kernel' is the, perhaps compressed, binary executable for the kernel that must be loaded and executed? 'recovery' seems to be uncompressed (ie you can see meaningful strings in it) -- I thought it might be a duplicate (backup) of 'boot', but its not. 'backup' seems to be uncompressed as well. No clue what 'misc' has.
I assume that on power up, some real ROM (R/O memory) loads (and decompresses?) some code from the 'boot' partition and that code loads the kernel and some root filesystem and starts things up. I know what the /init program in Android does (reading the /init.rc and other files) and mounting other file systems etc.
Can anyone share a link to the source code, or a replacement build for the NAND partition images (ie ROM .img) so I can see what it does?

System is the ROM. Misc stores all kinds of settings. As for the code.... Visit source.android.com
Sent from my Nexus 4 using Tapatalk

Hi,
I would like to know the android boot process too.
I need to replace the splash boot logo but i am not sure where to find it in the boot process

Related

[Q] Corrupt GPT?

I think after running wrong exit_recovery.zip, I managed to trash partition table/GPT - or some other combination of stupidity - hoping someone can help..
CWM Recovery Log
Starting recovery on Mon Jun 25 21:11:17 2012
can't open /dev/tty0: No such file or directory
framebuffer: fd 3 (1280 x 800)
ClockworkMod Recovery v5.8.2.0
recovery filesystem table
=========================
0 /tmp ramdisk (null) (null) 0
1 /system ext4 /dev/block/mmcblk0p1 (null) 0
2 /cache ext4 /dev/block/mmcblk0p2 (null) 0
3 /misc emmc /dev/block/mmcblk0p3 (null) 0
4 /staging ext3 /dev/block/mmcblk0p4 (null) 0
5 /data ext4 /dev/block/mmcblk0p8 (null) 0
6 /boot emmc /dev/block/mmcblk0p10 (null) 0
7 /recovery emmc /dev/block/mmcblk0p9 (null) 0
W:Unable to get recovery.fstab info for /datadata during fstab generation!
W:Unable to get recovery.fstab info for /emmc during fstab generation!
W:Unable to get recovery.fstab info for /sdcard during fstab generation!
W:Unable to get recovery.fstab info for /sd-ext during fstab generation!
I:Completed outputting fstab.
Irocessing arguments.
...
[recovery session] Fdisk
/tmp # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 63.5 GB, 63577260032 bytes
4 heads, 16 sectors/track, 1940224 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk /dev/block/mmcblk0 doesn't contain a valid partition table
[recovery session] Parted
/tmp # ./parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Error: /dev/block/mmcblk0: unrecognised disk label
Hypothesis
By doing exit recovery opt 1a http://forum.xda-developers.com/showthread.php?t=1514088 I was able to bring up the virtuousprime ROM boot, but virtuous failed (reboot) after trying to format /data.
I dd'd the first 8096 bytes of mmcblk0 and they are all zeros?
From CWM, I am able to mount partitions mmcblk0p1, mmcblk0p3, mmcblk0p5.
So from all that, I am thinking I need to flash MBR, replace GPT on LBA 1? If this is correct, does anyone have a stock GPT for the tf201?
I can then format /data (mmcblk0p8) and I think my ROMs will then work.
kind regs,
Based on the information here: https:// en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_.28LBA_1.29, replacing LBA 1 will only fix the GPT header. Since you said that the first 8096 bytes were all zeros, it would seem that those would fall into LBA 2, 3, etc., corrupting the partition table.
But since you said that CWM can mount your partitions, you might be able to use GPT fdisk's recovery features to fix the problem. I don't know if anyone has compiled it for Android though Please note that the regular fdisk cannot handle GPT, only MBR.
When you said "flash MBR", what exactly do you mean? GPT and MBR are two different partition structures and if you replace either one with the other, the partition table will be lost and you won't be able to mount any partition.
Was thinking about building LBA0 and LBA 1 separately, was going from that Wikipedia article, "...Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1.." and I thought - perhaps naively - that an fdisk command with /mbr option would sort out LBA0, then I worry about GPT in LBA1, but maybe I am confusing fdisk /mbr option with another command (old DOS)?
I have all the partition offsets and disk size from backup (/sys/devices/platform/sdhci-tegra.3/mmc_host/mmc0/mmc0:0001/block/mmcblk0/..) and know what the partition table should look like; there was no "Partition 9", I made this up because there was 1024 unaccounted bytes after mmcblk0p8 (/data) ends:
Disk size: 1241744336 bytes
Partition 1 (/system): start 74752; End 1123328; Size 1048576
Partition 2 (/cache): start 1123328; End 1999872; Size 876544
Partition 3 (/misc): start 1999872; End 2003968; Size 4096
Partition 4 (/staging): start 2003968; End 3096576; Size 1092608
Partition 5 (/btmac): start 3096576; End 3106816; Size 10240
Partition 6 (/?): start 3106816; End 3107840; Size 1024
Partition 7 (/?): start 3107840; End 3118080; Size 10240
Partition 8 (/data): start 3118080; End 124173312; Size 121055232
Partition 9: start 124173312; End 124174336; Size 1024
Given that /system mounts, I think if I had a stock dump from a tf201 of bytes 0-74752 might also be an alternative - I could verify the GPT table against above before I put it in.
Another option I can think of, comes from reference I see to a "backup GPT" held in last sector of GPT disks? If you look at partition offsets above, there is 1024 bytes at the end where I may get this information - but I think injecting in a dump of those first 74k bytes into mmcblk0 - as above - would be safer.
damonbrisbane said:
Was thinking about building LBA0 and LBA 1 separately, was going from that Wikipedia article, "...Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1.." and I thought - perhaps naively - that an fdisk command with /mbr option would sort out LBA0, then I worry about GPT in LBA1, but maybe I am confusing fdisk /mbr option with another command (old DOS)?
Click to expand...
Click to collapse
I wouldn't suggest doing that. That would create a hybrid MBR. When a hybrid MBR disk is read using MBR, only the first four partitions can be visible (after redefining the partition table in LBA0). If the disk is read using GPT, all the partitions will be visible. I don't know if Android and Linux prefer MBR over GPT, but if they do, you might lose access to partitions 5-8.
By the way, the '/mbr' option is for the diskpart tool from MSDOS and Windows
damonbrisbane said:
Another option I can think of, comes from reference I see to a "backup GPT" held in last sector of GPT disks? If you look at partition offsets above, there is 1024 bytes at the end where I may get this information - but I think injecting in a dump of those first 74k bytes into mmcblk0 - as above - would be safer.
Click to expand...
Click to collapse
You're absolutely right. I had forgotten about this. Do you happen to know if those mmcblk0p# partitions are visible when the tablet is plugged into a Linux computer? If so, GPT fdisk can restore the partition table and GPT header from the backup GPT.
You would run something like this to restore the backup GPT:
http://paste.kde.org/488054/
EDIT: I found a version of gdisk compiled for Android by meghd00t (http://forum.xda-developers.com/showpost.php?p=24805392&postcount=74). You may be able to restore the backup GPT directly from the tablet
Download link from the post: http://dl.dropbox.com/u/64885133/gptfdisk.zip
Thanks Chen, i plan to try the gptfdisk tonight when I get home from work and can post the result.
One thing i'm not sure about is access mmcblk0 from linux - does this mean I can access the internal mmcblk0 of the tf201 directly through a linux device? Right now I access mmcblk0 solely through adb shell to CWM recovery.
damonbrisbane said:
Thanks Chen, i plan to try the gptfdisk tonight when I get home from work and can post the result.
One thing i'm not sure about is access mmcblk0 from linux - does this mean I can access the internal mmcblk0 of the tf201 directly through a linux device? Right now I access mmcblk0 solely through adb shell to CWM recovery.
Click to expand...
Click to collapse
No problem There's also an option to backup the GPT header and partition table to file. I'd suggest doing that just in case anything goes wrong.
I'm not entirely sure if the internal memory can be accessed directly from Linux. But from what I've been reading in the forums today, it seems that it might not possible (I'm pretty new to Android).
Hopefully gptfdisk will work via adb shell
Whew, we're off life support! and more importantly - my wife wont kill me for an Unauthorised Brick to The Birthday Device
Steps Performed
ADB - Write backup GPT to LBA1 mmcblk0
~ # ./gdisk /dev/block/mmcblk0
GPT fdisk (gdisk) version 0.8.4
Unsupported GPT version in backup header; read 0x00000000, should be
0x00010000
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): r
Recovery/transformation command (? for help): ?
b use backup GPT header (rebuilding main)
c load backup partition table from disk (rebuilding main)
…
? b
Recovery/transformation command (? for help):
? c
Warning! This will probably do weird things if you've converted an MBR to
GPT form and haven't yet saved the GPT! Proceed? (Y/N): Y
Caution! After loading partitions, the CRC doesn't check out!
Recovery/transformation command (? for help): p
Disk /dev/block/mmcblk0: 124174336 sectors, 59.2 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2E8491CC-AFFC-43B9-B1C4-97D2F258BE1C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 124174302
Partitions will be aligned on 2048-sector boundaries
Total free space is 75709 sectors (37.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 74752 1123327 512.0 MiB 0700 AP
2 1123328 1999871 428.0 MiB 0700 CC
3 1999872 2003967 2.0 MiB 0700 MC
4 2003968 3096575 533.5 MiB 0700 UP
5 3096576 3106815 5.0 MiB 0700 PR
6 3106816 3107839 512.0 KiB 0700 YU
7 3107840 3118079 5.0 MiB 0700 CA
8 3118080 124173311 57.7 GiB 0700 UA
Recovery/transformation command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/block/mmcblk0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
~ #
ADB/CWM - Exit recovery and attempt Virtuousprime ROM install
I then did exit recovery as per 1a http://forum.xda-developers.com/showthread.php?t=1514088
Upon reboot Virtuousprime wouldn't go as far as it got before. I went back into adb shell and did wipe data:
Wipe data/factory reset
Formatting /data
Error mounting /data !
Skipping format...
Formatting /cache
Formatting /sd-ext
Formatting /sdcard/.android_secure...
Error mounting /sdcard/.android_secure!
Skipping format...
Data wipe complete
Note the error on /data. Could not format /data either using the CWM mounts and storage menu. I named the partitions I knew about and formatted /data (mmcblk0p8) from adb shell:
Number Start End Size File system Name Flags
1 38.3MB 575MB 537MB ext4 system
2 575MB 1024MB 449MB ext4 cache
3 1024MB 1026MB 2097kB misc
4 1026MB 1585MB 559MB ext3 staging
5 1585MB 1591MB 5243kB fat32 btmac
...
8 1596MB 63.6GB 62.0GB ext4 data
mke2fs -t ext4 /dev/block/mmcblk0p8
I then found that CWM data/factory reset went through without errors:
Wipe data/factory reset
Formatting /data
Formatting /cache
..
Data wipe complete
And subsequently exit recovery and virtuous prime rom have installed OK, tested across reboot and shutdown
Cheers!
damonbrisbane said:
Whew, we're off life support! and more importantly - my wife wont kill me for an Unauthorised Brick to The Birthday Device
Click to expand...
Click to collapse
Haha, I'm glad I was able to help

Samsung GT-i8160 reboots every 2 minutes - kernel doesnt format internal filesystems

Hi all,
I have taken a look at the threads that are similar to mine, as the forum suggests, and a lot more for about a week now.
I have not managed to solve my problem yet, I hope you will help to find a solution.
I own a Samsung Ace 2 GT-i8160.
A month ago a decided to change the stock rom and flashed my phone with a CM11 rom.
Everything worked perfectly.
However suddenly my phone has started rebooting by itself.
Every 2 or 3 minutes it reboots automatically. In fact is switches off and starts over again, it does not perform a software reboot.
I have tried these:
I have tried to use another battery, my wife owns the same mobile and we switched batteries.
I have tried to install the stock rom. The whole process seems to be perfect but when the phone reboots, everything is just like before the install. The phone boots into the old CM11 and reboots repeatedly every 2 minutes!
I have tried to install the CM12 rom. Now the setup seems to succedd again. However the phone again enters the old CM11 and reboots every 2 minutes. However now, there is this warning: symlink: some symlinks failed
I have tried to install the CM11 rom again. The whole process seems to be perfect but when the phone reboots, everything is just like before the install.
I try to format every partition (except for the external sdcard) and no error comes up. If i mount the partitions everything is in place! Nothing has been deleted!
I tried to format the /data partition with this command from adb shell:
Code:
mke2fs -t ext4 -c -v /dev/block/mmcblk0p5
Here is the output of the command:
Code:
mke2fs 1.41.14 (22-Dec-2010)
fs_types for mke2fs.conf resolution: 'ext4'
Calling BLKDISCARD from 0 to 1308622848 failed.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
80000 inodes, 319488 blocks
15974 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=327155712
10 block groups
32768 blocks per group, 32768 fragments per group
8000 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Running command: badblocks -b 4096 -X -s /dev/block/mmcblk0p5 319487
sh: badblocks: not found
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
If if mount the partition no change has been done!
fdisk yields this warning:
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument
I guess - it is only a guess - that for some reason the kernel protects the phone filesystems! How can I stop the kernel from doing that? Can i flash my phone with a tool, avoiding the use of the kernel?
Can you suggest something else?
In case you may ask, at this time in my phone are installed:
CWM-based Recovery v6.0.5.0
CyanogenMod: 11-20140807-unofficial-codina
Android Version: 4.4.4
Kernel Version: 3.0.101 - CyanogenMod-g17eea61
Thanks a lot for reading, I hope a solution comes up!

filesystem mounting / repartitioning on live android system

Hy!
I have a mi2s and this phone is come to separated partitions in its internal drive. It has separated data and sdcard partition. My sdcard partition not mounted for some reason.
I want to keep this partition system, I just want to either mount the sdcard partition, or resize them without loseing data. (I can delete the sdcard partition but I want the data partition untouched, I had a long fight till this rom started to work with google play store, and I dont really want to remach it after all my apps are installed... Fun thing that after the first boot both partitions were mounted, after my first reboot only the data.)
I tried:
adb mount - adb sees it Android not sees it
write it to the fstab.qalcom - its on the / if I reboot the phone its loaded from somewhere again (I know its a ramdisk), my modifications are not permanent on there
I have basic linux knowlage and I started to dig into it, but I cant google out a general solution.
My questions:
How can I mount a fs like the usb otg from adb/android shell?
Can I edit the fstab file in its permanent store on an installed rooted device? And if I can where?
If I place new lines to the fstab on rootfs how can I tell the system to "reload" it?
Can I extend an ext4 partition from adb without loseing its data? *
* I have the required tools like parted from xiaomi forum, I cant post the link but you can google it with "Mi2S extending size of storage partition stillka".
Any help appreciated, and sorry for my english I'm not native.
So the basics:
If you can mount it from adb its a half win!
Try search the correct block partition and mount it with -t, add the correct file system and don't try auto it.
After you can mount it, you need to start an sdcard process its in /system/bin/sdcard. I had to see the custom rom implementation for that, in cm u need to param it "sdcard from to 1023 1023", but in samsung devices the to is hardcoded, and you nedd to do some sed magic.
After that your android programs will see it as a valid sdcard partition.
The harder way:
Wrap it to a startup script.
Add this script somewhere to run at bootup.
I'm still working on it, but I'm closer and closer. After I have the final solution I will write here once more.
I get so much help from there:
http://forum.xda-developers.com/showthread.php?t=2467048
If somebody want to do this:
After few hours of trying to mount the filessystem in boottime (in CM 12.1 its a hard work), i gave up, and went to a repartitioning way.
BE CAREFUL YOU CAN BRICK YOUR DEVICE IF YOU HAVE NO IDEA WHAT IM TALKING ABOUT!
I merged 2 tutorials:
reboot phone into CWM, connect phone to PC
connect to phone over adb and check if you are root
mount system
umount cache
umount data
copy content of partition_tools.zip into /system/bin and add executable attributes if necessary
Run parted on your device: parted /dev/sdX
Change display unit to sectors: unit s
Print current partition table and note the start sector for your partition: p
Delete your partition (won't delete the data or filesystem): rm <number>
Delete your partition (the second one we will delete data from there): rm <number>
Recreate the partition with the starting sector from above: mkpart primary <start> <end>
Recreate partition 27 (the last) mkpartfs primary ext2 3070 15758
name 26 userdata #we have to set back partition labels
name 27 storage
Exit parted: quit
Check the filesystem of 26: sudo e2fsck -f /dev/sdXX
Resize filesystem 26: sudo resize2fs /dev/sdXX
restore partition 27 with:
tune2fs -j /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
Of course in parted print you can see your original partition layout and this case it is possible that you have other partition numbers (my 26 partition is labeld by userdata and 27 with storage, and I gave more space to userdata from storage without loseing any data from userdata).
You can download the partition_tools.zip from the original miui forum, try to search to mi2s extending size of storage partition. (yes it will work with other devices too)

Mounting an image made with adb pull ...

I had a S3 i9300 and I want to check if I can recover some files from data partition
after a hard reset.
I have been able to get an image of data partition with
Code:
adb pull /dev/block/mmcblk0p12 mmcblk0p12.img
My problem is to mount this image on linux.
I tried of course:
Code:
mount -o loop,ro -t auto mmcblk0p12.img ./galaxys3/
but I get ..
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
I tried to understand what was going on with fdisk ...
Code:
# fdisk -l mmcblk0p12.img
Disk mmcblk0p12.img: 11.5 GiB, 12381585408 bytes, 24182784 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
and it doesn't seem to find a partition and give the offset.
anyway android mount that block like that ...
Code:
/dev/block/mmcblk0p12 /data ext4 rw,nosuid,nodev,noatime,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,discard 0 0
any suggestions?
Anyway my goal is to run testdisk (photorec) on it.
TIA.
The fs will be in ext*. Android isnt linux, thats why it works on android and not linux. That's why android needs busybox.
Sent from my HTC One M9 using Tapatalk
shivadow said:
The fs will be in ext*. Android isnt linux, thats why it works on android and not linux. That's why android needs busybox.
Sent from my HTC One M9 using Tapatalk
Click to expand...
Click to collapse
Actually I manage to mount it on linux. I forgot to unmount the data partition
before make the image so it wasn't consistent ... I made a e2fsck and now I can easily
mount it.

[HOW TO] BOOT FROM SD CARD [SUCCESSFULLY] on QMobile Z8 with BRICKED/DEAD eMMC

I'm a mechanical engineer, not an IT guy. I can fix machines, perhaps, but not bricked phones. So try anything at your own extreme risk. This is NOT a step by step guide.
DEVICE:
QMobile Z8, same as Wikio Ridge 4G, (MSM8916).
Running Android 5.0.2, SuperSU rooted.
Kernel v 3.10.49
Thanks to @ASAZING for TWRP 3.0.2-0
PROBLEM:
So the screen started blinking and locking / unlocking automatically like UI resetting. And there was no SIM. At first I thought it's launcher or SuperSU causing problem. But it got worse over days. So I decided a factory flash since I didn't have untouched flashable zip.
Flashed firmware using QFIL but no success. Rebooted to recovery and TWRP was still there.
/data partition was locked and TWRP doesn't support decryption. So I did a factory reset and the message came: /data not mounted. Invalid Argument
Formatted /data from "Repair or Change Filesystem" option in TWRP and as a result /data and /cache both couldn't be mounted.
Formatted /cache, and /system too not mounted.
Manually formatted using 'make_ext4' and tried 'fastboot format:ext4 userdata' as well. Both succeeded apparently but mount still failed.
Run 'e2fsck' and that showed: "Bad magic number in super block" and "The superblock could not be read."
Run 'mke2fs -n' for alternate super blocks, run again 'e2fsck' but no success. Images are attached.
'sgdisk --verify' gives this error log:
Code:
sgdisk --verify mmcblk0p1
[COLOR="Red"]***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format in memory.
***************************************************************
Exact type match not found for type code 7200; assigning type code for 'Linux filesystem'
Exact type match not found for type code 6500; assigning type code for 'Linux filesystem'
Exact type match not found for type code 7900; assigning type code for 'Linux filesystem'
Exact type match not found for type code 0D00; assigning type code for 'Linux filesystem'
Warning! Main partition table overlaps the first partition by 34 blocks!
You will need to delete this partition or resize it in another utility.
Warning! Secondary partition table overlaps the last partition by 3805778618 blocks!
You will need to delete this partition or resize it in another utility.
Problem: partitions 2 and 1 overlap:
Partition 2: 168689522 to 2104717761
Partition 1: 778135908 to 1919645538
Problem: partitions 3 and 1 overlap:
Partition 3: 1869881465 to 3805909656
Partition 1: 778135908 to 1919645538
Problem: partitions 3 and 2 overlap:
Partition 3: 1869881465 to 3805909656
Partition 2: 168689522 to 2104717761
Problem: partition 1 is too big for the disk.
Problem: partition 2 is too big for the disk.
Problem: partition 3 is too big for the disk.
Problem: partition 4 is too big for the disk.
Warning! Main partition table overlaps the first partition by 34 blocks!
You will need to delete this partition or resize it in another utility.
Warning! Secondary partition table overlaps the last partition by 3805778618 blocks!
You will need to delete this partition or resize it in another utility.
Identified 9 problems![/COLOR]
==========================
sgdisk --verify mmcblk0p16
[COLOR="red"]Creating new GPT entries.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 18446744073709551584, but backup header is at 1 and disk size is 2 sectors.
The 'e' option on the experts' menu will probably fix this problem
Identified 1 problems!
[/COLOR]
==========================
sgdisk --verify mmcblk0p17
[COLOR="red"]Creating new GPT entries.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 18446744073709551598, but backup header is at 15 and disk size is 16 sectors.
The 'e' option on the experts' menu will probably fix this problem
Identified 1 problems![/COLOR]
==========================
sgdisk --verify mmcblk0p22
[COLOR="red"]Creating new GPT entries.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 18446744073709551614, but backup header is at 31 and disk size is 32 sectors.
The 'e' option on the experts' menu will probably fix this problem
Identified 1 problems![/COLOR]
'parted rm' and 'fastboot erase' didn't work either. Partition was still there.
Then I tried to flash stock recovery through TWRP. And recovery too gone.
Now, device boots directly to bootloader (fastboot mode) and is halted there. Have to 'fastboot boot recovery.img' or 'fastboot boot boot.img' each time.
Download Mode (QDLoader 9008) is also accessible.
FLASHING FACTORY FIRMWARE:
Now left only with fastboot and EDL, tried once again QFIL flasher, Wiko official flasher, QDownloader. Log says: "Read back verify failed at sector ...." for partitions misc, system, cache, persist, recovery, userdata (6 partitions) and 2 partition table *.bins
Hence proved, eMMC is malfunctioning and device now can't boot on its own due to no partition table.
Tried 'sgdisk --backup' and 'sgdisk --load-backup' options for partition table. It gives error: "Warning! Current disk size doesn't match that of backup." and "Problem: Partition 28 ends before it begins." etc.
'fastboot flash partition *.bin' also failed with error: "remote: failed to write partition".
'dd if=gpt_main0.bin of=/dev/block/mmcblk0' apparently succeeded but comparing octal dump ('od') files of 34 sectors at start shows no difference, means file is not written to eMMC.
SOLUTION SUMMARY:
Partition SD card according to already existing partition table on internal eMMC.
Flash partition images from factory firmware to newly created partitions.
Modify kernel (boot.img) and recovery to boot from sd card instead of internal memory.
Boot kernel or recovery through fastboot.
SECTION 1
PARTITION SD CARD:
Here comes Google. Following the footsteps of @lexelby at this, I created gpt (parted command) on 16GB C-10 sd card using Ubuntu virtual machine.
Created first partition for external_sd card and 6 more of same size as original ones (size checked by parted and from rawprogram_unsparse.xml). Filesystems: system, userdata, cache & persist of ext4 while misc, recovery of linux-swap (though 'dd' will overwrite them).
Then I unsparsed userdata, system and cache images from factory firmware (on Windows used packsparseimg.exe binary). Sparsed images can only be flashed through fastboot?
Copied 5 prtitions images: userdata, system, cache, persist and misc using dd command to /dev/block/mmcblk1p*.
MODIFYING BOOT & RECOVERY:
Now coming to the changes in mount paths of boot and recovery (fstab and init.*.rc).
Extracted boot.img and then ramdisk using "Image Studio for Android". 'unpackbootimg' and 'abootimg' don't extract all files on Ubuntu. 'mkbootimg' makes smaller boot.img file without boot.img-dtb. Perhaps I'm doing it wrong.
Anyway, then did 'grep dev/block' on all extracted files. Results are attached for reference.
Made changes in "fstab.qcom" and "init.target.rc". For details on changes made, please read on RE-MODIFYING BOOT & RECOVERY.
Repacked boot.img
Similarly extracted recovery.img, did 'grep dev/block' on all extracted files. And made changes in "recovery.fstab".
Repacked recovery.img
COPYING IMAGES TO PARTITIONS AND BOOTING:
'fastboot flash boot boot.img' and 'dd if=recovery.img of=dev/block/mmcblk1p*' (though useless, have to boot from fastboot)
Rebooted to recovery by 'fastboot boot recovery.img'
userdata, persist and cache couldn't be mounted in TWRP. Tried 'mount -t ext4 -o loop *.img' on Ubuntu but there too not mounted. Googled and using commands 'file', 'fdisk', 'sfdisk', 'e2fsck' and finally 'resize2fs -f /*.img' resolved the problem "bad geometry: block count xxx exceeds size of device...".
Also unsparsed userdata too large to handle and only a few MBs data inside, that too useless. Therefore, did 'make_ext4fs' on cache & userdata.
Now booted kernel by 'fastboot boot boot.img'
And.......... it boots. But very very slow (due to slow write speed of sd card obviously). Took almost half an hour at first boot.
UNRESOLVED PROBLEMS:
There is no sound. Because of /persist not mounted? And still no SIM, means radio firmware isn't readable from eMMC or this too due to /persist absent? After all that contains drivers. And also Wi-Fi and bluetooth not working.
SECTION 2
RE-PARTITION SD CARD:
So re-created gpt on sd card (using parted and fdisk) and in a hope to utilize all necessary partitions, 100% replicated all partitions (except larger userdata) including space required at start and end of eMMC for partition table. Partition tables of both mmcblk0 and mmvblk1 are attached.
RE-MODIFYING BOOT & RECOVERY:
Made following changes in boot.img:
DEVICE BOOTS ALSO WITHOUT MAKING ANY CHANGES TO BOOT.IMG.
I don't know why but 'bootdevice' is automagiacally changed from 7824900.sdhci (eMMC) to 7864900.sdhci (external SD card). It seems there is some auto-detection mechanism.
Code:
########## ./ramdisk/fstab.qcom ##########
#/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait
#/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer
#CHANGED TO
/dev/block/[B]mmcblk1p24[/B] /system ext4 ro,barrier=1,discard wait
/dev/block/[B]mmcblk1p32[/B] /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer
#/devices/soc.0/7864900.sdhci/mmc_host /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,noemulatedsd
#[B]disabled[/B]
Code:
########## ./ramdisk/init.target.rc ##########
on fs
mount_all fstab.qcom
#wait /dev/block/bootdevice/by-name/cache
#mount ext4 /dev/block/bootdevice/by-name/cache /cache nosuid nodev barrier=1
#CHANGED TO
wait /dev/block/[B]mmcblk1p26[/B]
mount ext4 /dev/block/[B]mmcblk1p26[/B] /cache nosuid nodev barrier=1
#wait /dev/block/bootdevice/by-name/persist
#mount ext4 /dev/block/bootdevice/by-name/persist /persist nosuid nodev barrier=1
#CHANGED TO
wait /dev/block/[B]mmcblk1p25[/B]
mount ext4 /dev/block/[B]mmcblk1p25[/B] /persist nosuid nodev barrier=1
#wait /dev/block/bootdevice/by-name/modem
#mount vfat /dev/block/bootdevice/by-name/modem /firmware ro context=u:object_r:firmware_file:s0,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337
#CHANGED TO
wait /dev/block/[B]mmcblk1p1[/B]
mount vfat /dev/block/[B]mmcblk1p1[/B] /firmware ro context=u:object_r:firmware_file:s0,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337
on charger
#wait /dev/block/bootdevice/by-name/system
#mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1
#CHANGED TO
wait /dev/block/[B]mmcblk1p24[/B]
mount ext4 /dev/block/[B]mmcblk1p24[/B] /system ro barrier=1
Code:
########## ./split_img/boot.img-cmdline ##########
#console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1
#CHANGED TO
console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 [B]androidboot.bootdevice=7864900.sdhci[/B] lpm_levels.sleep_disabled=1
And following changes in recovery.img:
Code:
########## ./ramdisk/etc/recovery.fstab ##########
#/cache ext4 /dev/block/bootdevice/by-name/cache flags=display=Cache
#/system ext4 /dev/block/bootdevice/by-name/system flags=display=System
#/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384
#/persist ext4 /dev/block/mmcblk0p25 flags=backup=1;display=Persist
#/boot emmc /dev/block/bootdevice/by-name/boot flags=display=Boot
#/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1;display=Recovery
#/misc emmc /dev/block/bootdevice/by-name/misc /misc flags=backup=1;display=Misc
#/firmware vfat /dev/block/mmcblk0p1 flags=backup=1;display=Modem
#/splash emmc /dev/block/mmcblk0p18 flags=backup=1;display=Splash
#/fsg emmc /dev/block/mmcblk0p20 flags=backup=1;subpartitionof=/oem
#/aboot emmc /dev/block/mmcblk0p4 flags=backup=1;display=Aboot
#/abootbak emmc /dev/block/mmcblk0p5 flags=subpartitionof=/aboot;backup=1
#/hyp emmc /dev/block/mmcblk0p10 flags=backup=1;display=Firmware-update
#/sbl1 emmc /dev/block/mmcblk0p2 flags=backup=1;subpartitionof=/hyp
#/rpm emmc /dev/block/mmcblk0p6 flags=backup=1;subpartitionof=/hyp
#/tz emmc /dev/block/mmcblk0p8 flags=backup=1;subpartitionof=/hyp
#/hypbak emmc /dev/block/mmcblk0p11 flags=backup=1;subpartitionof=/hyp
#/sbl1bak emmc /dev/block/mmcblk0p3 flags=backup=1;subpartitionof=/hyp
#/rpmbak emmc /dev/block/mmcblk0p7 flags=backup=1;subpartitionof=/hyp
#/tzbak emmc /dev/block/mmcblk0p9 flags=backup=1;subpartitionof=/hyp
#/modemst1 emmc /dev/block/mmcblk0p13 flags=backup=1;display=EFS
#/modemst2 emmc /dev/block/mmcblk0p14 flags=backup=1;subpartitionof=/modemst1
#/oem emmc /dev/block/mmcblk0p30 flags=backup=1;display=OEM
#/DDR emmc /dev/block/mmcblk0p20 flags=backup=1;subpartitionof=/oem
#/fsc emmc /dev/block/mmcblk0p16 flags=backup=1;subpartitionof=/oem
#/ssd emmc /dev/block/mmcblk0p17 flags=backup=1;subpartitionof=/oem
#/pad emmc /dev/block/mmcblk0p12 flags=backup=1;subpartitionof=/oem
#CHANGED TO
/cache ext4 /dev/block/[B]mmcblk1p26[/B] flags=display=Cache
/system ext4 /dev/block/[B]mmcblk1p24[/B] flags=display=System
/data ext4 /dev/block/[B]mmcblk1p32[/B] flags=encryptable=footer;length=-16384
/persist ext4 /dev/block/[B]mmcblk1p25[/B] flags=backup=1;display=Persist
/boot emmc /dev/block/[B]mmcblk1p23[/B] flags=display=Boot
/recovery emmc /dev/block/[B]mmcblk1p27[/B] flags=backup=1;display=Recovery
/misc emmc /dev/block/[B]mmcblk1p15[/B] flags=backup=1;display=Misc
/firmware vfat /dev/block/[B]mmcblk1p1[/B] flags=backup=1;display=Modem
/splash emmc /dev/block/[B]mmcblk1p18[/B] flags=backup=1;display=Splash
/fsg emmc /dev/block/[B]mmcblk1p21[/B] flags=backup=1;subpartitionof=/oem
/aboot emmc /dev/block/[B]mmcblk1p4[/B] flags=backup=1;display=Aboot
/abootbak emmc /dev/block/[B]mmcblk1p5[/B] flags=subpartitionof=/aboot;backup=1
/hyp emmc /dev/block/[B]mmcblk1p10[/B] flags=backup=1;display=Firmware-update
/sbl1 emmc /dev/block/[B]mmcblk1p2[/B] flags=backup=1;subpartitionof=/hyp
/rpm emmc /dev/block/[B]mmcblk1p6[/B] flags=backup=1;subpartitionof=/hyp
/tz emmc /dev/block/[B]mmcblk1p8[/B] flags=backup=1;subpartitionof=/hyp
/hypbak emmc /dev/block/[B]mmcblk1p11[/B] flags=backup=1;subpartitionof=/hyp
/sbl1bak emmc /dev/block/[B]mmcblk1p3[/B] flags=backup=1;subpartitionof=/hyp
/rpmbak emmc /dev/block/[B]mmcblk1p7[/B] flags=backup=1;subpartitionof=/hyp
/tzbak emmc /dev/block/[B]mmcblk1p9[/B] flags=backup=1;subpartitionof=/hyp
/modemst1 emmc /dev/block/[B]mmcblk1p13[/B] flags=backup=1;display=EFS
/modemst2 emmc /dev/block/[B]mmcblk1p14[/B] flags=backup=1;subpartitionof=/modemst1
/oem emmc /dev/block/[B]mmcblk1p30[/B] flags=backup=1;display=OEM
/DDR emmc /dev/block/[B]mmcblk1p20[/B] flags=backup=1;subpartitionof=/oem
/fsc emmc /dev/block/[B]mmcblk1p16[/B] flags=backup=1;subpartitionof=/oem
/ssd emmc /dev/block/[B]mmcblk1p17[/B] flags=backup=1;subpartitionof=/oem
/pad emmc /dev/block/[B]mmcblk1p12[/B] flags=backup=1;subpartitionof=/oem
#/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="MicroSD Card";storage;wipeingui;removable
#CHANGED TO
# None. [B]External sd disabled[/B].
Code:
########## ./ramdisk/uneventd.rc ##########
#/dev/block/bootdevice/by-name/config 0660 system system
#CHANGED TO
/dev/block/[B]mmcblk1p29[/B] 0660 system system
Code:
########## ./split_img/recovery.img-cmdline ##########
#console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 androidboot.selinux=permissive
#CHANGED TO
console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 [B]androidboot.bootdevice=7864900.sdhci[/B] lpm_levels.sleep_disabled=1 androidboot.selinux=permissive
Repacked boot.img and recovery.img.
RE-COPYING IMAGES TO PARTITIONS AND BOOTING:
Copied (dd) all available (15) images to (20) partitions on sd card.
Copied (dd) the 10 images not found in factory firmware from mmcblk0 to mmcblk1. (Not sure if successful).
2 partitions (/data and /cache) already formatted in ext4.
'fastboot boot recovery.img'. All partitions are mounted now. No horrible error lines.
'fastboot boot boot.img'
ROM booted successfully WITH sounds, SIM, Wi-Fi and Bluetooth. All seems working well so far.
SECTION 3
Continued on post 3...
hello hi
i have xiaomi redmi 2 chinesse version with same problem with your device. stuck logo, only still can access recovery TWRP via fastboot boot trwp.img.
twrp cant wipe, cant format, internal storage 0mb, "failed argument ".cant flash stock rom with flash tools "failed write partition", . try terminal parted rm not solve. try to many google same issue not solve. i think emmc or hardware issue
i never using linux and linux command so
please help me.make step by step guide , boot from sdcard .
- make partition sd card to be like emmc partition block
- can i using windows os or using small linux distro
- how to modif image stock rom ,kernel ,and flashing to sdcard
- how to boot from sdcard
many thank you
Continued from OP...
SECTION 3
QUERIES:
UNCERTAIN PARTITIONS
But there are no images available for these 10 partitions in factory firmware:
pad, modemst1, modemst2, fsc, ssd, DDR, keystore, config, oem & devinfo.
These seem to be very essential for OS, also containing IMEI if I'm not mistaken? I'm not sure of their contents. How system working without them? All are useless?
HOW TO COMPLETELY BOOT FROM SD CARD
In boot.img, "fstab.qcom" contains mount paths for system & userdata. While "init.target.rc" contains only mount paths for cache, persist and modem. In total 5 partitions which are mounted (checked by 'mount').
Code:
[email protected]:/ $ mount | grep mmcblk1
/dev/block/mmcblk1p24 /system ext4 rw,seclabel,relatime,discard,data=ordered 0 0
/dev/block/mmcblk1p32 /data ext4 rw,seclabel,nosuid,nodev,relatime,discard,noauto_da_alloc 0 0
/dev/block/mmcblk1p26 /cache ext4 rw,seclabel,nosuid,nodev,relatime 0 0
/dev/block/mmcblk1p25 /persist ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/mmcblk1p1 /firmware vfat ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0
[email protected]:/ $
So the primary question is:
How to change mount source of other partitions from mmcblk0 to mmcblk1? Or how to force OS to read the essentially required partitions from mmcblk1 instead of mmcblk0?
Need to modify any other files in ramdisk or kernel-zimage or in /system or to modify init.d scripts or create new scripts? Any help?
Other than 10 partitions mentioned above, these "not mounted" partitions also include modem, sbl1, aboot, rpm, tz and hyp and fsg. Modem contains bootable code of MBR and following 5 are also executable binaries. I think these are all part of bootloader i.e. loading in initial booting process and not required by OS. But what about the fsg and ten others? Where are those used? Here is a partition detail.
Another primary issue is:
I think it's almost impossible to make Boot ROM (CPU embedded) hand over charge to bootloader at "mmcblk1". "mmcblk0" must be hardcoded in Boot ROM.
So, how to make bootloader load "kernel" and "rootfs" from mmcblk1p* instead of mmcblk0p*? Like there are switches in testing devices to optionally boot from different memories. Can we modify "aboot" (the little kernel) or "emmc_appsboot.mbn" ELF binary for this purpose? It must be complicated as bootloaders are signed by vendor (Qualcomm) and involve low-level programming as discussed here. Right?
Or in other words, how to force bootloader to read partition table from dev/mmcblk1 instead of dev/mmcblk0?
If we can't do this, system doesn't know how to boot in the absence of eMMC. That would have to be done through fastboot everytime we need to. Because boot chain will be stuck at bootloader.
Multi-booting solutions are also dependent on a fully working /boot partition on eMMC because they (one way or the other) re-flash/replace modified boot image every time a ROM is to be switched. EFIDroid is a secondary bootloader but that too replaces /boot and/or /recovery.
I have gone through this, this, this and this. But they only address partial booting from sd card e.g. dual booting in which only /system, /data and /cache are involved. None has discussed complete boot from sd. Is it really impossible? This link gives a little hope but it points to a ready made solution (bootloader) which boots kernel from SD card. But it gives no explanation how.
I have also come across a few threads discussing Samsung (and HTC too) booting from SD Card as a fix to QHSUSB_DLOAD mode or bricked-bootloaader state. They extracted "debrick" file from a working phone and flashed that to the start of SD Card. Debrick file seems to be a single bootloader file containing all bootloaders in it as explained here and here. So after flashing the bootloader(s) with its accompanying partitions to SD Card, when device was powered on, it automatically booted from SD Card. If it's that simple for all devices with Qualcomm SoC, the only thing I have to do is :laugh:
Code:
[COLOR="Red"]dd if=/dev/zero of=/dev/block/mmcblk0 bs=1m count=200[/COLOR]
Any suggestions? I believe this must be possible as they are discussing here.
Edit: Related quote from [GUIDE][9008][EDL|QDL][QUALCOMM ONLY] Unbrick via external sdcard (no QFIL!):
On eMMC devices, the boot path is /dev/block/mmcblk0. If you have a 9008 brick, the SD card is seen as /dev/block/mmcblk0 so the phone will boot from it on an eMMC device.
Click to expand...
Click to collapse
Some secondary questions:
HOW ARE PARTITIONS IDENTIFIED BY BOOT-ROM WITHOUT PARTITION TABLE ON eMMC
If there is no readable partition table on a bricked eMMC, how Boot ROM (primary bootloader on SoC) switches control to secondary bootloader or bootable modem partition or other partitions used by processors? Means how SoC / Processors locate modem, sbl, rpm, tz or aboot (the little kernel's offspring) on eMMC? Also, why 'parted /dev/block/mmcblk0 p' and 'sgdisk --print /dev/block/mmcblk0'show partitions if there is no table?
Though parted-2.2 shows warning:
Code:
[COLOR="Red"]Error: Both the primary and backup GPT tables are corrupt. Try making a fresh
table, and using Parted's rescue feature to recover partitions.[/COLOR]
Or I'm thinking in wrong direction? This link discusses the issues but I'm not clear how it works.
Once the a device is powered on it starts code from a know location (ROM) and looks for the first stage bootloader in a specific block.
Click to expand...
Click to collapse
How is this "specific block" located by cpu ROM?
It's talking about some "low-level" and "high-level" partition tables. How they differ? How can we manipulate the former?
And finally...
HOW TO SPEED UP SD CARD
Other than using a UHS-III or the most recent and expensive App Performance Class (A1) sd card, what changes we can make to kernel to boost read/write speed? Otherwise, it's almost useless with too slow speed, frequent ANRs, hangs and laggings.
Default I/O scheduler being used on QMobile Z8 is cfq with default tune-able settings. I think it's one of best schedulers for higher throughput. Na? Try other? Details here:
Code:
[email protected]:/ # cat /sys/block/mmcblk0/queue/scheduler
noop deadline row [cfq]
[email protected]:/ # for fyle in $(find /sys/block/mmcblk0/queue/iosched/ -type f); do echo $fyle; cat $fyle; done;
/sys/block/mmcblk0/queue/iosched/fifo_expire_async
50
/sys/block/mmcblk0/queue/iosched/group_idle
0
/sys/block/mmcblk0/queue/iosched/quantum
20
/sys/block/mmcblk0/queue/iosched/slice_async
40
/sys/block/mmcblk0/queue/iosched/slice_idle
10
/sys/block/mmcblk0/queue/iosched/slice_sync
100
/sys/block/mmcblk0/queue/iosched/low_latency
0
/sys/block/mmcblk0/queue/iosched/fifo_expire_sync
50
/sys/block/mmcblk0/queue/iosched/back_seek_max
16384
/sys/block/mmcblk0/queue/iosched/target_latency
300
/sys/block/mmcblk0/queue/iosched/back_seek_penalty
2
/sys/block/mmcblk0/queue/iosched/slice_async_rq
2
[email protected]:/ # cat /sys/block/mmcblk1/queue/scheduler
noop deadline row [cfq]
[email protected]:/ # for fyle in $(find /sys/block/mmcblk1/queue/iosched/ -type f); do echo $fyle; cat $fyle; done;
/sys/block/mmcblk1/queue/iosched/fifo_expire_async
50
/sys/block/mmcblk1/queue/iosched/group_idle
0
/sys/block/mmcblk1/queue/iosched/quantum
20
/sys/block/mmcblk1/queue/iosched/slice_async
40
/sys/block/mmcblk1/queue/iosched/slice_idle
10
/sys/block/mmcblk1/queue/iosched/slice_sync
100
/sys/block/mmcblk1/queue/iosched/low_latency
0
/sys/block/mmcblk1/queue/iosched/fifo_expire_sync
50
/sys/block/mmcblk1/queue/iosched/back_seek_max
16384
/sys/block/mmcblk1/queue/iosched/target_latency
300
/sys/block/mmcblk1/queue/iosched/back_seek_penalty
2
/sys/block/mmcblk1/queue/iosched/slice_async_rq
2
[email protected]:/ #
Tried different cache values (read_ahead_kb) from 64 to 4048. Makes no difference apparently.
Also disabled jounalling using 'tune2fs -O ^has_journal' and e2fsck checks using 'tune2fs -c -1'.
Changed mount options to for /data and /cache:
Code:
[email protected]:/ # mount | grep -E "/cache|/data"
/dev/block/mmcblk1p32 /data ext4 rw,seclabel,[B]noatime,discard,nobarrier,noauto_da_alloc,commit=60[/B] 0 0
/dev/block/mmcblk1p26 /cache ext4 rw,seclabel,noatime,discard,nobarrier,noauto_da_alloc,commit=60 0 0
[email protected]:/ #
Seems useless so far. Any ideas? Or it's a hardware limitation of device?
Is there a way to get rid of FUSE and use ext4 in true sense for whole /data (only possible if someone is willing to quit using MTP), though it doesn't matter much for Android's internal operations? But it's a real pain for I/O operations on external media.
Edit: Speed much improved by using a more certain branded SD Card; Sandisk C-10.
@yoAeroA00 Sir need your special attention for kernel part. You have a good history with kernel tweaking and multibooting.
I try to manual flash commands, one by one read from flash_all.bat. everything is okay finish, except file "gpt_both0.bin" and "sec.dat"
jeksparo said:
I try to manual flash commands, one by one read from flash_all.bat. everything is okay finish, except file "gpt_both0.bin" and "sec.dat"
Click to expand...
Click to collapse
If flasher is unable to flash partitions, then flashing manually won't make any difference. "gpt_both0.bin" contains partition tables; main and backup. First sector is protective mbr for legacy partitioning tools and next 33 sectors contain gpt partition table. A backup of partition table is stores on last 33 sectors of disk or emmc in our case. Total 67 sectors make 33.5 KiB size which is same as that of gpt_both0.bin. Let me have a look at partition table for further clarity. Run these from twrp to save your partition table.
Code:
sgdisk -p /dev/block/mmcblk0 > pt1
parted /dev/block/mmcblk0 p free > pt2
cant compile sgdisk -p /dev/block/mmcblk0 > pt1 invalid option --p
and parted /dev/block/mmcblk0 > pt2 blank line after entering
my device shell dont have parted command, so i run parted from sd card.
how to created gpt on sdcard using parted and fdisk, if my parted command in sdcard too, it is possible?
jeksparo said:
cant compile sgdisk -p /dev/block/mmcblk0 > pt1 invalid option --p
and parted /dev/block/mmcblk0 > pt2 blank line after entering
my device shell dont have parted command, so i run parted from sd card.
how to created gpt on sdcard using parted and fdisk, if my parted command in sdcard too, it is possible?
Click to expand...
Click to collapse
For sgdisk use --print as help shown in your screenshot.
Code:
sgdisk --print /dev/block/mmcblk0 > /part_table
"> /partition_table" is to save the output in root directory so that you can copy paste it. Otherwise you can also take screenshots in TWRP with PWR + VOL- combination.
'parted' doesn't come bundled with TWRP. You can use the binary from your SD card but you need to copy it somewhere else like '/sbin' if you want to partition you SD card. 'fdisk' can't create GPT, it's legacy tool for MBR partition scheme. You need to use 'parted', 'gdisk' or 'sgdisk' etc. to create partitions. Binaries for Android are with limited functionality. That's why Linux is preferred, but not necessary. Also the copying of partition images will be easy on Linux, though very slow if you connect card reader in virtual machine.
These partitions on your device contain filesystem and will be mounted in ROM
modem vfat
system ext4
cache ext4
persist ext4
userdata ext4
Click to expand...
Click to collapse
Boot and recovery partitions can also be used if your partition table isn't too corrupt to recognize them. Otherwise you'll have to use fastboot on every boot like me.
Simple is to duplicate the whole internal partition table on SD card because rest of the partitions don't occupy much space. It makes partition numbering easy.
But before creating partitions, you need to know exact boundaries in bytes:
Code:
parted /dev/block/mmcblk0
(parted) u b
(parted) p free
(parted) q
please hellp me
Hiii . i have wiko ridge 4g and i have the same problem as you it stuck on wiko logo and when i try to flash it with stock rom from wiko site nothing hapend and i tried to flash it using Qfil in the log i see "Read back verify failed at sector" the same problem as you sooooo please make step by step guid
i can boot to download mode . when i try to boot to recovery it boot to fastboot mode automaticly .....plz help me..... -sorry for my english-
_6ix._.9ine said:
Hiii . i have wiko ridge 4g and i have the same problem as you it stuck on wiko logo and when i try to flash it with stock rom from wiko site nothing hapend and i tried to flash it using Qfil in the log i see "Read back verify failed at sector" the same problem as you sooooo please make step by step guid
i can boot to download mode . when i try to boot to recovery it boot to fastboot mode automaticly .....plz help me..... -sorry for my english-
Click to expand...
Click to collapse
On what part you need help? It's all about partitioning an sd card and copying data to it. Then unpack, modify and re-pack boot.img
plllllz help me
mirfatif said:
On what part you need help? It's all about partitioning an sd card and copying data to it. Then unpack, modify and re-pack boot.img
Click to expand...
Click to collapse
i've been trying to understand what u wrote for the last 7 days and i couldn't understand shiiiit :crying:
i don't know anything about this shiiiit :crying: i'm so sad plz make video and upload it on youtube and show me step by step how did u boot from sd card plllllllllllllllllz _sorry for my english_
MODIFYING BOOT & RECOVERY:
Now coming to the changes in mount paths of boot and recovery (fstab and init.*.rc).
Extracted boot.img and then ramdisk using "Image Studio for Android". 'unpackbootimg' and 'abootimg' don't extract all files on Ubuntu. 'mkbootimg' makes smaller boot.img file without boot.img-dtb. Perhaps I'm doing it wrong.
Anyway, then did 'grep dev/block' on all extracted files. Results are attached for reference.
Made changes in "fstab.qcom" and "init.target.rc". For details on changes made, please read on RE-MODIFYING BOOT & RECOVERY.
Click to expand...
Click to collapse
In that part I used the "ABOOTIMG". To work, do the following:
Code:
$ sudo abootimg -x boot.img ramdisk ramdisk kernel kernel
or
Code:
#abootimg -x boot.img ramdisk ramdisk kernel kernel
You will find 3 files. The "RAMDISK" comes packaged in "GZIP". Unzip it and enter the folder that will be created. Inside this folder you will have the files to edit as the post follows.
By the way, congratulations for the initiative!
Turkish
Nothing is understood when it is translated. Can a British English translate this to me?
Thanks you very much for your great story and for a lot of informations!
Peace & Respect
mirfatif,
thanks for this interesting and promising information!
I'd like, though, get an additional explanation: you use "fastboot" to handle your smartphone. Does it mean,
that it was bootable when you've started all this stuff with booting from SD-card?
I'm asking because I'm trying to boot my samsung galaxy GT-N7100 from sd-card with completely dead emmc.
igorbounov said:
you use "fastboot" to handle your smartphone. Does it mean,
that it was bootable when you've started all this stuff with booting from SD-card?
Click to expand...
Click to collapse
My phone doesn't have "completely" dead eMMC. Booting process works up to bootloader (aboot) and it's related partitions. So fastboot works (as it's managed by bootloader). But after that, bootloader can't load boot image (kernel) from boot partition. Neither recovery partition is readable. Thus I have to do it manually using fastboot. And the remaining OS related partitions are read from SD card.
mirfatif said:
My phone doesn't have "completely" dead eMMC..
Click to expand...
Click to collapse
Now I get the idea... Nevertheless it looks like now I should stop attempts recovering smartphone because while trying I've turned
(somehow) my available 64Gb Samsung SD-card to a write-protected state (while partitioning). So my further experiments seem
not worth it - now it looks like buying a new Galaxy Note with a new SD-card is more cost-effective.
igorbounov said:
I've turned
(somehow) my available 64Gb Samsung SD-card to a write-protected state (while partitioning).
Click to expand...
Click to collapse
Are you unable to create a new partition table using parted/fdisk/gdisk?
mirfatif said:
Are you unable to create a new partition table using parted/fdisk/gdisk?
Click to expand...
Click to collapse
No, I've used everything - even Windows-oriented utilities for low level formatting. All of them complain that
this SD card is write-protected. It has stuck in a strange state - a gpt table created, but no partitions.
And some programs (sfdisk or sgdisk, and even diskpart from Windows) find there some inconsistences.
Perhaps the inner electronics thinks that this errors correspond to a worn state - and sets this read-only attribute.
When I partitioned this sd-card, I've first created the new gpt table, then for a long time speculated about which
partition of what type and size should be created. In this process I've opened two or maybe more parted and
gparted sessions, and then I've saved partitions from one session, then maybe from other... and now this
memory card is in read-only state. Perhaps it has decided that this is the most safe way.
igorbounov said:
No, I've used everything - even Windows-oriented utilities for low level formatting....
Click to expand...
Click to collapse
How did you connect SD card to PC? I mean USB card reader, SD card slot etc. Sometimes card reader drivers are causing the problems. Are you using Linux / Windows natively or on a VM? Did you try creating partition table on Android phone? Usually phones can handle SD cards better. Try card slot or OTG, in TWRP or from ROM, using arm or aarch64 binaries of parted, fdisk and gdisk. Command line tools are preferable for troubleshooting than GUI tools.
mirfatif said:
How did you connect SD card to PC? I mean USB card reader, ...
Click to expand...
Click to collapse
I've used a chip USB card reader. Linux and Windows natively and Windows in a VM (QEMU/KVM). I haven't yet found some other volunteer with Android phone to put my SD card there. My old faithfull Nokia 6131 just don't see this card (and shouldn't, there are no partitions and Nokia 6131 cannot handle sd cards of such size). Yesterday I've used an old card reader, that is built in my daughter's PC, I've used for that purpose a special SD casing for microSD - Windows disk management confirmed that this SD card is read-only.
May be some embedded device could help in this situation - some AVR- or STM32-based device via SPI (than it doesn't matter wether there is some protection or no).

Categories

Resources