[One (M7) General] nkk71:
[FIX][GUIDE][INFO][01-JUN-2014]M7 "Active Cmdline Overflow" error and bootloop

This is a collaboration of @cschmitt and myself. Many thanks to @cschmitt for his hard work and help :good::good:

Symptoms

1) Bootloader shows "active cmdline overflow (xxxx bytes)"

2) Unable to enter recovery (neither custom nor stock)

3) (possibly) everything you try reboots to bootloader

Cause

Basically it's because of a corrupt mmcblk0p19 [misc] partition, the [misc] partition includes the bootloader command block (BCB); @schmitt can elaborate on that more than I.

The most often times we've seen this, is when flashing HTC Droid DNA (device=dlx) ROM or kernel (kernel is included in the ROM) on a HTC One M7. The DLX kernel is in mmcblk0p19, and during installation this part of the installer script - run_program("/sbin/dd", "if=/tmp/boot.img", "of=/dev/block/mmcblk0p19") - will overwrite and therefore corrupt your [misc] partition.

Problems (and why even an RUU won't restore your phone)

Some partitions, in particular mmcblk0p19 [misc] and mmcblk0p6 [mfg], are not contained in any RUU, as they are specific to each individual phone.

So what does a normal [misc] partition look like:

the ones that vary from device to device are the ones in bold green at offsets 0x304 and 0x31C, and what impact or influence they have I don't know.

OK, now get to the point, how do we fix this

Well you need adb commands, root and busybox... which are only available in a custom recovery or a rooted ROM (with USB debugging enabled)

and @cschmitt has modified TWRP to disregard the BCB http://xdaforums.com/showpost.php?p=52262603&postcount=13

Download from AndroidFileHost: twrp-recovery-2.7-m7-nobcb.img only applicable for M7_U or M7_UL models.

Step 1: Install the noBCB recovery

C:\ADB3>[B][COLOR=Blue]fastboot devices[/COLOR][/B]
HT34xxxxxxxx fastboot [I]<- we're in bootloader[/I]

C:\ADB3>[B][COLOR=Blue]fastboot flash recovery twrp-recovery-2.7-m7-nobcb.img[/COLOR][/B]
target reported max download size of 1514139648 bytes
sending 'recovery' (11278 KB)...
OKAY [ 1.500s]
writing 'recovery'...
OKAY [ 1.240s]
finished. total time: 2.740s

C:\ADB3>[B][COLOR=Blue]fastboot erase cache[/COLOR][/B]
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [ 0.090s]
finished. total time: 0.090s

C:\ADB3>[B][COLOR=Blue]fastboot reboot-bootloader[/COLOR][/B]
rebooting into bootloader...
OKAY [ 0.040s]
finished. total time: 0.040s

--> enter RECOVERY

If you are still unable to boot into recovery:

Users with S-OFF

Downgrade hboot to 1.44

Download 1.29.401.12_hboot_1.44.zip, check MD5, and flash it in ruu mode:

C:\ADB3>[B][COLOR=Blue]fastboot oem rebootRUU[/COLOR][/B]
...
(bootloader) Start Verify: 0
OKAY [ 0.047s]
finished. total time: 0.047s

C:\ADB3>[B][COLOR=Blue]fastboot flash zip 1.29.401.12_hboot_1.44.zip[/COLOR][/B]
sending 'zip' (501 KB)...
OKAY [ 0.250s]
writing 'zip'...
(bootloader) zip header checking...
(bootloader) zip info parsing...
(bootloader) checking model ID...
(bootloader) checking custom ID...
(bootloader) start image[hboot] unzipping & flushing...
(bootloader) [RUU]UZ,hboot,0
(bootloader) [RUU]UZ,hboot,50
(bootloader) [RUU]UZ,hboot,100
(bootloader) [RUU]WP,hboot,0
(bootloader) [RUU]WP,hboot,99
(bootloader) [RUU]WP,hboot,100
(bootloader) ...... Successful
OKAY [ 2.153s]
finished. total time: 2.402s

C:\ADB3>[B][COLOR=Blue]fastboot reboot-bootloader[/COLOR][/B]
rebooting into bootloader...
OKAY [ 0.031s]
finished. total time: 0.031s

and enter RECOVERY

Users with S-ON

Try one of the following recoveries instead:

CWM_6.0.2.8_M7.img

cwm-recovery-m7-6.0.4.9-nobcb.img

Step 2: Backup your current mmcblk0p19 (it's always good to backup things before changing them)

C:\ADB3>[B][COLOR=Blue]adb devices[/COLOR][/B]
List of devices attached
HT34xxxxxxxx recovery [I]<- you need to be in custom recovery to
ensure [B]root[/B] privileges[/I]

C:\ADB3>[B][COLOR=Blue]adb shell dd if=/dev/block/mmcblk0p19 of=/tmp/mmcblk0p19_bak.img[/COLOR][/B]
2045+0 records in
2045+0 records out
1047040 bytes (1022.5KB) copied, 0.048894 seconds, 20.4MB/s

C:\ADB3>[B][COLOR=Blue]adb pull /tmp/mmcblk0p19_bak.img[/COLOR][/B]
2272 KB/s (1047040 bytes in 0.450s)

C:\ADB3>[B][COLOR=Blue]dir[/COLOR][/B]
Volume in drive C has no label.
Volume Serial Number is 0622-9D4A

Directory of C:\ADB3

02/05/2014 18:40 <DIR> .
02/05/2014 18:40 <DIR> ..
02/05/2014 18:40 1,047,040 mmcblk0p19_bak.img
[B][I]^^ there it is[/I][/B]

Step 3: Download generic m7_u / ul mmcblk0p19

Download the M7_U / UL generic misc partition by @cschmitt:

http://xdaforums.com/attachment.php?attachmentid=2774855&stc=1&d=1401633317

extract it and put it in your adb/fastboot folder.

Step 4: Restore the generic mmcblk0p19

C:\ADB3>[B][COLOR=Blue]adb devices[/COLOR][/B]
List of devices attached
HT34xxxxxxxx recovery [I]<- you need to be in custom recovery to
ensure [B]root[/B] privileges[/I]

C:\ADB3>[B][COLOR=Blue]adb push mmcblk0p19_generic.img /tmp/[/COLOR][/B]
2130 KB/s (1047040 bytes in 0.479s)

C:\ADB3>[B][COLOR=Blue]adb shell dd if=/tmp/mmcblk0p19_generic.img of=/dev/block/mmcblk0p19[/COLOR][/B]
2045+0 records in
2045+0 records out
1047040 bytes (1022.5KB) copied, 0.048894 seconds, 20.4MB/s

C:\ADB3>[B][COLOR=Blue]adb reboot bootloader[/COLOR][/B]

You should now be back in bootloader with NO active cmdline overflow, be able to flash, enter the recovery of your choice, and install things appropriate for your phone.

:victory:

-------------------------------------------------------------------------------------------------------------------------------------------

Revision history

2nd May 2014:

Initial preview release.​

1st June 2014:

Generic misc partition now confirmed working for S-On and S-Off devices, no longer need to "repair" the misc partition.​

2nd August 2014:

Added links for other recoveries for S-On users, and hboot downgrade instructions for S-Off users.​

-------------------------------------------------------------------------------------------------------------------------------------------

Disclaimer:

We are not responsible for anything going wrong with your phone!

credits:

@cschmitt for his work on the noBCB recovery, as well as his continued work on TWRP: http://xdaforums.com/showthread.php?t=2708134

-------------------------------------------------------------------------------------------------------------------------------------------

If you found this thread useful or educational, please press the THANKS button for both of us :).

-------------------------------------------------------------------------------------------------------------------------------------------