Skip to content

About

Linux 6.12 for the Unisoc UMS9117 (itel IT9220 feature phone): LCD, keypad, SD/MMC, NAND, USB, PMIC, audio, Wi-Fi/BT (Marlin2) and GSM DSP drivers, device tree, loader

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ums9117-linux

Linux 6.12 for the Unisoc UMS9117 feature-phone SoC, as found in the itel IT9220 (itel Neo X10+ 4G): board drivers, a device tree, a kernel config, a small boot loader and a build script that produces a bootable image from a vanilla v6.12 kernel tree.

Status: research-grade, tested on one phone. It boots to a shell on the LCD and over USB, mounts the SD card, reads the battery and RTC, and plays sound. It is not a phone OS: no calls, no SMS, no mobile data (see What does not work). Installing anything can brick a phone if you break the rules in docs/boot-and-recovery.md. You do this at your own risk, on a phone you can afford to lose.

Boot flow

flowchart LR
  subgraph stock[Stock firmware, untouched]
    ROM[Boot ROM] --> B1[BOOT0 / BOOT1] --> K[KernelImg]
  end
  K --> U[UserImg + launcher blob]
  U -->|hand-off, MMU off| L[loader/ at 0x81000000]
  L --> Z[Linux 6.12 + drivers/itel]
  Z --> S[shell on LCD, USB, SD]
Loading

Driver map

Photos

Photos: coming soon. No photos of the device running this exist yet.

What works, what is not proven

Seen working on the author's phone (stock build LS2404, kernel dated 2024-08-15):

  • boot: loader draws a status screen, Linux 6.12 starts, fbcon on the LCD, keypad as a keyboard (t9keys gives multi-tap typing), a shell;
  • LCD framebuffer (/dev/fb0) with backlight control;
  • keypad and power key (/dev/input/event0);
  • microSD (mmcblk0, FAT/exFAT, MBR/GPT), including the SDIO1 host for the Wi-Fi chip;
  • USB device port: serial console and USB network (telnet);
  • PMIC: RTC, battery/charger readings, flash and keypad LEDs, power off, restart, watchdogs;
  • ALSA loudspeaker playback;
  • the GSM DSP boots from firmware you supply and exchanges mailbox events with the driver;
  • Marlin2 Wi-Fi/BT/FM chip: firmware load, handshake, Wi-Fi scan, FM tune;
  • reading the phone's UserImg partition back from Linux, comparing it with an image (wota verify), and rewriting UserImg blocks with the stock BCH parity.

Not proven (written from reading the stock firmware, built, but not confirmed on hardware, or confirmed only partly):

  • Wi-Fi connect, DHCP and routes (wcnd): scan works, connect to a real access point was never run end to end. Bluetooth: not started.
  • FM sound: the chip tunes, but the path from the chip to the loudspeaker was not confirmed audible. The assumed DAC rate (48 kHz) is a guess.
  • Headset jack and headset button: the driver is written, not run with a headset. Headphone/earpiece audio routes are untested.
  • Audio details: speaker gain direction, the PA configuration byte, which microphone ADC is the main one, full duplex, latency of the DMA re-arm. Playback has no guard against a call owning the codec.
  • USB: serial and network work; sustained transfers and every packet length were not stress-tested, and the bulk endpoints run in PIO, not stock's DMA. The mass-storage and HID modes of usbmode have no test record.
  • Memory: Linux uses 48 MB (0x81000000..0x83fe0000) because nothing was seen writing to the upper part in a 20 s watch. It is not proven that nothing else in the SoC ever uses it.
  • The GSM DSP layer-1 protocol is only partly decoded (idle frames and power measurement); the NAND write path is proven on a handful of blocks of one phone, not on others.
  • Everything on other firmware builds, other IT9220 variants, or other UMS9117 phones.
  • The PREEMPT_RT kernel (RT=1) was the tested configuration of the original project; the default non-RT build was exercised less.

What does not work

  • Calls, SMS, mobile data (2G/3G/4G). The whole radio protocol stack lives in the stock MOCOR kernel, which Linux replaces. The original project ran stock's stack as a user-space process on top of the gsmdsp and irqfwd drivers; that needs the stock firmware images and is not part of this repository. The drivers are here, the stack is not.
  • Bluetooth, camera, GPS, vibration (no motor is fitted), suspend/idle power management (disabled in the config), SMP (single core).
  • A stock/Linux dual-boot switcher is not included (see docs/boot-and-recovery.md).

Hardware facts

SoC Unisoc UMS9117 (T117 / SC6531E class), 1x Cortex-A7 (ARMv7-A, MMU), about 1 GHz
RAM 64 MB DRAM; Linux gets 48 MB at 0x81000000
Storage 64 MB SPI NAND; microSD slot (SDIO0)
Display 240x320 ST7789 on SPI1, driven by the SoC LCDC
Input matrix keypad (no touch), red key = power
PMIC SC2720 on the ADI bus (0x40600000)
Interrupts / timers GICv2 0x12001000, Unisoc AP timer (sprd,sc9860-timer) or Cortex-A7 generic timer, auto-detected by the loader
USB Mentor MUSB device core 0x20200000, Type-C
Modem GSM DSP (CEVA TeakLite-4) + LTE Cat.1; stack runs on the AP in stock
Connectivity Unisoc Marlin2 (Wi-Fi/BT/FM, own Cortex-M4) on SDIO1
Audio VBC + AP DMA + SC2720 codec; loudspeaker, microphone, headset jack
Stock OS Unisoc MOCOR (ThreadX-style RTOS), not Android

More: docs/hardware.md.

Per-driver status

All drivers live in kernel/drivers/itel/ and are built into the kernel by build.sh.

Driver Gives you Status
ums9117-lcd.c /dev/fb0, fbcon, backlight works
ums9117-keypad.c /dev/input/event0 works
ums9117-mmc.c mmcblk0 (SDIO0); host for SDIO1 works
ums9117-musb.c USB device port (serial, network, mass storage, HID) works: serial and network; mass storage/HID modes untested
ums9117-pmic.c RTC, battery, charger, LEDs, headset, power off, restart, watchdog works except the headset (untested); no vibration motor on this phone
ums9117-audio.c ALSA card "IT9220" (speaker, microphone, FM path) playback works; microphone, headphone route and FM audio not proven
ums9117-gsmdsp.c /dev/gsmdsp (DSP firmware load, queues, mailbox) transport works; needs your own firmware; no GSM stack here
ums9117-irqfwd.c /dev/mocirq (modem interrupts to a user process) works; only useful with an external modem stack
ums9117-wcn.c /dev/wcn (raw access to the Marlin2 chip) bring-up and scan work; needs your own firmware; no BT
ums9117-nand.c /dev/userimg (read, optionally rewrite UserImg only) read/verify work; writes proven on a few blocks, guarded by allow_write=1

User-space helpers in tools/: t9keys (keypad typing on the console), wota (read/verify/rewrite UserImg), wcnctl and wcnd (Wi-Fi/ FM on the Marlin2 chip), wrec (microphone levels), gsmdspd (DSP remote control for bring-up). A small busybox userland is in rootfs/.

Proprietary firmware

This repository contains no firmware blobs, dumps or calibration data. The Wi-Fi chip and the GSM DSP run Unisoc firmware that is on your own phone; read it out of your own device and keep it private. What is needed and how to cut the pieces from a read-back: docs/firmware.md. Without those files the corresponding drivers still probe, but only report the chip id / refuse to start the DSP.

Build

Needs a Linux host with:

  • gcc cross toolchain for ARM Linux: arm-linux-gnueabihf-gcc (Debian/ Ubuntu: gcc-arm-linux-gnueabihf);
  • bare-metal ARM toolchain for the loader: arm-none-eabi-gcc, ld, objcopy (Debian/Ubuntu: gcc-arm-none-eabi binutils-arm-none-eabi; or set ARM_EABI to the toolchain's bin directory);
  • kernel build deps: make flex bison bc libssl-dev libelf-dev;
  • dtc (device-tree-compiler), cpp, cpio, xz, python3, git, curl;
  • a static armhf busybox as ./busybox-armhf (or BUSYBOX=path), e.g. from Debian/Ubuntu's busybox-static armhf package (usr/bin/busybox). Applets used are listed in rootfs/applets.txt.

Nix is optional: any environment that provides these tools works. Nothing in build.sh is distribution-specific.

git clone <this repository> ums9117-linux && cd ums9117-linux
./build.sh                       # clones v6.12 into ./linux on first run
# RT=1 ./build.sh               # with the PREEMPT_RT patch set (6.12.8-rt7)
# WCN_FW=/path/wcn.bin ./build.sh   # include YOUR OWN Wi-Fi firmware, see docs/firmware.md

Result in out/: zImage, it9220-sprd.dtb, it9220-arch.dtb, linux-ram.bin (the loader with the kernel and both trees appended, ready for a launcher hand-off), and static test programs in out/tools/ (copy those to the SD card; t9keys is already in the initramfs). build.sh modifies the kernel tree it is given (copies drivers/itel, adds one line to drivers/Kconfig and drivers/Makefile), checks that every =y option of kernel/itel.config survived olddefconfig, and builds the device trees twice (-DTIMER_SPRD, -DTIMER_ARCH): the loader measures which timer counts and patches the rate into the tree it picks.

The built linux-ram.bin contains the Linux kernel and one of its font tables, so that binary is distributed under GPL-2.0, even though the loader source is permissively licensed (see Licenses).

Booting it

Short version; read docs/boot-and-recovery.md first, in full.

  1. Never write BOOT0, BOOT1, KernelImg or NV. Only UserImg is ever written; it is recoverable through the hold-* download path. Back up the phone (and keep the backup) before touching anything.
  2. The stock kernel boots; a launcher blob in the stock UserImg stops stock, copies linux-ram.bin to 0x81000000 and jumps to +0x200 with the MMU off. The launcher is not part of this repository: it patches the stock UserImg of one exact firmware build, so it can only be built from your own phone's image and embeds stock code at its patch sites. The hand-off contract the loader needs is documented, so you can write your own.
  3. Once Linux is running, UserImg can be updated from Linux with wota (needs allow_write=1, only UserImg blocks are writable).
  4. Recovery: hold * while plugging in USB, get to download mode, write your backed-up UserImg with stock FDL1/FDL2 and spd_dump. Details, commands and caveats are in the doc above.

Shell access once booted: plug in USB; the phone is 192.168.7.2 on usb0 (serial console ttyGS0 is there too).

Repository layout and licenses

Path What License
kernel/drivers/itel/ board drivers, Kconfig, uapi headers GPL-2.0-only (uapi headers: with Linux-syscall-note)
kernel/it9220.dts device tree GPL-2.0
kernel/itel.config kernel config fragment GPL-2.0-only
tools/ user-space helpers: wota, wcnctl, wcnd, wrec, gsmdspd GPL-2.0-only (they share headers with the drivers)
tools/t9keys.c keypad typing MIT OR Apache-2.0
loader/ stage-2 boot loader, not kernel code MIT OR Apache-2.0
rootfs/ init, USB gadget, network scripts MIT OR Apache-2.0
build.sh, scripts/ build and helper scripts MIT OR Apache-2.0
docs/ hardware notes, boot and recovery, firmware MIT OR Apache-2.0

Full texts: LICENSE (GPL-2.0), LICENSE-MIT, LICENSE-APACHE. Files carry SPDX-License-Identifier headers; the header is the authority.

Credits

  • Ilya Kurdyukov and the spreadtrum_flash project (spd_dump, the UMS9117 boot key and download protocol notes) and the public-domain fpdoom UMS9117 layer, whose bare-metal LCD, SD, ADI and watchdog sequences this work started from (and is credited in the source comments).
  • The Linux kernel (timer-sprd, MUSB, GIC, the font used by the loader), the PREEMPT_RT team, BusyBox.
  • Unisoc and itel for the hardware. This is an independent reverse- engineering project, not affiliated with or endorsed by Unisoc, itel or Transsion. Names are used only to identify the hardware.

About

Linux 6.12 for the Unisoc UMS9117 (itel IT9220 feature phone): LCD, keypad, SD/MMC, NAND, USB, PMIC, audio, Wi-Fi/BT (Marlin2) and GSM DSP drivers, device tree, loader

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages