Lenovo ThinkSmart View ROM/OS Development

Continuing the discussion from Is this the perfect standalone tablet for HA?:

It should be possible to port a newer OS onto these devices. I currently see two options:

  1. AOSP (or something like LineageOS).
    I am personally not super familiar with the Android ecosystem on the OS layer. From my quick looking at it today it seems that we would need to build the Kernel with the device specific pieces and then wrap a custom ROM that brings the updated userland.
    Similar devices: Lenovo Tab4 8 Plus and Lenovo Tab4 10 Plus. The Lenovo Tab4 10 Plus has TWRP support and some LineageOS support: GitHub - lukaspieper/android_device_lenovo_tb_x704f: LOS 18.1 for Lenovo Tab4 10 Plus (TB-X704F)

  2. postmarketOS
    This is more on the vanilla embedded Linux side, which I am more familiar with. Benefit here is that we would be able to run a pretty recent (e.g. 6.6.x) kernel on this device. But the userland would be a Linux distribution, not Android. So a lot of nice things that Android gives us would need to be built from scratch (I’m thinking voice assistant integration).

A few basics about the device:

  • Qualcomm SDA624 SoC: This seems to be a marketing model number for “home hub devices”. It’s actually a APQ8053 which is a close relative of the Snapdragon 625, which also was part of many phones and tablets in 2017/2018. It is well supported by the mainline kernel.
  • Focaltech FT8201 driven 8" touchscreen: My guess is, it’s this part: 8 Inch 800*1280 Vertical TFT LCD Display - Kingtech Group Co., Ltd.
    No upstream driver yet, but one that looks to function very similarly to the one provided in the GPL sources.
  • TI TAS5782M Audio Amplifier: Driver is custom, because it loads in some initialization values that are unique to the board/design. But the driver is part of the GPL Sources, so we have it if we need it.

Links

Lenovo

LineageOS

postmarketOS

Miscellaneous

Customization

Some notes on customization(s) applied to kingston-ha-rom:

All the files referenced below can be found here.

Splash

  • From uboots perspective the screen is 800x1280, portrait orientation
  • The splash screen loaded by uboot is just the first frame of bootanimation.zip
  • The image data must be RLE and have an appropriate header prepended
  • logo_gen.py generates the RLE section from PNGs
  • append to kingston-splash-header.bin
  • logo_gen.py depends on python2 PIL, I use it in a container of debian oldstable

Bootanimation

  • screencapped @andyfitz’s animation
  • used shotcut to export a webm of the animation in the correct resolution
  • ffmpeg to rip the frames
  • pngquant to reduce their size
  • shoved it all into the right dir structure with desc.txt and zipped

boot image

  • must be signed, any signature will do
  • for testing, the magiskboot utility can place a default signature in a repacked image (i.e. magiskboot sign)

chromium / webview

  • building chromium with the package name “com.google.webview” makes it much easier for users to update system webview

PMOS Installation

Windows instructions

Prerequisites

Install EDL

  • Open Windows PowerShell (not ISE)
  • Run the following:
mkdir ~/git
cd ~/git
git clone https://github.com/bkerler/edl
cd edl
git submodule update --init --recursive
python -m venv venv
.\venv\Scripts\Activate.ps1
pip3 install -r .\requirements.txt
  • Leave this window open

Put the ThinkSmart into EDL mode

  • Unplug the device
  • With the device standing up in portrait mode (camera at the top left) remove the plug on the right side of the screen to access the USB-C port and connect it to your computer.
  • While holding both the Vol - and + keys (left side of the screen), plug in the barrel connector to power it up. You should see the screen flash and then remain dark.

Update the USB driver

  • Install Zadig and run it
  • Click the dropdown to select QUSB__BULK and click “Reinstall driver”
    image

Flash PMOS

  • Back in your PowerShell window, run the following:
python3 edl w boot ~\Downloads\lk2nd-lenovo-cd-18781y-latest.img
python3 edl w userdata ~\Downloads\pmos-lenovo-cd-18781y-testing-latest-rootfs.img
Sample output
(venv) PS C:\Users\chris\git\edl> python3 edl w boot C:\Users\chris\Downloads\lk2nd-lenovo-cd-18781y-latest.img
Qualcomm Sahara / Firehose Client V3.62 (c) B.Kerler 2018-2023.
main - Trying with no loader given ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: firehose
main - Trying to connect to firehose loader ...
firehose - logbuf@0x080700D8 fh@0x0806CF40
firehose_client
firehose_client - [LIB]: ←[33mNo --memory option set, we assume "eMMC" as default ..., if it fails, try using "--memory" with "UFS","NAND" or "spinor" instead !←[0m
firehose - TargetName=MSM8953
firehose - MemoryName=eMMC
firehose - Version=1
firehose - Trying to read first storage sector...
firehose - Running configure...
firehose - Storage report:
firehose - total_blocks:15269888
firehose - block_size:512
firehose - page_size:512
firehose - num_physical:3
firehose - mfr_id:21
firehose - serial_num:4044472363
firehose - fw_version:6
firehose - mem_type:eMMC
firehose - prod_name:8GTF4R
firehose_client - Supported functions:
-----------------
firehose -
Writing to physical partition 0, sector 790528, sectors 427
Progress: |██████████| 100.0% Write (Sector 0x1AA of 0x1AA, ) 20.84 MB/s
Wrote C:\Users\chris\Downloads\lk2nd-lenovo-cd-18781y-latest.img to sector 790528.
(venv) PS C:\Users\chris\git\edl> python3 edl w userdata C:\Users\chris\Downloads\pmos-lenovo-cd-18781y-testing-latest-rootfs.img
Qualcomm Sahara / Firehose Client V3.62 (c) B.Kerler 2018-2023.
main - Trying with no loader given ...
main - Waiting for the device
main - Device detected :)
main - Mode detected: firehose
main - Trying to connect to firehose loader ...
firehose_client
firehose_client - [LIB]: ←[33mNo --memory option set, we assume "eMMC" as default ..., if it fails, try using "--memory" with "UFS","NAND" or "spinor" instead !←[0m
firehose - TargetName=MSM8953
firehose - MemoryName=eMMC
firehose - Version=1
firehose - Trying to read first storage sector...
firehose - Running configure...
firehose - Storage report:
firehose - total_blocks:15269888
firehose - block_size:512
firehose - page_size:512
firehose - num_physical:3
firehose - mfr_id:21
firehose - serial_num:4044472363
firehose - fw_version:6
firehose - mem_type:eMMC
firehose - prod_name:8GTF4R
firehose_client - Supported functions:
-----------------
firehose -
Writing to physical partition 0, sector 6890512, sectors 4833280
Progress: |██████████| 100.0% Write (Sector 0x49B800 of 0x49C000, ) 27.39 MB/s
Progress: |██████████| 100.0% Write (Sector 0x49C000 of 0x49C000, ) 25.65 MB/s
Wrote C:\Users\chris\Downloads\pmos-lenovo-cd-18781y-testing-latest-rootfs.img to sector 6890512.

Reboot

Unplug the device and plug it back in. You should see a Lenovo logo followed by the postmarketOS logo.

PostmarketOS Status

Kernel 6.7.5 (branch 6.7.5/main): GitHub - msm8953-mainline/linux: Linux mainline kernel with WIP patches for msm8953 devices

:white_check_mark: eMMC Storage (working as of 2024-02-14)
:white_check_mark: Simple Framebuffer (working as of 2024-02-14)
:white_check_mark: GPU (working as of 2024-02-15)
:white_check_mark: Display Panel (working as of 2024-02-15)
:white_check_mark: Touchscreen (working as of 2024-02-15)
:white_check_mark: Backlight (working as of 2024-02-14)
:question: Proximity Sensor (kinda contingent on Draft: Qualcomm Sensor Manager support (MSM8996 & Co. SSC) (!4118) · Merge requests · postmarketOS / pmaports · GitLab)
:white_check_mark: Buttons / Switches (working as of 2024-02-14)
:white_check_mark: USB Networking (working as of 2024-02-14)
:white_check_mark: WiFi (working as of 2024-02-15, added support for the chip to ath10k, not fast though, ~20 Mbit/s)
:white_check_mark: Bluetooth (working as of 2024-02-15, tested with Bluetooth Keyboard)
:white_check_mark: Sound output (working as of 2024-02-22)
:white_check_mark: Microphones (working as of 2024-03-04)
:x: Camera (very little hope on this one)

29 Likes

I’ve made the first post a Wiki, so feel free to edit. I will eventually move the current content from my first post into this one so we can have the the first post for all the relevant info as a wiki.

Thanks for creating this thread.

I’m excited to help the community make this device even better!

Here’s the repo for my dev notes:

https://github.com/mattmon/kingston-ha-rom/

UPDATE: after having reviewed @FelixKa’s excellent findings above. I think it’s going to be fastest and easiest to just port lineageOS. It’s already really close.

We only get Android 11, but thats probably good enough.

I’m currently working on building TWRP for the CD-18781Y.

5 Likes

One thing we will for sure need to figure out is how to unlock the Bootloader. The XDA posts suggest that it cannot currently be unlocked without the device going into Diagnostics Mode (aka 900E). If we can’t unlock it, we can’t boot non-stock kernels.

It is unlocksble, iirc the necessary keys and exploit are included in @deadman96385’s ‘user’ rom on XDA.

(I might be confusing between the different Lenovo smart displays though, haha)

Or can do it via fastboot:

fastboot oem unlock-go

Though, I don’t think we need it. In my testing, the boot loader would attempt loading any boot.img with a signature.

Literally any signature, it’s just needs to be signed.

That’s both very encouraging but also shocking for a device that’s tailored to businesses :sweat_smile:

Right now my focus is on figuring out Android development a bit more. I’m pretty sure I could get something going quicker with postmarketOS, but I believe the value is greater to have the Android platform available. So I’ll invest my time there first.

Starting to play around with LineageOS as I remember using it previously with my Nexus devices.

1 Like

I’m doing the same.

Also compiling my notes from hacking on the stock rom. Some stuff is ready for integration, like the boot splash generation and chromium build tweaks. Will post it as much as I can, ASAP.

Here’s a good resource on creating device trees.

Agree on AOSP being the preferred distro, it has the widest appeal, IMHO.

Will we target API 34 (android 14, latest?)

Thoughts on treble support?

We’ll also have to put some thought into what we want the partition structure to look like.

It might be nice to update the boot animation to utilize the new HA logo. any artists want to contribute?

Quick thought on this, openwakeword can run natively on Linux. Voice assistants like Okay Google or Alexa would be a no go, but you could probably get the local HA assist pipeline running (I haven’t personally done it though).

Would it be possible to do lineage or aosp14 any gsi stuff maybe a little more modded towards the device to fix the quirks I noticed Xiaomi Redmi Note 4/4X and Xiaomi Mi A1 both with 625 soc. Got some sort of android 13/14 derivative roms going on there with the latter one having one based off the aosp Gsi rom as far as I’m aware. So maybe that helps especially since CPU pops in cpuz as 625 although it’s 624 :joy:which I feel is just downclocked 625 from 2.0 to 1.8 typical rebadge. Also found the guide on exactly how they got treble to work on A1. Hopefully we can get A11 or newer going as some of the newer apps minimum requirement is starting off at 11 now if we can get on 13 14 would be nuts. I wonder if a mild overclock would be possible as well since temps seems to be pretty decent.

Https://xdaforums.com/t/guide-q-a-treble-from-stock-to-treble-everything-you-need-to-know.3793734/

Thanks for the link.

Treble seems like a pretty big up front time investment. Would also significantly complicate user installation.

If we can get a monolithic rom built from a modern sdk revision, we’ll have more time for getting stuff we care about working.

Remember, we’ve only got 8GB, so should try to keep things pretty light and stick to the use case of a home assistant dashboard.

I’m of the opinion that the rom should be released as a userdebug variant with selinux=permissive, to facilitate maximum end user customization.

Additionally that would free us from having to worry about much of androids security model. At the same time it will limit app availability, but you probably shouldn’t be doing your banking from this thing anyway :stuck_out_tongue_winking_eye:

1 Like

The idea of postmarketOS is pretty cool.

Seems like it would be a much more powerful way to experiment with this device.

Probably wouldnt have as broad an appeal as lineageOS for the vast majority of HA users, unless it was really polished.

Might be an interesting contender in the Voice Assistant Contest

how do i get the webview updated everytime i try i get stuck in a boot loop and have to reset to factory

Will likely be one or several devs in here working on the device if you all would like feel free to come through :pray:t4: the more heads the quicker can get done :white_check_mark: they will likely be working on lineage but can’t confirm that as of yet bc its pretty early.

Hey I could help test some builds out when it gets to that point. Could you post a discord invite? Not sure what server that channel is on. thx!

@FelixKa & @Endlessvoid have gotten me all excited about postmarketos now, lol.

After reviewing the posts in this thread and going down the voice rabbit hole, I’ve seen the light, lol.

I actually think linux on this device would be the ultimate hackable dashboard / voice assistant for HA.

There’s so much more possibility to do cool stuff with wake word detection and voice satellites. We can also do all the same dashboard stuff we can do with android.

Performance would probably be about as good as it gets on this device.

Plus, it would be way easier to port a Linux based system to new devices. Eventually the thinksmart supply will dry up and we’ll all move on to the next big thing.

That said, I still think mass appeal is probably in android. So both ideas have merit.

My thoughts on moving forward:

  1. The devs working on lineage with @Gh0sty can carry the torch forward with kingston-ha-rom. I’ll, of course, help however I can.

  2. @FelixKa and others interested (including myself) can start a new project. My idea for a name is ‘assistOS’ lol :laughing:

1 Like

@mattmon feel free to pop in as well most welcome :pray:t4:

And ofc we are from gaming community so the rom we will be working on will be geared towards performance mainly and gaming however ofc in the end the result would be that ppl can use for whatever including HA naturally.

One of the main first goals at the moment we are looking at is implementation of OTG through the USB c port so can plug USB c nvme SSDs to exponentially increase available storage. seems it doesn’t run in the right mode by default lmk if anything on that front

Also can you link me where it talks abt mainline kernel support?

1 Like

@mattmon You look into overclock as well :pray:t4:

https://www.reddit.com/r/EmulationOnAndroid/comments/qzbn8n/how_tf_can_he_oc_a_sd625_mobile_cpu_to_31ghz/

Seems to be quite possible especially if are considering Linux seems like this can hit 3 ghz in the mid 70 range of temps which is more than acceptable :eyes:albeit this is a gaming post :joy:not sure how much is fud but either way show can OC and to a good extent comfortably without lotta heat​:pray:t4:

1 Like

In terms of supply you should also look into scooping the civilian the variant of this as platform itself cpu etc is identical so porting Lin to both at same time would open up even more doors for ppl looking to use.

This one has upgraded screen 10 inch 1200p instead 800p and 2 speakers instead downfall being less eMMC only 4gb but as I mentioned above if figure out USB c otg that would become non issue

2 Likes

Now now…

1 Like