Even though MediaTek chips are used in many devices, there is not much of a community around it. Angelo used to play with Qualcomm mainly, but now he’s been working with MediaTek in Chromebooks.

sched slides

There is some OpenWRT community around Ralink, which is now MediaTek. Mostly, though, there is community around Chromebooks because some of them use MediaTek CPUs. MediaTek chips are also often used on (cheaper) smartphones, but there’s not much community around that (mostly around Qualcomm).

For debugging, you need additional hardware. On chromebooks there are three serial ports exposed in the USB-C connector. There’s an off-the-shelf cable that exposes them as USB. On smarthpone, it’s harder though – soldering on tiny test pads will be required.

For chromebooks, the downstream kernel maintained by Google is usually not too old, and it’s in git. For smartphones, at best you get a kernel tarball. Chromebooks have recovery images that can boot from USB, but for smartphones they an be hard to find and may need special additional tools.

When hacking the kernel, there are a lot of tools that can make your life easier. E.g. scripts to generate flashable images, maintained by Collabora. Or in the kernel tree: checkpatch, bloat-o-meter, smatch.

To bring up the kernel at all, you need serial, pinctrl, clocks and a device tree. For a bit more functionality, there’s PMIC, storage (eMMC), display.

Since the bootloader usually leaves the serial part configured, you can do early printk by writing directly to the registers.

You’ll often start from the vendor kernel. If that’s older than 3.18, it’s a lot of pain and suffering to map the C code bitmasks into a device tree specification. For recent things, it’s mostly a matter of adapting the properties in the device tree. The more tricky part is the PMIC, because you may actually damage the device if it’s done wrong.

To complete the upstreaming work, tests and coverage are more important than you’d think. Intel 0-day helps because it tests on different architectures that you’re not going to test on yourself. KernelCI helps because it actually boots the kernel. Collabora’s MediaTek tree is registered in it. It also auto-bisects.