Flashing Errors for Android 5.1 on Nexus 6

I recently got a Nexus 6 (yesterday) and Android 5.1 came out today. Being impatient, I decided to flash Android 5.1 myself since it’s been a breeze in the past.

Turns out, I do not think the flash-all.sh script actually works for the Nexus 6. Specifically, I kept getting the following error.

cala-am02026515:shamu-lmy47d maloj038$ fastboot -w update image-shamu-lmy47d.zip<br></br>  
target reported max download size of 536870912 bytes<br></br>  
archive does not contain 'boot.sig'<br></br>  
archive does not contain 'recovery.sig'<br></br>  
fastboot(1742,0xa03021a8) malloc: *** mach_vm_map(size=1779851264) failed (error code=3)<br></br>  
*** error: can't allocate region<br></br>
*** set a breakpoint in malloc_error_break to debug<br></br>
failed to allocate 1778070480 bytes<br></br>  
error: update package missing system.img```

It seems that process takes up more memory than some process can allocate all at once. Annoying. I had to manually flash each component by hand using “method 2” from [the these directions](http://forum.xda-developers.com/google-nexus-5/general/tutorial-how-to-flash-factory-image-t2513701).

Once I did that, everything worked.

Well, sort of. Turns out my OS X machine also has a bad sector on my SSD because when I tried writing the system, I got the following error:

cala-am02026515:image-shamu-lmy47d maloj038$ fastboot flash system system.img


target reported max download size of 536870912 bytes


Invalid sparse file format at unknown block 0000 at 170491527


Invalid sparse file format at unknown block 0000 at 170491528


Invalid sparse file format at unknown block 0000 at 170491529```

After unziping the file again, I was able to flash no problem.

PSA – Always MD5/SHA1 important files. Oops.