Jump to content

Huawei P Smart (huawei-figo)

From postmarketOS Wiki
Huawei P Smart
will add picture
will add picture
Manufacturer Huawei
Name P Smart
Codename huawei-figo
Model FIG-LX1
Released 2017
Type handset
Hardware
Chipset HiSilicon Kirin 659
CPU 4x 2.36 GHz Cortex-A53
4x 1.7 GHz Cortex-A53
GPU Mali T830 MP2
Display 1080x2160 IPS LCD
Storage 32/64 GB, microSD up to 256 GB (uses SIM slot)
Memory 3/4 GB
Architecture aarch64
Software
Original software Android
Original version
The version the device was shipped with.
8 (EMUI 8.0)
Extended version
The most recent supported version from the manufacturer.
9 (EMUI 9.1)
FOSS bootloader no
postmarketOS
Category testing
Pre-built images
Whether pre-built images are available here.
no
Mainline
Instead of a Linux kernel fork, it is possible to run (Close to) Mainline.
no
pmOS kernel
The kernel version that runs on the device's port.
4.9.337
Features
Flashing
It is possible to flash the device with pmbootstrap flasher.
Broken
USB Networking
After connecting the device with USB to your PC, you can connect to it via telnet (initramfs) or SSH (booted system).
Works
Internal storage
eMMC, SD cards, UFS, ...
Works
SD card
Also includes other external storage cards
Works
Battery
Charging and battery level reporting works
Works
Screen
Display works. Ideally with sleep mode and brightness control.
Partial
Touchscreen
Works
Multimedia
3D Acceleration
Untested
Audio
Audio playback, microphone, headset and buttons.
Untested
Camera
Untested
Camera Flash
Works
Connectivity
WiFi
Works
Bluetooth
Untested
GPS
Untested
NFC
Near Field Communication
Untested
Modem
Calls
Untested
SMS
Untested
Mobile data
Untested
Miscellaneous
FDE
Full disk encryption and unlocking with unl0kr.
Untested
USB OTG
USB On-The-Go or USB-C Role switching
Untested
Sensors
Accelerometer
Auto screen rotation works in desktops e.g. Phosh or Plasma Mobile
Untested
Magnetometer
Sensor to measure magnetism
Untested
Ambient Light
Untested
Proximity
Untested
Hall Effect
Also known as flip cover sensor
Untested
Haptics
Untested
Barometer
Sensor to measure air pressure
Untested
Power Sensor
Sensor to monitor current, voltage and power. Not fuel gauge!
Untested


Contributors

Users owning this device

  • Deviled (Notes: It's actually a Mate 10 lite, but with P Smart Firmware)
  • Pentiumpro (Notes: Ported, fixing display, then other problems)
  • Zvava (Notes: stock, debloated with firewall, cracked screen)

How to enter flash mode

Flashing can be done through TWRP (flash with fastboot. Fastboot can be entered by pressing power and volume down while connected to a computer. TWRP can be entered by pressing volume up and power while not connected to a computer.

Installation

Since Huawei changed the partition layout, there is no more boot partition, turning it into a single kernel partition, forcing us to use erecovery kernel and ramdisk partition (isorec trick could likely be used instead, needs testing).

  1. Get mkbootimg and unpackbootimg i.e. from here
  2. You can extract the kernel-image and ramdisk from the created boot.img with unpackbootimg.
    $ # copy created boot image to current directory 
    $ cp ~/.local/var/pmbootstrap/chroot_rootfs_huawei-figo/boot/boot.img .
    
    $ # extract the created boot.img
    $ mkdir pmos-boot-huawei-figo
    $ ./android-unpackbootimg/unpackbootimg -i boot.img -o pmos-boot-huawei-figo/
    
    Use the extracted files in the following steps.
  3. Create ramdisk image:
    $ # create new ramdisk image with empty kernel (/dev/null) 
    $ ./android-unpackbootimg/mkbootimg.py --kernel /dev/null --ramdisk pmos-boot-huawei-figo/boot.img-ramdisk.gz --cmdline 'buildvariant=user' --os_version 9.0.0 --os_patch_level 2019-06-05 -o pmos-figo.ramdisk.img
    
  4. Create kernel image:
    $ # kernel (with empty ramdisk via /dev/null):
    $ # make sure boot.img-huawei-figo-zImage is gzipped or do it manually before mkbootimg.py
    $ gzip -c pmos-boot-huawei-figo/boot.img-zImage > pmos-boot-huawei-figo/boot.img-zImage.gz
    $ ./android-unpackbootimg/mkbootimg.py --kernel pmos-boot-huawei-figo/boot.img-zImage.gz --ramdisk /dev/null --cmdline 'loglevel=4 coherent_pool=512K page_tracker=on slub_min_objects=12 unmovable_isolate1=2:192M,3:224M,4:256M printktimer=0xfff0a000,0x534,0x538 androidboot.selinux=enforcing buildvariant=user' --base 0x00478000 --kernel_offset 0x00008000 --ramdisk_offset 0x0ff88000 --second_offset 0x00e88000 --tags_offset 0x07988000   --os_version 9.0.0 --os_patch_level 2019-12 --pagesize 2048 -o pmos-figo.kernel.img
    
  5. Transfer to device with adb:
    $ adb push pmos-figo* /
    
  6. Flash ramdisk and kernel with dd inside twrp:
    # dd if=pmos-figo.kernel.img of=/dev/block/mmcblk0p28
    # dd if=pmos-figo.ramdisk.img of=/dev/block/mmcblk0p29
    
  7. Flash rootfs to sdcard to boot it

Additional Info

The display brightness can be set by writing a value between 0 and 4095 to /sys/class/leds/lcd_backlight0/brightness.

$ sudo -i
# echo 1024 > /sys/class/leds/lcd_backlight0/brightness

The torch/camera flash can be set by writing a value between 0 and 8 to /sys/class/leds/torch/brightness

$ sudo -i
# echo 5 > /sys/class/leds/torch/brightness

The vibration motor can be set by writing a value between 0 and 255 to /sys/class/leds/vibrator/brightness. Seems to also be additional values like duration, vibrator_min_timeout, state, and activate. Unknown what they do.

$ sudo -i
# echo 1 > /sys/class/leds/vibrator/brightness

Status LED at top of device can be set to red, green, blue, or a combination of those 3 by setting /sys/class/leds/(red green blue)/brightness to a value between 0 and 255. Delay in which the led is on can be changed by setting /sys/class/leds/(red green blue)/delay_off or /sys/class/leds/(red green blue)/delay_on to any value in milliseconds (seems to control all 3 colors at the same time).

$ sudo -i
# echo 100 > /sys/class/leds/red/brightness
# echo 100 > /sys/class/leds/green/brightness
# echo 100 > /sys/class/leds/blue/brightness
# echo 500 > /sys/class/leds/blue/delay_on
# echo 1000 > /sys/class/leds/red/delay_off

See also