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 8 (EMUI 8.0)
Extended version 9 (EMUI 9.1)
postmarketOS
Category testing
Pre-built images no
Mainline no
postmarketOS kernel 4.9.337
Features
Flashing
Broken
USB Networking
Works
Internal storage
Works
SD card
Works
Battery
Works
Screen
Broken
Touchscreen
Multimedia
3D Acceleration
Audio
Camera
Camera Flash
Works
Connectivity
WiFi
Works
Bluetooth
GPS
NFC
Modem
Calls
SMS
Mobile data
Miscellaneous
FDE
USB OTG
HDMI/DP
Sensors
Accelerometer
Magnetometer
Ambient Light
Proximity
Hall Effect
Haptics
Barometer
Power Sensor


Contributors

Users owning this device

  • Pentiumpro (Notes: Ported, fixing display, then other problems)

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.

  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