[DEV][ROM][UNOFFICIAL] LineageOS 16.0 (Android 9) for Raspberry Pi 4 B

Search This thread

Bystrick23

New member
Jan 15, 2021
3
1
Thank you for this build, great job.
I'm a newbee, and surprise, I install it easily :)
All works fine except my DAC. I got sound on the jack, but nothing on DAC. How can I activate it ?
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
Thank you for this build, great job.
I'm a newbee, and surprise, I install it easily :)
All works fine except my DAC. I got sound on the jack, but nothing on DAC. How can I activate it ?
First of all this build is quite outdated and I've discontinued LineageOS 16 builds for the Pi 4. You should really use the latest LineageOS 17 (https://forum.xda-developers.com/t/...17-1-android-10-for-raspberry-pi-4-b.4139059/ or 18 (https://forum.xda-developers.com/t/...18-1-android-11-for-raspberry-pi-4-b.4212945/) builds instead.

Which audio DAC do you have? How would you use it on some other Linux distro?
FAQ has a section about using audio DAC. There's a line under 'Audio DAC' section in /boot/config.txt that you need to modify to load the driver for your audio DAC if you're using something other than Hifiberry DAC+. I've enabled the drivers for all Hifiberry DACs on the kernel side.
 
Last edited:

Bystrick23

New member
Jan 15, 2021
3
1
First of all this build is quite outdated and I've discontinued LineageOS 16 builds for the Pi 4. You should really use the latest LineageOS 17 (https://forum.xda-developers.com/t/...17-1-android-10-for-raspberry-pi-4-b.4139059/ or 18 (https://forum.xda-developers.com/t/...18-1-android-11-for-raspberry-pi-4-b.4212945/) builds instead.

Which audio DAC do you have? How would you use it on some other Linux distro?
FAQ has a section about using audio DAC. There's a line under 'Audio DAC' section in /boot/config.txt that you need to modify to load the driver for your audio DAC if you're using something other than Hifiberry DAC+. I've enabled the drivers for all Hifiberry DACs on the kernel side.

Thank you for your quick reply.(y):)
I'm trying the 16 because reading the discussions, I think it's more complicated to install the 17 because I don't have an hdmi screen and just the 7” Touchscreen and a Boss DAC.
Here is my config.txt:
# Audio
dtparam=audio=on
audio_pwm_mode=2
disable_audio_dither=1
#hdmi_force_edid_audio=1
hdmi_ignore_edid_audio=1

# Audio DAC
#dtoverlay=hifiberry-dacplus
dtoverlay=allo-boss-dac-pcm512x-audio

And I see in the directory "overlays" the files allo-boss-dac-pcm512x-audio.dtbo, it seems to be the same that I use with LibreElec.
The "jack" output is ok, but the dac is not. Here is my limits...:cry:
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
Thank you for your quick reply.(y):)
I'm trying the 16 because reading the discussions, I think it's more complicated to install the 17 because I don't have an hdmi screen and just the 7” Touchscreen and a Boss DAC.
Here is my config.txt:
# Audio
dtparam=audio=on
audio_pwm_mode=2
disable_audio_dither=1
#hdmi_force_edid_audio=1
hdmi_ignore_edid_audio=1

# Audio DAC
#dtoverlay=hifiberry-dacplus
dtoverlay=allo-boss-dac-pcm512x-audio


And I see in the directory "overlays" the files allo-boss-dac-pcm512x-audio.dtbo, it seems to be the same that I use with LibreElec.
The "jack" output is ok, but the dac is not. Here is my limits...:cry:
Ok, if you have to use the official display this is probably the most stable option with SwiftShader. We'll see if this changes in the future as I already have the official display working with hw accelerated graphics.

Driver for Allo Boss DAC is enabled on kernel side (https://github.com/lineage-rpi/andr...ch/arm/configs/lineageos_rpi4_defconfig#L3785) so you should be able to get this working.

First of all there's a script you need to run to change the audio device and enable the driver for DAC.
Code:
su
rpi4-audio-dac.sh
Then you still need to manually edit the line in /boot/config.txt to change hifiberry-dacplus -> allo-boss-dac-pcm512x-audio.

If you have trouble after this check 'dmesg' output that the driver for Boss DAC is loaded you can see it listed as ALSA device.
 

Bystrick23

New member
Jan 15, 2021
3
1
Ok, if you have to use the official display this is probably the most stable option with SwiftShader. We'll see if this changes in the future as I already have the official display working with hw accelerated graphics.

Driver for Allo Boss DAC is enabled on kernel side (https://github.com/lineage-rpi/andr...ch/arm/configs/lineageos_rpi4_defconfig#L3785) so you should be able to get this working.

First of all there's a script you need to run to change the audio device and enable the driver for DAC.
Code:
su
rpi4-audio-dac.sh
Then you still need to manually edit the line in /boot/config.txt to change hifiberry-dacplus -> allo-boss-dac-pcm512x-audio.

If you have trouble after this check 'dmesg' output that the driver for Boss DAC is loaded you can see it listed as ALSA device.
Great, it works.
I will now be able to look at versions 17 or 18.
Thank you very much and above all keep it up, you're doing a great job.
Best regards
 
  • Like
Reactions: KonstaT

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
I might test this on my 4GB Pi 4 later, thanks!
...
First of all this build is quite outdated and I've discontinued LineageOS 16 builds for the Pi 4. You should really use the latest LineageOS 17 (https://forum.xda-developers.com/t/...17-1-android-10-for-raspberry-pi-4-b.4139059/ or 18 (https://forum.xda-developers.com/t/...18-1-android-11-for-raspberry-pi-4-b.4212945/) builds instead.
 

Raspberry pi fixer

New member
Jan 31, 2021
4
0
This could be the same issue with wifi that's been reported few times. You could try if it works with ethernet connection enabled or with on-board wifi disabled on /boot/config.txt (dtoverlay=disable-wifi).

I can't reproduce this on my own devices and it seems this only happens on some devices. It would be interesting to know what's the cause but I don't even have any good guesses with the information I have so far.
the same problem happens for me too. i will try the fix.(also no spamming:))
 

PeterJP

Member
Mar 21, 2015
26
2
Leuven
This is the best thing ever. I was struggling to get Volumio or other streamer Linux distros working for me. Volumio was okay for Internet radio, but the interface was clunky and not very customisable. And Spotify/Qobuz/Tidal/... all require several hoops to jump through before you get any sound.

With LineageOS? Perfect screen support with DPI selection and a good keyboard so a much better interface. Got my Allo Boss DAC working after a few tweaks. And Spotify/... all native, of course. Ideal!
 
  • Like
Reactions: KonstaT

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
This is the best thing ever. I was struggling to get Volumio or other streamer Linux distros working for me. Volumio was okay for Internet radio, but the interface was clunky and not very customisable. And Spotify/Qobuz/Tidal/... all require several hoops to jump through before you get any sound.

With LineageOS? Perfect screen support with DPI selection and a good keyboard so a much better interface. Got my Allo Boss DAC working after a few tweaks. And Spotify/... all native, of course. Ideal!
And user experience only gets better if you update to the more recent builds. :)
First of all this build is quite outdated and I've discontinued LineageOS 16 builds for the Pi 4. You should really use the latest LineageOS 17 (https://forum.xda-developers.com/t/...17-1-android-10-for-raspberry-pi-4-b.4139059/ or 18 (https://forum.xda-developers.com/t/...18-1-android-11-for-raspberry-pi-4-b.4212945/) builds instead.
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
Lineage 17 and 18 also have Allo Boss and RPi screen support?

I'm a bit busy at the moment trying to flash my S10+, which is a bit more complicated (system-as-root...) but I may do it afterwards.
Audio DACs work all the same.

LineageOS 16 is currently probably the best option if you need to use the official 7" display. LineageOS 17 has on option to switch to SwiftShader software renderer (which this build uses by default) but there's some issues with it. LineageOS 18 build currently has no support for the official 7" display (it's eventually going to work with hw accelerated graphics as well but this needs switching to Linux 5.10 kernel which I'm still holding back for other reasons).
 

PeterJP

Member
Mar 21, 2015
26
2
Leuven
Audio DACs work all the same.

LineageOS 16 is currently probably the best option if you need to use the official 7" display. LineageOS 17 has on option to switch to SwiftShader software renderer (which this build uses by default) but there's some issues with it. LineageOS 18 build currently has no support for the official 7" display (it's eventually going to work with hw accelerated graphics as well but this needs switching to Linux 5.10 kernel which I'm still holding back for other reasons).
Thanks for the extensive explanation. Good things come to those who wait (or so claims Guinness). In the meantime, my 16 is behaving erratically at times - it crashes with the app of a local radio station, for example (this one: https://play.google.com/store/apps/details?id=be.vrt.radioplus.klara)
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com

Ozi1100

Member
Aug 1, 2021
7
0
Hi, i flashed lineageos16 to an 16gb SD card and want to install gapps pico - my system partition is only 1GB and there are onlye 278MB left space. How can I increase the system partition?
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
Hi, i flashed lineageos16 to an 16gb SD card and want to install gapps pico - my system partition is only 1GB and there are onlye 278MB left space. How can I increase the system partition?
This build is seriously outdated and it's been discontinued for ages. You should use the latest LineageOS 18/19 builds instead.

Use an older OpenGApps package (or alternative gapps distributions) if you absolutely must. Gapps increased in size at some point and doesn't fit the system partition anymore.
 

Ozi1100

Member
Aug 1, 2021
7
0
I have tryed with lineageos 18/19 but I am using the 7 inch raspberry touch display and i dont have actually an micro hdmi cable .. maybe i will get one and try again with os19.
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
I have tryed with lineageos 18/19 but I am using the 7 inch raspberry touch display and i dont have actually an micro hdmi cable .. maybe i will get one and try again with os19.
Latest LineageOS 19 build has support for the official 7" touchscreen with hw accelerated graphics (vs. software renderer used in this build).
 

Ozi1100

Member
Aug 1, 2021
7
0
Latest LineageOS 19 build has support for the official 7" touchscreen with hw accelerated graphics (vs. software renderer used in this build).
I know but as described in your faq, to enable the 7" touchscreen i had to go to the settings, and therefore i need to connect the pi first with a monitor using micro hdmi :) I already tryed os19 and ended with rainbow and black screen. I already tryed to change resolution in the txt file and uncommented dtoverlay=vc4-kms-dsi-7inch in config.txt

Q: How to use official 7” touchscreen display?
A: You can enable required configurations using a settings option found in Settings -> System -> Advanced settings -> Touchscreen.
 

KonstaT

Senior Member
Jan 20, 2016
685
424
KonstaKANG.com
I know but as described in your faq, to enable the 7" touchscreen i had to go to the settings, and therefore i need to connect the pi first with a monitor using micro hdmi :) I already tryed os19 and ended with rainbow and black screen. I already tryed to change resolution in the txt file and uncommented dtoverlay=vc4-kms-dsi-7inch in config.txt

Q: How to use official 7” touchscreen display?
A: You can enable required configurations using a settings option found in Settings -> System -> Advanced settings -> Touchscreen.
You need to use the latest build with Linux 5.10 kernel. If you have issues with this, the LineageOS 19 topic is the right place to discuss it. https://forum.xda-developers.com/t/...19-0-android-12-for-raspberry-pi-4-b.4356891/

But yes, if you want to do this on LineageOS 19 without connecting HDMI display first, those are the two changes that need to make at minimum.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    Here’s my build of LineageOS 16.0 for Raspberry Pi 4 Model B. It is unofficial and unsupported by the LineageOS team. It’s for advanced users only. This build currently uses Google’s SwiftShader software renderer so graphics performance is probably not what you’d expect. 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!

    Screenshot_20200105-125543_Settings.png


    https://konstakang.com/devices/rpi4/LineageOS16.0/

    lineage-16.0-20200713-UNOFFICIAL-KonstaKANG-rpi4.zip
    https://www.androidfilehost.com/?fid=8889791610682891700
    md5:d8fe572b7ba14b010fc5475557bc8f77

    Working:
    • Audio (HDMI, 3.5mm jack, USB microphones, bluetooth speakers/headsets, etc)
    • Audio DAC (using PCM512x DACs e.g. Hifiberry DAC+)
    • Bluetooth
    • Camera (using official Pi camera modules & UVC USB webcams)
    • GPIO
    • GPS (using external USB modules e.g. U-Blox 7)
    • Ethernet
    • HDMI display
    • I2C
    • IR remotes (using external GPIO IR modules e.g. TSOP4838)
    • RTC (using external GPIO I2C modules e.g. DS3231)
    • Serial console (using external GPIO serial console adapters e.g. PL2303)
    • SPI
    • Touchscreen/multi-touch (using official 7” display)
    • USB (mouse, keyboard, storage, etc)
    • Wifi
    • Wifi tethering

    Not working:
    • Hardware accelerated graphics (V3D)
    • Hardware video decoding & encoding

    Issues:
    • SELinux is in permissive mode
    • and more…

    Sources:

    Thanks:
    • peyo-hd and everyone who has contributed to android-rpi
    • brobwind for bluetooth fixes
    • Google for Android Things platform
    • Android-x86 project
    • LineageOS team & everyone who has contributed to LineageOS 16.0
    6
    Merged commits not mentioned in the changelog.

    13.7. changelog:
    • add support for storage devices with exFAT filesystem
    • hide su binary when root access is not enabled in developer options
    • support for booting from USB devices (see FAQ)
    • add support for PCM512x audio DACs (tested with Hifiberry DAC+)
    • improve support for Waveshare HDMI touchscreens
    • fix recording videos with camcorder
    • add TWRP flashable zip to resize data partition (see FAQ)
    • update TWRP to 3.3.1-1
    • update to Linux 4.19.132 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 July 2020 (merged)

    12.2. changelog:
    • add camera HAL to support Pi camera modules and USB webcams (thanks to Android-x86)
    • fix portrait apps on forced landscape orientation (thanks to Ladehunter)
    • update GPS HAL
    • add ir-keytable tool to configure IR remotes
    • enable USB gadget support & fix adb toggle in developer options
    • update to Linux 4.19.103 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 February 2020 (merged)

    16.1. changelog:
    • fix USB storage
    • fix wifi tethering
    • update to Linux 4.19.95 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 January 2020 (merged)

    6.1. changelog:
    • initial LineageOS 16.0 build
    • use SwiftShader software renderer for graphics
    • option to use DIY hardware power button to boot to TWRP recovery (see FAQ)
    • initial support for IR modules and remotes (tested with TSOP4838)
    • include TWRP 3.3.1-0
    • use Linux 4.19.84 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    • Android security patch level: 5 December 2019 (merged)

    Previous builds:
    6
    New build.

    lineage-16.0-20200116-UNOFFICIAL-KonstaKANG-rpi4.zip

    https://www.androidfilehost.com/?fid=4349826312261702446
    md5:d5dc9d577e5170bbf8b07f95506ed55d

    -fix USB storage
    -fix wifi tethering
    -update to Linux 4.19.95 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    -Android security patch level: 5 January 2020 (merged)
    6
    New build.

    https://konstakang.com/devices/rpi4/LineageOS16.0/

    -add camera HAL to support Pi camera modules and USB webcams (thanks to Android-x86)
    -fix portrait apps on forced landscape orientation (thanks to Ladehunter)
    -update GPS HAL
    -add ir-keytable tool to configure IR remotes
    -enable USB gadget support & fix adb toggle in developer options
    -update to Linux 4.19.103 kernel and patch known vulnerabilities (CVE-xxxx-xxxx, and more)
    -Android security patch level: 5 February 2020 (merged)
    4
    How to install:
    1. Follow the official Raspberry Pi instructions for writing the image to the SD card (Linux, Mac, Windows).

    FAQ:

    Q: I can’t find developer options, why?
    A: Settings -> About tablet -> Click ‘Build number’ several times

    Q: I have no root, why? What is that hashtag on my status bar?
    A: You need enable root access under Settings -> System -> Developer options -> Root access. Root management is now integrated as part of LineageOS’ Privacy Guard and you can manage per app permissions under Settings -> System -> Developer options -> Manage root access. You’ll have a persistent notification in the status bar when you’re running an app that uses root permissions.

    Q: Settings -> Storage shows total system size of 4 GB. There's unallocated space on my sdcard. What should I do?
    A: This is a 4 GB image, remaining space on your sdcard will remain unallocated. You can use e.g. GParted and extend /data partition (/dev/block/mmcblk0p4) to cover the unallocated space. Resizing the partition manually will break support for encrypting /data. Format /data in TWRP recovery (Wipe->Format data) after resizing to leave required space for crypto footer.

    Or you can flash my resize zip in TWRP.


    Q: My display is not working. I can only see the rainbow screen but no Android boot animation. What should I do?
    A: This build uses 1280x720 resolution by default so you need to use a HDMI display that supports it. See this page under ‘Which values are valid for my monitor?’ to see how to check which resolutions your display supports using Raspbian. If your display doesn’t support 1280x720 resolution, you can try changing values in /boot/config.txt to something it does (see this page). 720p is still the maximum resolution that is supported by the graphics drivers used in this build.

    Q: I have official 7” LCD display and touchscreen. What should I do?
    A: Official 7” touchscreen is supported without any modifications. You will only need to change display size under Settings -> Display -> Display size (or change ro.sf.lcd_density to 120 in /system/build.prop) to adapt to the smaller resolution.

    Q: Raspberry Pi doesn’t have power button, how do I power off/reboot my device?
    A: Following keyboard keys work as Android buttons: F1 = Home, F2 = Back, F3 = Multi-tasking, F4 = Menu, F5 = Power, F11 = Volume down, and F12 = Volume up. You can also use one of many third party reboot applications.

    Q: How to create a DIY hardware power button?
    A: You can send power button events by connecting GPIO21 to ground.

    powerbutton.png


    Execute following commands in ‘adb shell’/serial console/terminal (you can enable built-in terminal app from Settings -> System -> Developer options -> Local terminal) to enable the feature and reboot your device:

    Code:
    su
    rpi4-powerbutton.sh

    You can also use the DIY power button to boot the device to TWRP recovery. Press and hold the button while powering on the device until you see the TWRP screen. If you use this method to boot to recovery, you can ignore what is said about booting into/out of TWRP later in the FAQ.

    Q: How to enable audio through 3.5mm jack?
    Execute following commands in ‘adb shell’/serial console/terminal (you can enable built-in terminal app from Settings -> System -> Developer options -> Local terminal) to enable the feature and reboot your device:

    Code:
    su
    rpi4-audio-jack.sh

    Q: How to boot from USB device?
    A: Warning, this is an experimental feature and there’s still some issues with it. Android shows USB storage notification for each partition and you should ignore these. TWRP shows errors in few places but everything seems to be working regardless of this.

    1. Install EEPROM that supports booting from USB
    2. Write image to your USB device as above
    3. Mount the USB device on your computer and rename following files on the boot partition:
      Code:
      mv ramdisk.img ramdisk-sdcard.img
      mv ramdisk-usb.img ramdisk.img
      mv ramdisk-recovery.img ramdisk-recovery-sdcard.img
      mv ramdisk-recovery-usb.img ramdisk-recovery.img
    4. Plug in the USB device to your Raspberry Pi, remove any sdcard, and boot

    Q: How to boot to TWRP recovery?
    A: There’s currently no proper way to boot between Android and TWRP, but this can achieved by renaming the ramdisk you want to boot. Execute following commands in ‘adb shell’/serial console/terminal (you can enable built-in terminal app from Settings -> System -> Developer options -> Local terminal) and reboot your device:

    Code:
    su
    rpi4-recovery.sh

    If mouse cursor doesn’t appear, try replugging your mouse.

    Q: How to boot out of TWRP recovery?
    A: You can execute the same script in TWRP terminal (Advanced->Terminal) if you have boot and system partitions mounted (Mount->Boot & Mount->System):

    Code:
    rpi4-recovery.sh boot

    Or you can flash my recovery2boot zip in TWRP.

    Q: How to update from previous LineageOS 16.0 build without losing data?
    A:
    1. Boot to TWRP recovery with the build you want to keep the data (see FAQ)
    2. Plug in an external USB storage device and select ‘Backup’
    3. Use ‘Select Storage’ to choose the USB device and ‘Swipe to backup’ (it’s only necessary to backup the data partition so you can uncheck other partitions to speed up the process)
    4. Write new LineageOS 16.0 image to the sdcard following installation instructions
    5. Boot to TWRP recovery with the new build (see FAQ)
    6. Select ‘Restore’ and find the backup you created from the USB device (‘Select Storage’)
    7. Make sure you only have data selected as partitions to restore (uncheck other partitions if available) and select ‘Swipe to Restore’
    8. (Flash Google apps package/other add-ons you had previously installed)
    9. Boot out of recovery (see FAQ)

    Q: How to install Google apps?
    A:
    1. Download open_gapps-arm-9.0-pico-xxxxxxxx.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 open_gapps-arm-9.0-pico-xxxxxxxx.zip from your selected storage
    4. Wipe->Factory reset!
    5. Boot out of recovery (see FAQ)