[DEV][ROM][UNOFFICIAL] LineageOS 20 (Android 13) for Raspberry Pi 4 B

Search This thread

Homeye

Senior Member
Nov 19, 2015
103
15
New builds.


  • Android 13 QPR2
  • HDMI audio improvements
    • implement audio HAL that uses alsa directly to get rid off using alsa loopback for HDMI audio (thanks to nename0)
    • update alsa-lib and alsa-utils to v1.2.8
  • update to libcamera master/v0.0.4
    • fix camcorder (i.e. recording videos) with Pi camera modules
    • add support for Pi camera module v3 (untested)
  • use USB audio input for camcorder videos with the built-in camera application
  • update to FFmpeg 5.1.3
  • update to Mesa 22.3.7
  • update to Linux 5.15.94 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
  • Android security patch level: 5 March 2023 (merged)
Thanks for the wok! I'll test the performance later.
However, the Google Play Store app disappeared after the update. Do i need to reflash the gapps zip or just download an apk for it?
 

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
Thanks for the wok! I'll test the performance later.
However, the Google Play Store app disappeared after the update. Do i need to reflash the gapps zip or just download an apk for it?
It shouldn't disappear anywhere or require reflashing. Most GApps packages have backup script that preserves GApps during OTA updates (at least the one linked in the FAQ does).
 

Homeye

Senior Member
Nov 19, 2015
103
15
It shouldn't disappear anywhere or require reflashing. Most GApps packages have backup script that preserves GApps during OTA updates (at least the one linked in the FAQ does).
Well, i used the "fixed" gapps zip for the tv version of your rom. Yesterday i flashed the update and your magisk zip. The play store is not in the app list. There's this "panel" where you can see the "get more apps" and "get more games" buttons. Only the games is present now and when i click on it, the google play games app is shows an error. I'll try to downloand and flash the gapps zip again today after work.
 

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
Well, i used the "fixed" gapps zip for the tv version of your rom. Yesterday i flashed the update and your magisk zip. The play store is not in the app list. There's this "panel" where you can see the "get more apps" and "get more games" buttons. Only the games is present now and when i click on it, the google play games app is shows an error. I'll try to downloand and flash the gapps zip again today after work.
Well, I don't know what "fixed" package you've used but copying the backup script was also broken until it was fixed pretty recently (https://gitlab.com/MindTheGapps/vendor_gapps_tv/-/commit/763e0a6e0e40e90e373f841d2a73d66a5d1ddc5b).

There are new MindTheGapps Android TV releases yesterday (20230321) that are now working on the Pi 4 as well so use the latest package.
 
  • Like
Reactions: Homeye

quiOt

New member
Sep 17, 2022
3
0
Anyone was able to pair a PS4 controller over Bluetooth with LineageOS 20.0 ? Mine hangs on pairing.. Is this related with the new gabeldorsche bluetooth stack ?
 

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
Anyone was able to pair a PS4 controller over Bluetooth with LineageOS 20.0 ? Mine hangs on pairing.. Is this related with the new gabeldorsche bluetooth stack ?
Something with the bluetooth stack introduced in Android 13 certainly doesn't play nice with Pi bluetooth firmware. As commented on the AOSP13 topic (https://forum.xda-developers.com/t/...raspberry-pi-4-b.4481977/page-5#post-88301805) there's a new bluetooth firmware available. It seems to fix connecting BLE devices in Android 13 but overall bluetooth seems more unstable than with the older firmware that is included in this build by default.
 
Last edited:
  • Like
Reactions: quiOt

quiOt

New member
Sep 17, 2022
3
0
Something with the bluetooth stack introduced in Android certainly doesn't play nice with Pi bluetooth firmware. As commented on the AOSP13 topic (https://forum.xda-developers.com/t/...raspberry-pi-4-b.4481977/page-5#post-88301805) there's a new bluetooth firmware available. It seems to fix connecting BLE devices in Android 13 but overall bluetooth seems more unstable than with the older firmware that is included in this build by default.
Thanks @KonstaT!
 

Homeye

Senior Member
Nov 19, 2015
103
15
Well, I don't know what "fixed" package you've used but copying the backup script was also broken until it was fixed pretty recently (https://gitlab.com/MindTheGapps/vendor_gapps_tv/-/commit/763e0a6e0e40e90e373f841d2a73d66a5d1ddc5b).

There are new MindTheGapps Android TV releases yesterday (20230321) that are now working on the Pi 4 as well so use the latest package.
The fixed package the one linked here or in your website's comments with the fixed install script :)

So, I was able to test the latest mindthagapps before work today morning. Here are the results:


Play Store is back. There was a notification that said I need to sign back in. I was able to update apps.
Google Play Movies and Games crashed when I tried to open them. Force close, clear cache and data, still crashing. I had to uninstall them and redownload from the store. Now they are working.

Live Channels app is the same, but after the redownload it was still crashing at the "choose source" window. After a reboot it's working angain but it see 2 GPMovies source, one of them shows an error like "no source from this app", the other is working.

GBoard looks okay, it shows the keyboard.

I don't have any other app from Google just like tv setup, etc. I'm using SmartTubeNext instead of Youtube, so I wasn't able to test if any other google apps has the same error.

Spotify is working.


Right now, it looks fine. The double source in Live Channels is bothering me just a little, but it's fine. I'll wait for the next OTA update to test if the gapps will work after the update or not. Regardless of the result, I'll reinstall everything from scratch.
 

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
The fixed package the one linked here or in your website's comments with the fixed install script :)

So, I was able to test the latest mindthagapps before work today morning. Here are the results:


Play Store is back. There was a notification that said I need to sign back in. I was able to update apps.
Google Play Movies and Games crashed when I tried to open them. Force close, clear cache and data, still crashing. I had to uninstall them and redownload from the store. Now they are working.

Live Channels app is the same, but after the redownload it was still crashing at the "choose source" window. After a reboot it's working angain but it see 2 GPMovies source, one of them shows an error like "no source from this app", the other is working.

GBoard looks okay, it shows the keyboard.

I don't have any other app from Google just like tv setup, etc. I'm using SmartTubeNext instead of Youtube, so I wasn't able to test if any other google apps has the same error.

Spotify is working.


Right now, it looks fine. The double source in Live Channels is bothering me just a little, but it's fine. I'll wait for the next OTA update to test if the gapps will work after the update or not. Regardless of the result, I'll reinstall everything from scratch.
If you've booted without GApps in between, you need to do a factory reset in any case.

There's no need to wait any new update to test this. You can just flash the OTA package of the latest build over and over again. But preserving the GApps does work with the latest MindTheGapps Android TV package.
 
  • Like
Reactions: Homeye

Homeye

Senior Member
Nov 19, 2015
103
15
If you've booted without GApps in between, you need to do a factory reset in any case.

There's no need to wait any new update to test this. You can just flash the OTA package of the latest build over and over again. But preserving the GApps does work with the latest MindTheGapps Android TV package.
I almost forgot, that i had an img file of the sd card with every app configured (rpi likes to corrupt sd cards). So i used my backup, flashed the ota update + gapps + magisk zip (i guess i need to reflash magisk after every update yes?). With these steps, no crashes.

An other thing: i'm thinking about to change my sd card to a faster one, but i'm not sure about the specs nowadays. Like i remember in the past there was a thing class 10 card, etc. What are your suggestions? Also, which is the better? A fast sd card, or a small and fast usb 3.0 drive to boot?
 

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
still unable to pair with bluetooth controller using the latest package... :-(
already copied the two files in /vendor/firmware/brcm as instructed
Logcat? Could still be for numerous reasons and there's not much point in guessing. There's e.g. been some previous reports of issues with pairing bluetooth remotes on Android TV after installing GApps (e.g. https://github.com/opengapps/opengapps/issues/915#issuecomment-1236377741).

I almost forgot, that i had an img file of the sd card with every app configured (rpi likes to corrupt sd cards). So i used my backup, flashed the ota update + gapps + magisk zip (i guess i need to reflash magisk after every update yes?). With these steps, no crashes.

An other thing: i'm thinking about to change my sd card to a faster one, but i'm not sure about the specs nowadays. Like i remember in the past there was a thing class 10 card, etc. What are your suggestions? Also, which is the better? A fast sd card, or a small and fast usb 3.0 drive to boot?
There's a list under 'How to install' on what is/is not backed up and restored during flashing OTAs. Yes, Magisk needs to be always reinstalled on my builds. GApps are preserved on LineageOS (but not on my AOSP builds).

At least class 10 sdcard is recommended. Storage speed does matter. Decent SSD with USB 3.0 adapter is probably quite a bit faster, regular USB thumb drives might not be. I personally just stick one of my sdcards to USB 3.0 card reader if I need to test/develop something related to USB boot so I wouldn't really know. There's of course various third party apps to benchmark I/O speed if you're interested.
 
Last edited:

Spielmops

Senior Member
Dec 14, 2016
124
21
Oldenburg

LineageOS 20 and cameras:​

the new Rasdpberry cameramodul 3 is not working! No camera recognized!​


What I did:
- start Raspi 4 with Raspbian and make sure the camera was working, that means it's correct connected.
- update LOS to the latest version from March
- start LOS and start Opencamera
Result: no camera found ...
 

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com

LineageOS 20 and cameras:​

the new Rasdpberry cameramodul 3 is not working! No camera recognized!​


What I did:
- start Raspi 4 with Raspbian and make sure the camera was working, that means it's correct connected.
- update LOS to the latest version from March
- start LOS and start Opencamera
Result: no camera found ...
Thanks for the report. I don't have the hardware to test myself.

Apparently Pi camera module v3 also needs lens driver (https://github.com/raspberrypi/linux/commit/a218eb7f81b6b1824416fd8014438f200191c20b) that I missed to enable on my kernel (https://github.com/lineage-rpi/andr...mmit/a3306062f3f99fb37af54b2450f99975129b8f56).

Please test the attached kernel (unzip and copy kernel 'Image' to boot partition to replace the existing file). If it still doesn't work, please attach 'dmesg' output and check if the camera is present as video devices (/dev/video0 & /dev/video1). Edit. latest kernel available for download here (https://github.com/raspberry-vanilla/android_device_brcm_rpi4-kernel/blob/android-13.0/Image).

Use the built-in camera application. OpenCamera is one of the third party camera apps that fails to capture photos with camera module v1 & v2 at least.
 
Last edited:

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
Is it possible to run 120Hz on 2560x1440 resolution?
No idea TBH if Pi hardware is even cabable of this. Some specs I've found say that 2x [email protected], 1x [email protected], 2x [email protected], and 1x [email protected] is possible.

This is something that you need to test yourself if you have hardware that support this. You can check 'logcat | grep hwc-drm-connector' after booting the device and/or 'modetest -c' if your display reports that as supported. If it does, you can try forcing the resolution/refresh rate by setting '[email protected]' in /boot/resolution.txt.
 
Last edited:

Spielmops

Senior Member
Dec 14, 2016
124
21
Oldenburg
New kernel and camera:
this kernel is working with the camera-modul 3. I tried the original camera-app, but could reach the settings just once, when the app showed me the tooltip (first use). In settings I can toogle "location" and go to "resolution and quality", but there goes nothing.

I can toggle grid and set timer (didn't try it) change still photo/video. If I shoot a photo, the picture is stored at "pictures" and not DCIM. Not able to change this (settings ...), but if I change to video and start recording, the app shows "Camera-failure, no connection to camera possible". No chance to get back to still photo, but to delete camera-app's storage.

Opencamera shows the camera-picture and I can change the resolution as well with still photo and video, but with the shutter the message appears "serious camera-error". No setting for white-balance showed.

So far. I'm now off for 7 days with my motorhome :)

Spielmops
 
  • Like
Reactions: KonstaT

KonstaT

Senior Member
Jan 20, 2016
865
509
KonstaKANG.com
New kernel and camera:
this kernel is working with the camera-modul 3. I tried the original camera-app, but could reach the settings just once, when the app showed me the tooltip (first use). In settings I can toogle "location" and go to "resolution and quality", but there goes nothing.

I can toggle grid and set timer (didn't try it) change still photo/video. If I shoot a photo, the picture is stored at "pictures" and not DCIM. Not able to change this (settings ...), but if I change to video and start recording, the app shows "Camera-failure, no connection to camera possible". No chance to get back to still photo, but to delete camera-app's storage.

Opencamera shows the camera-picture and I can change the resolution as well with still photo and video, but with the shutter the message appears "serious camera-error". No setting for white-balance showed.

So far. I'm now off for 7 days with my motorhome :)

Spielmops
Thanks for the report. Good to know the v3 module is now working to this extent at least.

I can't reproduce that with v1 & v2 modules and the included camera app (both photos & videos work and so does changing resolution for both). It could be that the v3 module reports resolutions somehow differently but impossible to say without seeing any logs. Yes, pictures are stored at "Pictures" and there's no setting to change that.

On OpenCamera with v1 & v2 modules capturing photo just freezes (it will show that "serious camera-error" message only if you've switched to Camera2 API in the settings). Recording videos works with OpenCamera as well.
 

uukelele

Member
Hi,
Does anyone know how to boot into recovery mode for Android TV? I have enabled the advanced restart option in settings, however I can't access the power menu. I also tried the F5 key on my USB keyboard, but it just powered off, and I think GPIO 21 will act the same anyway. I need to get into TWRP to flash the resize zip found in the FAQ. Any help would be appreciated.

Thanks
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    New builds.


    • add support for AV1 software video decoding using FFmpeg and dav1d
    • update to FFmpeg 6.0
    • update to libcamera master/v0.0.5
    • update to alsa-lib/alsa-utils v1.2.9
    • update to Mesa 23.0.3
    • update to Linux 5.15.106 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 May 2023 (merged)
    1
    I'd like to, but I have no experience building Android. Since Android is quite large, does it make sense for me to just recompile the component I want to change, and patch the installation on my SD card with the result?

    What I'd like to do in particular is to change the value of "kMaxBytesPerPixel" from 2 to 4 in a source file called "camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h". That value seems to determine the max buffer size accepted by the code.

    MJPG is a variable-sized compression algorithm, so I can imagine a too-tight limit on the buffer size can sometimes be exceeded. Still, 1843789 bytes is way larger than I'd expect. It's actually slightly larger than 2 bytes per pixel, while *uncompressed* image data is 3 bytes per pixel. Normally JPEG compresses about 90%, so I'd expect buffers with about 0.3 bytes per pixel on average. Maybe this camera maxes out the JPEG quality so there is almost no compression? Or maybe the first few frames are bogus data (as some sites report)? We'll see.

    *EDIT*: I've done some experimenting on my laptop with my webcam and some example V4L2code. It works just fine with all the settings used by the Android code; captured frames are roughly 54kB in size (including the first frame). *However*, just like in Android, the driver/camera reports back to the application that its image size is 1843789 bytes (about 1.8MB). I suspect the camera developer was just lazy, so it reports the same image size for all image formats, even though MJPG is usually much smaller.

    Now that the problem is fully known, I think the solution is indeed to make the Android code a bit more relaxed on the image size value returned by the camera. The "kMaxBytesPerPixel" change I mentioned above should be more than enough for my camera. Next question: how to recompile with the changed code?
    You would follow the build instructions to compile.

    To compile just the external camera HAL and it's dependencies, you would 'make [email protected]' instead of boot/system/vendor images. You could get by just replacing one lib in the existing image (/vendor/lib/[email protected] in this case) but I'm not entirely sure.
  • 6
    Here’s my build of LineageOS 20 for Raspberry Pi 4 Model B, Pi 400, and Compute Module 4. It is unofficial and unsupported by the LineageOS team. It’s for advanced users only. Pi 4 model with at least 2GB of RAM is required to run this build.

    Important! This image includes parts that are licensed under non-commercial license (Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International). You may use this build freely in personal/educational/etc use. Commercial use is not allowed with this build! You can contact me by email to discuss creating customized Android builds for commercial purposes.

    Screenshot_20221109-122731_Settings.png


    There is also Android TV version available.

    Screenshot_20221109-103339_Settings.png


    Working:
    • Audio (HDMI, 3.5mm jack, USB microphones, bluetooth speakers/headphones, etc)
    • Audio DAC (using GPIO DACs e.g. Hifiberry DAC+)
    • Bluetooth (and bluetooth tethering)
    • Camera (using official Pi camera modules & UVC USB webcams)
    • GPIO
    • GPS (using external USB modules e.g. U-Blox 7)
    • Ethernet
    • Hardware accelerated graphics (V3D, OpenGL & Vulkan)
    • Hardware video decoding & encoding (H.265 decoding, H.264 decoding & encoding)
    • HDMI display (and HDMI-CEC)
    • I2C
    • IR remotes (using external GPIO IR modules e.g. TSOP4838)
    • RTC (using external GPIO I2C modules e.g. DS3231)
    • Sensors (using external GPIO I2C modules e.g. MPU6050, LSM6DS3, LSM303DLHC, BME280/BMP280, and APDS9930 accelerometer, gyroscope, magnetometer, temperature, pressure, humidity, ambient light, and proximity)
    • Serial console (using external GPIO serial console adapters e.g. PL2303)
    • SPI
    • Touchscreen/multi-touch (official 7" touchscreen, USB touchscreens, Waveshare SPI touchscreens)
    • USB (mouse, keyboard, storage, etc)
    • USB-C (ADB, MTP, PTP, USB tethering)
    • Wifi (and wifi tethering)

    Issues:
    • Hardware video decoding performance varies depending on the selected decoder option and video resolution/bitrate/profile/container/etc
    • Some third party camera apps don't work with official Pi camera modules (works with UVC USB webcams)
    • SELinux is in permissive mode
    • Encrypting userdata is not supported
    • and more…

    Sources:

    Thanks:
    • Roman Stratiienko and GloDroid project
    • Peter Yoon and android-rpi project
    • AOSP reference board developers (dragonboard, hikey, yukawa)
    • Android-x86 project
    • LineageOS team and everyone who has contributed to LineageOS 20
    4
    New builds.


    • add support for AV1 software video decoding using FFmpeg and dav1d
    • update to FFmpeg 6.0
    • update to libcamera master/v0.0.5
    • update to alsa-lib/alsa-utils v1.2.9
    • update to Mesa 23.0.3
    • update to Linux 5.15.106 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 May 2023 (merged)
    3
    New builds. H.265 hardware video decoding, H.264 hardware video decoding and encoding!


    • H.265 hardware video decoding, H.264 hardware video decoding and encoding
      • FFmpeg 5.1.2 (thanks to John Cox for Raspberry Pi hw codecs support and Android-x86 for AOSP build patches)
      • implement codec2 plugin to integrate FFmpeg into Android multimedia framework (thanks to Michael Goffioul)
      • FFmpeg hevc_v4l2request hwaccel H.265 hw decoding (default), h264_v4l2m2m H.264 hw decoding (optional)
      • v4l2_codec2 H.264 hardware video decoding and encoding (default)
      • FFmpeg software decoders support
    • update to Mesa 22.3.5
    • update to Linux 5.15.92 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 February 2023 (merged)
    3
    New builds.


    • Android 13 QPR2
    • HDMI audio improvements
      • implement audio HAL that uses alsa directly to get rid off using alsa loopback for HDMI audio (thanks to nename0)
      • update alsa-lib and alsa-utils to v1.2.8
    • update to libcamera master/v0.0.4
      • fix camcorder (i.e. recording videos) with Pi camera modules
      • add support for Pi camera module v3 (untested)
    • use USB audio input for camcorder videos with the built-in camera application
    • update to FFmpeg 5.1.3
    • update to Mesa 22.3.7
    • update to Linux 5.15.94 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 March 2023 (merged)
    2
    How to install:
    1. Follow the official Raspberry Pi instructions for writing the image to the SD card.
    You can also update to newer builds using TWRP flashable OTA packages. OTA updates pushed through the built-in Updater app are stored at /data/lineageos_updates/.
    1. Download lineage-20.0-xxxxxxxx-UNOFFICIAL-KonstaKANG-rpi4-ota.zip and save it to your device’s internal storage or use an external USB drive
    2. Boot to TWRP recovery (see FAQ)
    3. Install lineage-20.0-xxxxxxxx-UNOFFICIAL-KonstaKANG-rpi4-ota.zip from your selected storage
    4. (Flash Magisk/other add-ons you had previously installed)
    5. Boot out of recovery (see FAQ)
    Changes that are backed up and restored flashing OTAs:
    • Device specific settings changed using Settings -> System -> Raspberry Pi settings
    • Manual changes to /boot/resolution.txt and /boot/rc_keymap.txt
    • USB boot configuration in /boot/config.txt
    • User specific options in /boot/config_user.txt
    • GApps
    Changes that are not backed up and restored flashing OTAs:
    • Manual changes to /boot/config.txt (and any other manual changes to /boot partition)
    • Magisk

    FAQ:

    FAQ is getting quite long and difficult to maintain in several different places. You can find the always up-to-date FAQs here:
    https://konstakang.com/devices/rpi4/LineageOS20/
    https://konstakang.com/devices/rpi4/LineageOS20-ATV/