Sunday, February 5, 2017

Moto G4 Root from Linux

Here are the steps I followed to root my Moto G4.  There were some guides on xda that involved reflashing boot.img.  While it seems many have done this with success, flashing the boot.img is not something I like doing and I try to avoid it if at all possible.  The below method will will modify the boot image, but the SuperSU installation script does it for you.  In my opinion this is still risky but perhaps less risky than flashing a boot.img that you found on the internet.

I performed all of the below steps from my Linux machine; there is no need to use Windows.

Unlocking the bootloader is the same as performing a system reset; you will lose all of your data, so make a backup first.

If you brick your phone following these steps, well, that's on you.

Preliminary Steps

  1. Enable developer options on the phone
  2. Inside developer options, enable "OEM Unlocking"
  3. Enable "USB debugging"
  4. On the computer: have the Android SDK installed (at least adb and fastboot utilities)
  5. Back up important data/pictures/etc from the phone.

Unlock Bootloader

Reboot the phone into the bootloader:

wskellenger@marquette ~ $ adb reboot bootloader

See if the device is visible:

wskellenger@marquette ~ $ fastboot devices

no permissions (verify udev rules); see [] fastboot
For me, it was visible but with no permissions.  Try it with root:
wskellenger@marquette ~ $ sudo $(which fastboot) devices

ZY223R9KC9 fastboot

Obtain the unlock (unique to your phone):

wskellenger@marquette ~ $ sudo $(which fastboot) oem get_unlock_data

(bootloader) slot-count: not found
(bootloader) slot-suffixes: not found
(bootloader) slot-suffixes: not found
(bootloader) Unlock data:
(bootloader) 3A45210437945222#
(bootloader) 5A5932323352394B4339004D6F746F2047200000#
(bootloader) 5342C312F53218107391149534B38F6928DBBD07#
(bootloader) C6506801000000000000000000000000
OKAY [  0.103s]
finished. total time: 0.103s

Format the unlock seed:

Copy the output lines and paste them into vim.  Then do:

(note the search/replace command at the bottom)
:%s/(bootloader) //gc

Accept all replacements.  You now have this:

Place your cursor on the first line and type "4gJ" to join all of the lines without spaces:

Get your unlock key from Motorola:

Go here, and paste the string you created above from vim into Motorola's webpage:

A friendly/pleasant (really!) email will arrive with the unlock code:



If you are comfortable with this, unlock it with:

sudo $(which fastboot) oem unlock [your key here]

You have to run the command twice:

Install TWRP

Get what you need

This post from xda-developers describes what you need.

Download the TWRP image

The TWRP image is available here.

Verify image integrity

You should confirm integrity of the download by also downloading the md5 file, and checking that the first few/last few characters of each md5 agree:
wskellenger@marquette ~/Downloads $ md5sum twrp-3.0.2-0-athene.img
1c3ed996a8e978c05bfd25da47eb1e47  twrp-3.0.2-0-athene.img

wskellenger@marquette ~/Downloads $ cat twrp-3.0.2-0-athene.img.md5
1c3ed996a8e978c05bfd25da47eb1e47  twrp-3.0.2-0-athene.img

Use mfastboot to flash the recovery image

mfastboot is a motorola specific fastboot utility.  You can find it on  Use it to flash the recovery image.  Here I'm also updating the logo so I don't have the annoying bright white warning about the unlocked bootloader.

Reboot into TWRP recovery

While you are still in the bootloader, you can use the up/down arrows to highlight "recovery" and the press the power button to go into recovery.

When you see TWRP recovery appear, great!  The updated recovery works.  You can reboot the system and set up your Google account, restore your backups, etc.  Note: you aren't rooted yet.

Install SuperSU

Thanks to this post on XDA.

From the phone's browser, download the SuperSU zip from here:

Shut the phone down, and reboot into TWRP recovery.  Go into the terminal by selecting Advanced-->Terminal.

Inside the terminal, type the following (exactly as written, obeying all spaces, etc.) and press enter:
echo SYSTEMLESS=true>>/data/.supersu

In TWRP, exit the terminal.  Press the home button.  

Install the SuperSU zip from your phone's download directory.  The exact version I used:

Reboot the phone.  

It may reboot itself once after this.  When the phone boots, SuperSU will be in the app list.  

Saturday, December 10, 2016

Don't Be a Cotton Headed Ninnymuggins T-Shirt Iron-On Transfer Design

This line from Will Ferrell in the movie Elf has turned into a bunch of t-shirts.  

When my wife wanted one for a Christmas party we were going to, I decided to duplicate one of the designs by hand in Inkscape, which would then allow me to resize it as large as I wanted without distortion.  I already had some iron-on transfer paper in stock.

Here's the inkscape svg file if you want to iron-on this design to your own t-shirt.

Sunday, July 10, 2016

"Obsolete" Yamaha/Mando Marine Alternator Drop-In Replacement for YSC-10140-01-AC

The short version:

Smoked 51A Mando alternator
Yamaha part number YSC-10140-01-AC
Mando part number A000B0511
  • 25 year old alternator with Yamaha part number YSC-10140-01-AC failed
  • An exact replacement is no longer available
  • This one worked as a replacement
  • Do your own research, don't blame me if it doesn't work for you.

The long version:

My dad has a 1993-ish Sylvan Barritz that he purchased new.  The boat gets used only about 3-4 months out of the year, and pretty infrequently at that.  Still, our family has gotten almost 25 years of enjoyment out of this boat with relatively little trouble.

Last year (2015), he had a little bit of trouble with a 60A breaker between the alternator and the battery that kept tripping.  One time it tripped and would not reset while he was out in the middle of the bay with some friends.  The solution at that time was to simply eliminate the breaker, which would let them at least get back to shore.  The thinking was that maybe the breaker was flaky after all of the time the nearly 25 year-old boat spends sitting, from fall through spring.

Still enjoying the heck out of this 90s Sylvan Barritz that my dad bought new
(2012 Photo)
This year (2016) he had the entire boat reupholstered, and it looks like new.  He was excited to get it on the water, and my kids were excited to go swimming, so for the first voyage this year he and I decided to take it out and iron out any kinks from sitting all winter.  Launching was fine, and after a little cranking she started right up.  We headed east from Gladstone across Little Bay de Noc for our shakedown run.  The boat was running well and we got her right on plane.  Things were looking fine until about half way across the bay the engine suddenly died and smoke started pouring out from under the engine cover.

Some quick investigation and we found that the 'bush fix' of eliminating the 60A breaker was thankfully not done in a serious or long term way.  The two 8 gauge wires that were meant to be connected and protected by the 60A circuit breaker were smoking and mostly melted, and the small sheet metal screw that was intended last year as a stop gap measure to hold them together had thankfully let go, preventing a major fire.

The boat has made hundreds of trips across Little Bay de Noc.
Often my dad will take multiple trips carting family and friends over
to a nice swimming area on the east side of the bay.
(2013 Photo)
Obviously, we had a dead short on our hands somewhere.  Nothing else in the boat would draw as much current as an oven, which given the smoke and melted wires, is what we had.  We waited a bit for the wires to cool and then tried to touch them together where they had formerly been held with a screw.  This produced a violent arc, as the two red wires were now somehow one red, one black.

Tracing the heavy wire around the back of the engine we discovered that the wire attached to the back of the alternator was somewhat melted-looking.  This indicated that somehow internally the alternator had failed, causing a dead short to ground.  It was now clear that the 60A breaker tripping in 2015 was a warning shot; the alternator was telling us that it had provided almost 25 years of service and could do no more.

Luckily my dad had a few tools on board, so without too much trouble we pulled the main wire from the back of the alternator and again tried to touch the red wires together.  This time, no arc.  This confirmed the suspicion that the alternator was the cause of the short, and without the 60A breaker in the circuit the wires had no choice but to become toaster elements.

We were able to start the boat up and run it back to shore without the alternator, knowing that the battery would power the starter and ignition system, but without the alternator we would only be okay as long as the battery would stay about 9-10V or so.

After landing the boat we pulled her home and I pulled out the old alternator.  We found it had a lot of missing cooling fins and the unit would rattle when shaken.

Sidebar:  Let me briefly describe the engine in this boat.  It is a GM-derived 3.0L 4 cylinder.  Someone should write up the entire history of this thing, but from what I've read, it appears to be developed for marine use by Mercury Marine (however some sources say Yamaha developed it).  Some people say it derived from the 2.5L iron duke, others say no, it was an older engine.  Nevertheless this engine seems to have a home in lots of boats.

The stern drive is another story.  This particular one is from Yamaha, and from what I can tell it is quite rare in the US.  A search of marine forums for "Yamaha 3.0L stern drive" and you will find posts where people are in search of parts, or they bought such a boat as a 'project boat' and quickly found they can't find parts for the stern drive.

Still, I thought finding an alternator would not be a big deal for this thing.  Another side note: I quickly discovered that you *must* use a marine alternator replacement, as they are fitted with spark arresting devices to avoid igniting the fumes in the engine compartment.  Do NOT attempt to replace this alternator with an automotive unit!

A first search yielded a guy trying to sell this exact alternator, used, for $300:

Absolutely no way would I purchase a 25 year old alternator for $300.  I blurred out the seller name above as I don't want this to reflect badly on him; if he can get $300 for it, more power to him.  But having the exact replacement isn't necessary.  If I can get a 60A unit or a 40A unit it should work fine.  (Even a 90A unit would be fine if I knew that the wires would handle the current and the existing circuit breaker were upgraded.)

You can search around and find out more panic-inducing results like this one from, indicating that it is NOT AVAILABLE and OBSOLETE even thought it used in a lot of different marine engines:

$301 new, but obsolete and not available

Finally I hit on DB Electrical and their AMN0016, which is also available at their Amazon Store.

Specs are nearly the same.  The stock alternator was 51A, this one is listed as 55A.  It is marine-grade.  It has a one year warranty.

The only difference I can find, physically, is that this unit has a single pulley while the stock unit had a double pulleys, for use in two different mounting applications.  Still, if you need a different pulley offset in your application you can swap out the single pulley for the double that you already have.  So don't scrap the existing one until you have the new one in your hands.

I tried calling DB Electrical to discuss this application before I bought it but their tech support line on July 5th was busy, with > 20 minute wait time, so I decided to just order it.  As long as the housing matched the picture it should work fine.  The bolt that it pivots on is a huge 1/2" grade 8 monster, and that hole diameter and the width of the mounting 'foot' was what I was going to ask about.

Here it is installed.  Note the single pulley that came on it was perfectly aligned.  It is literally a drop-in replacement.

DB Electric AMN0016 installed, replacing the broken YSC-10140-01-AC 

The datasheet that came with it:

I wasn't there for the first trip after installation but my dad reports that it worked flawlessly.  He notes that it isn't charging at idle, but just above idle he is seeing 14V on his voltmeter.  This seems to be confirmed by the datasheet above; there is no current output until about 750 rpm or so.  This might be remedied by swapping on a slightly smaller pulley if you need charging while at idle.  Typically you're not sitting and idling the boat for long so I don't think this is a problem.

Disclaimer:  I post this information in the hopes that it helps someone else.  You are responsible for your own property and you are responsible for doing your own homework and research.  If you are not comfortable with a non-standard replacement, you can have the original unit rebuilt (find a starter/alternator repairman), or you can try your luck with a 25 year old used replacement.