grate-driver / linux

Linux kernel with experimental patches for Tegra
Other
72 stars 50 forks source link

Running postmarketOS on a Acer Iconia Tab A500 with this kernel #8

Closed RQWorldblender closed 2 years ago

RQWorldblender commented 4 years ago

I had some success running postmarketOS running on a Acer Iconia Tab A500 within this week, with build files I published at https://gitlab.com/Worldblender/pmaports/-/tree/device/acer-picasso. However, during my testing, I found that the following aren't working or not fully tested:

Here are some images of this tablet running: IMG_20200613_213013 IMG_20200613_213313 IMG_20200614_152910

I would like to do more to enhance the experience on this tablet, but I'm not sure where I can started myself.

digetx commented 4 years ago

Hello Richard!

Very nice to see yours work on the pmOS support for A500!

In order to get the battery / LEDs / power-off to work, you'll need to enable the following options in the kernel config:

CONFIG_ACER_A500_EC_MFD=y
CONFIG_ACER_A500_EC_BATTERY=y
CONFIG_ACER_A500_EC_LEDS=y

you may enable them as =m as well. If you have the EC drivers already enabled, then please post a full dmesg log.

Cameras are expected to not work because there are no drivers in the upstream kernel for them.

3D acceleration has a limited support. Mesa driver is in-progress, it's not usable as of today, but still you'll need the grate's mesa driver for things like VDPAU because it retrieves the libvdau-tegra library name using mesa's DRI. Both Opentegra Xorg driver and libvdpau-tegra are using 3d for the compositing acceleration.

Accelerometer should work, please explain in a more details what exactly doesn't work.

# find /sys/devices/soc0/7000c000.i2c/i2c-0/i2c-5/5-000f/iio:device1 -maxdepth 1 -type f -exec cat {} \;
22
0, 1, 0; 1, 0, 0; 0, 0, -1
25 50 100 200 400 800
-505
250:1
0.019163
cat: '/sys/devices/soc0/7000c000.i2c/i2c-0/i2c-5/5-000f/iio:device1/in_accel_sampling_frequency': Invalid argument
0.009582 0.019163 0.038326
realtime
17
MAJOR=250
MINOR=1
DEVNAME=iio:device1
DEVTYPE=iio_device
OF_NAME=accelerometer
OF_FULLNAME=/i2c@7000c000/gyroscope@68/i2c-gate/accelerometer@f
OF_COMPATIBLE_0=kionix,kxtf9
OF_COMPATIBLE_N=1
kxtf9

MicroUSB port should work, I'm using usbnet all the time on A500. Although, perhaps in my case it's the EEM driver and not RNDIS. I'll try to check the RNDIS.

Here is my current kernel config USB setup:

CONFIG_USB_USBNET=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_TEGRA=y
CONFIG_USB_ACM=y
CONFIG_USB_WDM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
# CONFIG_USB_CHIPIDEA_MSM is not set
# CONFIG_USB_CHIPIDEA_IMX is not set
# CONFIG_USB_CHIPIDEA_GENERIC is not set
CONFIG_USB_GADGET=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_ETH=y
CONFIG_USB_ETH_RNDIS=y
CONFIG_USB_ETH_EEM=y

For the Bluetooth and WiFi you'll either need to compile the corresponding kernel drivers as a loadable kernel modules or embed firmware files into kernel image by setting CONFIG_EXTRA_FIRMWARE in the kernel's config:

CONFIG_EXTRA_FIRMWARE="brcm/BCM4329B1.hcd brcm/brcmfmac4329-sdio.bin brcm/brcmfmac4329-sdio.txt"
CONFIG_EXTRA_FIRMWARE_DIR="/path_to_firmware_files"

where /path_to_firmware_files should contain the brcm/ directory.

RQWorldblender commented 4 years ago

I took most of what you suggested now, and will be running another build soon. Here are the relevant files: config-postmarketos-grate.armv7.txt

One more thing I forgot to ask: what about the vibrator? Can it be used in any capacity by programs running on pmOS?

I will be making a unified kernel package that can be used by all other devices supporting this kernel. I'm not sure of how many USB ethernet/wi-fi devices I should enable in the kernel or have them compiled as modules. I do need alternatives to the built-in wi-fi in case I can't get it to work.

I haven't been able to test the accelerometer because I haven't used a desktop environment such as GNOME 3, Phosh, or Plasma Mobile that supports rotation on it yet. I would prefer to use any of them as their interfaces are well-designed to support touch screens, but I'm not sure of how well they will run with the current state of the 3D acceleration, if they end up using Wayland. X11 desktop environments such as i3wm, MATE, or XFCE4 will likely work the best, but they may not be well-designed for touch screens.

Here, I will also link to my private cloud storage holding one of the original Android ROMs (version 4.0.3 from Acer) which also holds the firmware for the Broadcom BCM4329 SDIO wi-fi card: http://45.21.218.32:9092/owncloud/index.php/s/z0F5d3e9Va5eoHE | I need to think about how to package the non-free firmware for use with pmOS, so that I don't have to inject the files myself.

digetx commented 4 years ago

Vibrator will work with any program that supports input feedback UAPI, although I don't know whether generic toolkits support haptic feedback. You could use fftest utility in order to turn on/off vibration motor if you want to test it.

Perhaps you could add firmware files into initrd as alternative to embedding them into kernel image. Please be aware that initrd may not work on some Android devices if kernel's zImage file is too big, for example Nexus 7 has such problem, so you should always try to minimize the size of zImage. In general, when you're making a public kernel build, you should enable as many drivers as possible and they should be compiled as a loadable kernel modules.

Please notice that only A500 and Nexus 7 are known to work well with the grate-kernel, other devices have incomplete device-trees and need some more work.

Everything Wayland won't work well without GL, X11 should be the best option for now.

You could test rotation on any X11 DE by using a very recent version of iio-sensor-proxy and https://github.com/donbowman/kde-auto-rotate (it doesn't require kde). You could also just run monitor-sensor if you want to see what orientation is reported by accelerometer, again the most recent version of iio-sensor-proxy is required or you'll get wrong orientation.

The Android's firmware doesn't work with the upstream WiFi driver on A500, IIRC. You may grab all the working firmware files from https://github.com/grate-driver/linux-firmware.

digetx commented 4 years ago

@RQWorldblender, the RNDIS works on A500 here:

 usb 2-1.4.1.3: new high-speed USB device number 5 using ehci-pci
 usb 2-1.4.1.3: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.08
 usb 2-1.4.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
 usb 2-1.4.1.3: Product: RNDIS/Ethernet Gadget
 usb 2-1.4.1.3: Manufacturer: Linux 5.8.0-rc1-next-20200622-00149-g5fff5bf71546 with tegra-udc
 cdc_ether 2-1.4.1.3:1.0 usb0: register 'cdc_ether' at usb-0000:00:1d.0-1.4.1.3, CDC Ethernet Device, c6:1d:04:5c:37:d6

What host/desktop OS are you using? Is it some Linux distro?

RQWorldblender commented 4 years ago

I do have RNDIS after I used the kernel config options you showed me. I did my initial testing on pmOS, but settled on using the rootfs from the Ubuntu MATE 18.04 Raspberry Pi images from https://ubuntu-mate.org/ports/raspberry-pi/ as my daily driver. It contains a full-blown GUI experience with a decent amount of programs installed OOTB. Note that I'm still using the same boot images I made for pmOS, as the initramfs functions only look for partitions named "pmOS_boot" and pmOS_root".

One thing I noticed is that the micro HDMI output is detected while running pmOS, but not yet on the Ubuntu MATE image. This may be because the drivers are preinstalled on every pmOS rootfs I make. The PPA at https://launchpad.net/~grate-driver/+archive/ubuntu/ppa helped me get micro HDMI output on this distro, after I removed the fbturbo driver.

What web browsers can I use since Firefox will likely not work, although with an inferior experience due to poor Javascript performance? Chromium can run on this tablet, but its performance will likely suffer.

I really can't open any programs that require OpenGL at all. Is there a way I can fall back to software rendering so that at least these programs can open properly?

I have been trying as many desktop environments as I can, but KDE 5 Plasma in particular, won't open up plasma shell at all, meaning that I can't really interact unless I open up a terminal to launch programs in.

digetx commented 4 years ago

Firefox won't work on Tegra20 devices because Mozilla dropped Tegra20 support about 2 years ago by enforcing ARM NEON compilation flags. It should be possible to revert it, but then you'll have to maintain your own firefox build. It's possible to use a pre-NEON firefox version, but it's quite outdated now.

The Pale Moon browser works on Tegra20 since it's based on older firefox codebase.

Javascript usually isn't a problem if adblock is active. Lack of GL support is more noticeable on a "heavy" websites. I was using Chromium about year or two ago and it was okay back then, I stopped using it at all once Ubuntu switched Chromium to a snap package. IIRC, the snap package is built using wrong compiler flags (ARM NEON), so it doesn't work on Tegra20. If you need Chromium, then you may install an older pre-snap Ubuntu deb package, or maybe you can borrow a newer deb from Debian.

Nowadays I'm using KDE falkon webbrowser (which is chromium based), it works very well on A500. I'm also using Plasma 5 on A500 as the main DE and it works great!

It's possible to use software rendering and you'll need it for things like SDDM. Please pull the latest update from grate-driver PPA, I re-added Mesa build for Ubuntu Bionic there, it will provide a working SW rendering.

Add these lines to /etc/security/pam_env.conf:

QT_IM_MODULE=qtvirtualkeyboard
QT_QUICK_BACKEND=software
LIBGL_ALWAYS_SOFTWARE=1

The QT_IM_MODULE provides Qt's virtual keyboard in SDDM and everywhere else. But it is a bit unusable outside of SDDM, so it's better to use something else, like onboard keyboard for example. Add this line to ~/.profile to get rid of the QT's virtual keyboard after login:

unset QT_IM_MODULE

Be prepared that first run of SDDM may take few minutes because of the fonts-cache generation.

Now you can enjoy Plasma 5 on A500!

RQWorldblender commented 4 years ago

Your suggestions to use the environment variables really helped me reach the Plasma desktop! Thank you again! I noticed the Mesa libraries in the PPA by surprise, but it's good they landed now. I use LightDM instead of SDDM as the display manager, as its gtk-greeter doesn't require compositing.

What about GNOME Shell, where it doesn't open up because Mutter complains about no drivers found? Hence the Clutter backend can't load at all? Are there some environment variables I can use to enable GNOME Shell to successfully load, or is it a no go? I've been struggling to find a desktop environment that will work OOTB with the touch screen, so if GNOME Shell can't be run at all, I guess I'll have to settle on KDE Plasma.

The problems I ran into on other desktop environments include:

okias commented 4 years ago

GNOME-Shell relies on 3D acceleration, so it would be extremely slow. If you'd like to try something from GNOME world, you could try Phosh, but it's still relaying on 3D acceleration.

digetx commented 4 years ago

Yes, the desktop GNOME Shell requires GL support, nothing we can do about it for now. KDE Plasma is what I use, not sure if there is any touch-oriented DE that doesn't require GL.

digetx commented 4 years ago

Chromium now works on Ubuntu once again \o/ https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1884856

RQWorldblender commented 4 years ago

Finally I published a premade image for this tablet at https://drive.google.com/drive/folders/1pMqaS5GaM6N9TAKlNGQZWCG8UTiRn4pK?usp=sharing. It's based on the Ubuntu MATE 20.04 Raspberry Pi image, and only the bare minimum has been worked on to get it functional.

digetx commented 4 years ago

@RQWorldblender Very nice! Thank you for yours work! I'll try out the image during a week.

RQWorldblender commented 4 years ago

Finally, my device port has been merged upstream, where it can now be found inside upstream at https://gitlab.com/postmarketOS/pmaports. No more having to check out another git repository! I'm also updating the Ubuntu MATE image to reflect the changes made to the kernel so far.

digetx commented 4 years ago

This is a great news! Well done!

I see that there are WiFi firmware file here https://gitlab.com/postmarketOS/pmaports/-/commit/949effc0edcf83604b47d995d84466c2eedad9e2#8e2904f648e325d8a097929fa488ab53d0ad0b71_0_16, but Bluetooth BCM4329B1.hcd seems is not there, is it okay?

RQWorldblender commented 4 years ago

This is a great news! Well done!

I see that there are WiFi firmware file here https://gitlab.com/postmarketOS/pmaports/-/commit/949effc0edcf83604b47d995d84466c2eedad9e2#8e2904f648e325d8a097929fa488ab53d0ad0b71_0_16, but Bluetooth BCM4329B1.hcd seems is not there, is it okay?

I have not actually tried to connect a Bluetooth device but the Bluetooth adapter is detected when running hcitool dev.

digetx commented 4 years ago

@RQWorldblender, I tried the Ubuntu image. It booted fine, but seems I had a problem with finishing the initial configuration which happens after the greeting menu. I'm using older and quite slow microSD card where the image is flashed and looks like the initial configuration was auto-terminated after a timeout because I saw message in VT saying that something was stopped after 20m timeout. The MATE is definitely not fully installed and Opentegra driver is missing (should it be auto-installed?). Do you know if it is possible to extend that timeout?

RQWorldblender commented 4 years ago

I wasn't able to chroot into the rootfs successfully to modify it some more, unfortunately. I'll alter it again next time; I don't know how to extend the timeout. I left the setup process there so that users can set up their own account without me giving out the default password.

digetx commented 4 years ago

Okay! I guess it's indeed quite a lot of churn to modify the ready-made rootfs and it's not easy to create rootfs from scratch.

Otherwise, I'd also recommend to add tmps for /tmp /var/tmp /var/log into /etc/fstab and maybe do some other tunings.

RQWorldblender commented 4 years ago

All my images for the Acer Iconia Tab A500 will now be found at https://drive.google.com/drive/folders/1pMqaS5GaM6N9TAKlNGQZWCG8UTiRn4pK?usp=sharing

I'm getting a little tired of chasing all the new releases and release candidates every time I make an update to my image. I wonder at which point I can reduce how often I update the images and compile kernels.

digetx commented 4 years ago

Very nice, thank you! I don't know when it will slow down :)

RQWorldblender commented 2 years ago

The lack of NEON on the Nvidia Tegra 2 of this tablet (which more and more applications are using these days, including the Firefox web browser) has made me consider selling my Acer Iconia Tab A500. Though I enjoyed using a mainline Linux kernel on a real ARM tablet, frequent issues of running out of memory especially during web browsing have also plagued me.

Even though I enjoyed my time repurposing this tablet to become a Linux one, I think it's time that I move onto some more recent hardware. I know about planned obsolescence, but when most manufacturers are including NEON support in their ARM SOCs, and most mainstream applications are taking advantage of it, I can greatly feel the effects of this. Again, I'm grateful for all the mainlining efforts done (thanking you too, @digetx), them being the reason why I could get postmarketOS supported for this tablet.

If anyone is interested in buying this tablet from me, just contact me and I'll try to work something out.