This was semi-intentionally skipped in the intial port revival because the focus was on N810 at the time. This is mostly copied from the old 1.2.1 port and then cleaned up.