RedPill-TTG / redpill-lkm

Linux kernel module for RedPill
GNU General Public License v3.0
307 stars 174 forks source link

Fix serial ports mess & add inversion #6

Closed ttg-public closed 2 years ago

ttg-public commented 2 years ago

Currently two (for Linux v3) or three (for Linux v4) real serial ports are needed to see full logs. This is inconvenient at best. LKM should be able to handle that using just a single port.

There are three issues at play here:

Serial inversion

https://github.com/RedPill-TTG/dsm-research/blob/master/quirks/serial-port-swapping.md In short if a system is doing this we need to reverse that to have all ports as they are physically.

Kernel console

For some reasons we cannot use the same serial port for earlycon and console or otherwise no logs are printed. However, this is probably a PEBKAC as this should work under normal circumstances.

mfgBIOS port usage

The bios module is hardcoded to use /dev/ttyS1. This means we need to avoid that serial port. This is why on v4 running under 918+ there are 3 serial ports:

On 3615xs we get away with two:

ttg-public commented 2 years ago

After a painful journey we "fixed" it in https://github.com/RedPill-TTG/redpill-lkm/commit/c390f74e48bbe87ecc7ff898402cd87dc4d62f38

We're not happy with this fix as ttyS0 and 1 are still swapped but at least the console appears on the correct serial port.

We also added much more details to the docs: https://github.com/RedPill-TTG/dsm-research/blob/master/quirks/serial-port-swapping.md