Smartphones #2: Working phone? Ain’t nobody got time for that


This phone has a “working” pmos port, if you consider a phone that reboots after 2 minutes as a working one. I wanted to try to flash newest  Linux kernel on it but here’s the problem:

New kernel uses pretty easy to edit and maintain  dtb files that contains all information about phone, SoC and other hardware components. But before that all these information were hard-coded in the kernel, often i many different files, making it harder to edit and update. I’d have to write dtb file from scratch, using old source as a base. Since it’s nice to see what are you doing, I need some kind of output to know what happens inside the phone. Sadly, creating dtb file from scratch I must acknowledge that sound, USB, screen and basically nothing that would help me will work yet :/. There is however one thing that should work always: UART(see glossary), a good old text mode.

Here lies the problem, or rather several problems. The first one is where is UART physically located  in the device, fortunately UART on Samsung devices is easy to get.

Micro-USB plug have 5 pins, as opposed to four in regular USB plug used in PC. By connecting ground and ID (this is that additional pin) through various resistors the phone changes function of USB socket.

When these two pins are disconnected the USB port works as usual allowing you to connect smartphone to PC; 300kΩ — phone enters  download/fastboot mode, on some models the yellow triangle warning about unofficial software disappears (sadly not on this one).

UART mode had caused me some trouble, since there are several similar modes but only few of them are useful to me. So I built small resistor box to test the phone with most popular resistor values, which should make this part easy.

The second issue is what is needed in the dtb file to start and use UART or get any kind of output running, which I’ll probably have to determine experimentally. For now I’m thinking about two solutions: first one is to use “earlycon”, which, in theory, requires only UART address and hopefully the kernel should so everything automatically ; the second solution requires defining where is serial port, its parameters, clocks etc, and that involves digging through the old kernel source code in search for answers.



I wrote more than I initially thought I would, I see that I really need to polish my English, hopefully writing more or less regularly will help me with that 🙂 When it comes to smartphones I’ll probably focus on this phone for a while, the next part of the series will have to wait though as I have more urgent things to do, there is a possibility of new blog post about Google Cardboard VR in near future 🙂



DTS is a compiled DTB file, also known as  Device tree, that file contains information about all components of the device, such as CPU, GPU, memory, screen, etc. It allows to compile one generic kernel which then reads DTS file and activates needed peripherals instead of compiling specialized kernel for each phone.

UART (a.k.a serial port, rs232, COM port) — very simple communication protocol, easy to implement even when nothing else is working

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.