EMMCFirmwareBugs » History » Version 9
Denis 'GNUtoo' Carikli, 11/22/2020 05:15 PM
add other devices
| 1 | 1 | Denis 'GNUtoo' Carikli | h1. EMMCFirmwareBugs |
|---|---|---|---|
| 2 | |||
| 3 | 4 | Denis 'GNUtoo' Carikli | {{toc}} |
| 4 | |||
| 5 | 1 | Denis 'GNUtoo' Carikli | h2. Data corruption |
| 6 | |||
| 7 | Several devices have fixes or workarounds in vendor kernels for data corruptions in the eMMC. This can lead to non-working devices as it could potentially corrupt the bootloaders for instance. |
||
| 8 | |||
| 9 | The bug #2104 has more details for the Galaxy SIII. |
||
| 10 | |||
| 11 | h3. Affected devices |
||
| 12 | |||
| 13 | 3 | Denis 'GNUtoo' Carikli | h4. VTU00M |
| 14 | |||
| 15 | *Affected devices*: Some Galaxy SIII (GT-I9300) |
||
| 16 | *Vendor kernel patch*: "mmc: Soft-patch MoviNAND VTU00M (16GB) eMMC failure":https://git.replicant.us/replicant/kernel_samsung_smdk4412/commit/?id=da8461692362317a8ffce4d4646953985fcf4e1d |
||
| 17 | *Upstream status*: not upstream |
||
| 18 | *Replicant >=9 status*: not yet ported |
||
| 19 | |||
| 20 | h5. How to check |
||
| 21 | |||
| 22 | As this patch shows: |
||
| 23 | <pre> |
||
| 24 | + if (!strncmp(host->card->cid.prod_name, "VTU00M", 6) && |
||
| 25 | + (host->card->cid.prod_rev == 0xf1) && |
||
| 26 | + (mmc_start_movi_smart(host->card) == 0x2)) |
||
| 27 | + host->card->movi_ops = 0x2; |
||
| 28 | </pre> |
||
| 29 | |||
| 30 | * The name of the eMMC is VTU00M |
||
| 31 | * Only certain revisions are affected (revision 0xf1) |
||
| 32 | |||
| 33 | 5 | Denis 'GNUtoo' Carikli | With Replicant > 6 we can find the eMMC name like that: |
| 34 | <pre> |
||
| 35 | $ adb root |
||
| 36 | $ adb shell |
||
| 37 | i9300:/ # cat /sys/bus/mmc/devices/mmc2:0001/name |
||
| 38 | VTU00M |
||
| 39 | </pre> |
||
| 40 | |||
| 41 | 6 | Denis 'GNUtoo' Carikli | As for the prod_rev, we have "this code":https://git.replicant.us/replicant/kernel_samsung_smdk4412/tree/drivers/mmc/core/mmc.c?id=da8461692362317a8ffce4d4646953985fcf4e1d#n101 in the Replicant 6 kernel: |
| 42 | <pre> |
||
| 43 | case 4: /* MMC v4 */ |
||
| 44 | [...] |
||
| 45 | card->cid.prod_rev = UNSTUFF_BITS(resp, 48, 8); |
||
| 46 | [...] |
||
| 47 | break; |
||
| 48 | </pre> |
||
| 49 | |||
| 50 | So it's a MMC v4 and uses @UNSTUFF_BITS(resp, 48, 8);@ |
||
| 51 | |||
| 52 | In upstream Linux we have that instead: |
||
| 53 | <pre> |
||
| 54 | case 4: /* MMC v4 */ |
||
| 55 | [...] |
||
| 56 | card->cid.prv = UNSTUFF_BITS(resp, 48, 8); |
||
| 57 | [...] |
||
| 58 | </pre> |
||
| 59 | |||
| 60 | So we should be able to get the revision in this way: |
||
| 61 | <pre> |
||
| 62 | $ adb root |
||
| 63 | $ adb shell |
||
| 64 | i9300:/ # cat /sys/bus/mmc/devices/mmc2:0001/prv |
||
| 65 | 0xf7 |
||
| 66 | </pre> |
||
| 67 | |||
| 68 | Here I've the 0xf7 revision and not the problematic 0xf1 revision, so I should probably be ok. |
||
| 69 | |||
| 70 | 5 | Denis 'GNUtoo' Carikli | Here this has been tested with a GT-I9300 with a work in progress Replicant 10 image that uses a kernel closely based on upstream Linux. |
| 71 | |||
| 72 | 3 | Denis 'GNUtoo' Carikli | h5. Vendor kernel workaround analysis |
| 73 | |||
| 74 | The "mmc: Soft-patch MoviNAND VTU00M (16GB) eMMC failure":https://git.replicant.us/replicant/kernel_samsung_smdk4412/commit/?id=da8461692362317a8ffce4d4646953985fcf4e1d patch patches the eMMC firmware at runtime (it patches the firmware in RAM). |
||
| 75 | |||
| 76 | The eMMC firmware patch makes the eMMC hang when a corruption is about to happen. |
||
| 77 | 8 | Denis 'GNUtoo' Carikli | |
| 78 | h5. See also |
||
| 79 | |||
| 80 | * The "eMMC hacking, or: how I fixed long-dead Galaxy S3 phones":https://media.ccc.de/v/34c3-8784-emmc_hacking_or_how_i_fixed_long-dead_galaxy_s3_phones presentation that has a lot more background on the issue for the Galaxy SIII (GT-I9300). |
||
| 81 | * The "i9300_emmc_toolbox":https://github.com/oranav/i9300_emmc_toolbox source code related to this talk. Note that while most of it is free software it also contains nonfree code in the sdcard directory. |
||
| 82 | 9 | Denis 'GNUtoo' Carikli | |
| 83 | h4. Other devices |
||
| 84 | |||
| 85 | h5. See also |
||
| 86 | |||
| 87 | 8 | Denis 'GNUtoo' Carikli | * The "XDA developpers eMMC sudden death research thread":https://forum.xda-developers.com/showthread.php?p=38112844 |
| 88 | |||
| 89 | h5. TODO |
||
| 90 | |||
| 91 | * Document this also for other devices, like the Galaxy SII. |
||
| 92 | * There was a wiki page in LineageOS or CyanogenMod that referenced eMMC firmware bugs. find it and reference it |