[OFFICIAL/UNOFFICIAL] LineageOS 19.1 for Amlogic G12*/SM1 Family Devices

Search This thread

npjohnson

Recognized Developer
Looking at changes for 20220918 build, saw that VENDOR.PROP still has this:
ro.vendor.sdr2hdr.enable=true

I believe that is from Amlogic's source-code by default, which has been affecting other Amlogic devices for the last few years of automatically forcing SDR-to-HDR upscaling, and has somehow been migrated into these builds.

@npjohnson can we get that prop flipped to FALSE or removed from build completely?
merged https://review.lineageos.org/c/LineageOS/android_device_amlogic_g12-common/+/339786 - I'll fix TvSettings side and revert it soon.
 
  • Like
Reactions: RiCkLaR

nshah2810

Member
Sep 28, 2022
5
0
Hello, I am trying to build dopinder from scratch since last week. I am able to flash lineage-19.1-20220908-unofficial-dopinder.zip release and that works but when I flash my own build it fails to boot.

Can someone help me debug the issue? I flash recovery, dtb, dtbo followed by adb sideload of the image.

The build log is from today, I think this might be the error.
ibfdt fdt_check_header(): FDT_ERR_BADMAGIC
aml_config_dtb 633
aml_config_dtb 663
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
Full logs attached below

Thanks,
Nirmit Shah
 
Last edited:

RiCkLaR

Senior Member
Dec 4, 2018
59
37
Is it implemented in a different way for R or higher?

Every certified device I've seen running android 11 (usually on a X4 or Y4 SoC), has this setting in display->screen resolution;

View attachment 5720365
What you "see" as a user may have changed, but Amlogic's code that interacts with the SoC stays the same and didn't change from Android 9/10/11 unless there was something completely f'kd up.

That HDR setting in the picture has incorrect label, {HDR_POLICY} for Amlogic refers to whether to get the HDR state from the media "SOURCE" or the connected "SINK" device in the code. That setting should instead have been labeled {HDR_MODE}.


I believe I have a runtime fix for HDR issues. The problem is not sdr2hdr but the S905Y2 hdr_policy setting.

Tested:
1) Setting sdr2hdr false in /vendor/build.prop did not change behavior
2) Setting /sys/module/am_vecm/parameters/hdr_policy to 1 produced SDR video from SDR sources and HDR video from HDR sources.

I would recomend leaving sdr2hdr as true (this probably enables the capability, rather than forcing the upscaling) and define /sys/module/am_vecm/parameters/hdr_policy as 1. That option could eventually be addressed in Settings if the UI option is implemented.
HDR_POLICY = "0" || #0 = SINK (connected TV or AVR determines HDR mode)
HDR_POLICY = "1" || #1 = SOURCE (media file determines HDR mode)
 
D

Deleted member 11959327

Guest
HDR_POLICY = "0" || #0 = SINK (connected TV or AVR determines HDR mode)
HDR_POLICY = "1" || #1 = SOURCE (media file determines HDR mode)

int
MODE_OFF = 0;
MODE_ON = 1;
MODE_AUTO = 2;

How does AUTO (2) work? What's the effect of the source media and/or the edid of the sink while in auto mode?


That HDR setting in the picture has incorrect label, {HDR_POLICY} for Amlogic refers to whether to get the HDR state from the media "SOURCE" or the connected "SINK" device in the code. That setting should instead have been labeled {HDR_MODE}.

Are there actually two distinct settings (HDR_POLICY and HDR_MODE), or only one setting that was mislabeled? If the former, should the HDR_POLICY setting not have any user control?

I'm slightly more confused now.
 
Last edited by a moderator:

tenfox

Member
Jun 8, 2019
14
6
HDR_POLICY = "0" || #0 = SINK (connected TV or AVR determines HDR mode)
HDR_POLICY = "1" || #1 = SOURCE (media file determines HDR mode)
Agree. And, apparently "2" is debug mode, which I have not yet tested.

hdr_mode changes do not appear to have an effect, as when set "0" (off) with or without sdr2hdr, HDR sources still output a HDR stream, but I have not tested this exhaustively.

hdr_policy = 1 is probably what we want for most use cases. CoreElec (media player distro) also chose it as their amlogic default.

Are there actually two distinct settings
Yes

If the former, should the HDR_POLICY setting not have any user control?
It seems to have the most control over output selection, so it should be user controlable.
 
  • Like
Reactions: RiCkLaR

RiCkLaR

Senior Member
Dec 4, 2018
59
37
...
hdr_mode changes do not appear to have an effect, as when set "0" (off) with or without sdr2hdr, HDR sources still output a HDR stream, but I have not tested this exhaustively.
...
So it is my belief that the PROP:ro.vendor.sdr2hdr.enable=true originated in Amlogic's source-code because the JAVA coding for the SdrManager was originally written with only 2 variables OFF & AUTO, the ON variable was missing; and instead of just adding the coding for ON, they added it as a PROP to save time, which ironically forces it ON when it doesn't need to be ON, let alone forced_on by having the prop=true, which is what's happening by setting it as a "Read-Only" prop in the vendor.prop for sdr2hdr.

Of course, I may be wrong, maybe the system_root permission file doesn't even allow sdr2hdr to be set when the prop is coming via vendor init and not system init; just letting you know my thinking on the issue.
 
D

Deleted member 11959327

Guest
If that hypothesis is true, how do some of the factory builds, like sabrina, manage to switch hdr on and off properly as needed?

I realize that this hdr issue has been a problem in various certified amlogic builds for years, but a few devices have fixed it. How was it fixed in those builds?
 

RiCkLaR

Senior Member
Dec 4, 2018
59
37
If that hypothesis is true, how do some of the factory builds, like sabrina, manage to switch hdr on and off properly as needed?

I realize that this hdr issue has been a problem in various certified amlogic builds for years, but a few devices have fixed it. How was it fixed in those builds?
Do you have a SABRINA? Fortunately, I don't, but all other devices use Amlogic's DROIDLOGIC subsystem which gives control to things like HDR_POLICY. Sabrina may not need Droidlogic to make HDR function properly if all the Droidlogic TVsettings, like HDR_POLICY, were hardcoded or hooked into the stock com.android.TVsettings.apk .

You familiar with the TiVo Stream4K (S905Y2), it used {HDR_POLICY=1} as default when it was on Android 9, but when they pushed out the Android 10 Q update the default is now {HDR_POLICY=0}, which I hate; but all these settings "should" be End-User selectable via DROID_SETTINGS vendor app if the software engineer took the time to go through Amlogic code and doesn't just build the firmware as-is. And with the TiVo at least it gives access to some of the Droidlogic coding, but not all; with its HDR settings hardcoded into the TVsettings.

So, if I choose to watch HDR content on the TiVo, I have made an ACTIVITY shortcut with the tvQuickActions app to activate its HDR_POLICY setting overlay manually. The Activity that toggles HDR_POLICY inside the TiVo is found inside the package:com.droidlogic.tv.setttings as a DolbyVision setting.

ADB shell command to toggle the setting:
Code:
am start 'com.droidlogic.tv.settings/com.droidlogic.tv.settings.display.dolbyvision.DolbyVisionSettingActivity'

But, that same shell command used with a stock Amlogic device without the DolbyVision license, will give two options: Enable or Disable. You DO NOT want to enable it, possible Green screen of death for the Onn.4K if enabled, or at least that what I believe seeing as the Onn.4K didn't block access to DolbyVision setting activities last I checked in its stock original firmware releases.
 
Last edited:
D

Deleted member 11959327

Guest
Thanks, that's very helpful. The interplay of dolbyvision with the hdr switching issue has been confusing to me. My optimum stream device (sdmc dv8555 s905x2 operator tier device w/dolbyvision) has done better with hdr switching than some of my sei devices like the tivo stream 4k. A recent review of a new sei804 based device also has hdr switching effected by whether or not the relevant app supported dolbyvision. The various chinese odm/oem (sei, sdmc, etc.) do all of the engineering a-to-z on these builds. It has repeatedly demonstrated to be quite sloppy.

You've obviously dove into this issue pretty deeply. I'm just trying to understand.
 

nshah2810

Member
Sep 28, 2022
5
0
Hello, I am trying to build dopinder from scratch since last week. I am able to flash lineage-19.1-20220908-unofficial-dopinder.zip release and that works but when I flash my own build it fails to boot.

Can someone help me debug the issue? I flash recovery, dtb, dtbo followed by adb sideload of the image.

The build log is from today, I think this might be the error.

Full logs attached below

Thanks,
Nirmit Shah
Not to spam but do we expect dopinder build from source to be stable? Can anyone assist me with it?
 

nshah2810

Member
Sep 28, 2022
5
0
Make sure you bootloader is the latest stock one, and it will boot fine.
Hi, thanks for the reply. Yes it does boot if I manually flash the stock bootloader on top of my build. However it gives a different KeystoreService error, although the aidl is present.

[email protected]]- logd: logdr: UID=1017 GID=1017 PID=3342 n tail=0 logMask=1 pid=3320 start=0ns deadline=0ns
[ [email protected]]- DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***DEBUG: Build fingerprint: 'Onn/sti6140d360/sti6140d360:10/QT/20220523:user/release-keys'DEBUG: Revision: '0'DEBUG:.
[ [email protected]]- DEBUG:
[ [email protected]]- DEBUG: Caused by:
[ [email protected]]- DEBUG: 0: In KeystoreSecurityLevel::new_native_binder.
[ [email protected]]- DEBUG: 1: In get_keymint_device.
[ [email protected]]- DEBUG: 2: In connect_keymint: Trying to connect to genuine KeyMint service.
[ [email protected]]- DEBUG: 3: Binder transaction error NAME_NOT_FOUND.'DEBUG: r0 00000000 r1 00000cf8 r2 00000006 r3 ffdeb2f8DEBUG: r4 ffdeb30c r5 ffdeb2f0 r6 00000cf8 r7 00000162
[ [email protected]]- init: Control message: Could not find 'aidl/android.system.keystore2.IKeystoreService/default' for ctl.interface_start from pid: 3091 (/system/bin/servicemanager)

here are the full logs. I even tried adding KeystoreService to DCM but the error is the same.
 

npjohnson

Recognized Developer
Hi, thanks for the reply. Yes it does boot if I manually flash the stock bootloader on top of my build. However it gives a different KeystoreService error, although the aidl is present.



here are the full logs. I even tried adding KeystoreService to DCM but the error is the same.
Yup. It boots but secure keystore is broken.

Welcome to dopinder at the moment. That's why wade and Deadpool shipped but dopinder didn't.
 
  • Like
Reactions: nshah2810

nosillock

Member
Jan 10, 2022
8
0
Hello, I have several dopinder devices still on 18.1 that I would like to update to 19.1. What is the process for updating 18.1 to 19.1? I only see instructions in the wiki for updating a build within the version.
 

bigCrashdev

Member
Dec 19, 2019
5
1
Seems like holding the button and having usb connected to a host triggers a different mode as documented here for the adt3.

Not shoving in the USB plug all the way, so only power gets connected until recovery or bootloader is booted and then shoving it in all the way leads to the expected result.
Unbelievable, but that did the trick for me.

As it might be of interest for others (puzzling random replies together ;) ):

I am trying to flash to wade. The first steps (as described in lineage wiki) went without any problems, up to the point where I had to reboot into recovery (after flashing it via fastboot). This just gave me a black screen. So I booted normally which worked. However, from then on rebooting into bootloader did NOT work anymore. Also, rebooting into recovery did not work anymore (in both cases the brand's logo got "stuck" without adb or fastboot being able to communicate).

I then did @Jann F 's USB trick and bam. LineageOS recovery from where I could sideload the rom.
 

nosillock

Member
Jan 10, 2022
8
0
Unbelievable, but that did the trick for me.

As it might be of interest for others (puzzling random replies together ;) ):

I am trying to flash to wade. The first steps (as described in lineage wiki) went without any problems, up to the point where I had to reboot into recovery (after flashing it via fastboot). This just gave me a black screen. So I booted normally which worked. However, from then on rebooting into bootloader did NOT work anymore. Also, rebooting into recovery did not work anymore (in both cases the brand's logo got "stuck" without adb or fastboot being able to communicate).

I then did @Jann F 's USB trick and bam. LineageOS recovery from where I could sideload the rom.
I cannot believe this works, but it does!
 

Top Liked Posts

  • 1
    On wade, I went back to stock (edit: and updated to latest, like the one time this worked) to test something, and then back to Lineage and auto HDR isn’t working again (HDR is on all the time if enabled on TV). Why would this vary from install to install? Is this working for other people?
    likely some magic persistent settings - I'll have to look into it.
    1
    FYI - Anyone with a dynalink 4K that gets bricked, this is the full steps I took to unbrick it. Special thanks to npjohnson for letting be bug him with various technical questions out of the blue!



    =====================
    How to unbrick dynalink 4k if stuck at dynalink logo:
    =====================

    Assumptions made:
    - You're on ubuntu
    - All scripts run as root (sudo -iu root)
    - You can see your amlogic device listed running lsusb (also as root!)

    1. power off unit by unplugging
    2. plug unit back in to a computer while holding side button
    3. download and install https://github.com/khadas/utils/tree/master/aml-flash-tool/tools/linux-x86 on ubuntu
    4. go to the path of /home/your-user-name-here/Downloads/utils-master/aml-flash-tool/tools/linux-x86/ in a terminal window,
    5. run these cmds. you can get these files from the official lineageos page if you dont have them already.

    Note: you need to go to your own username, and of course in the future a different date will be on the recovery file, make sure to copy the file name from your specific dtb file.

    Bash:
    ./update partition dtbo /home/bryantdl7/Downloads/dtbo.img
    ./update partition _aml_dtb /home/bryantdl7/Downloads/lineage-19.1-20221024-dtb-wade.img
    ./update partition recovery /home/bryantdl7/Downloads/lineage-19.1-20221120-recovery-wade.img
    ./update bulkcmd fastboot

    6. verify you are in fastboot by doing:
    Bash:
    fastboot devices
    , it should display a device in fastboot.
    7. run
    Bash:
    fastboot reboot bootloader
    as a sanity check, sometimes it half loaded for me.
    8. download the factory images via OP's post
    9. run the flash all script inside the factory image.
    10. You are unbricked!
  • 2
    Thanks. I was just about to try it but the files aren't there anymore. The link loads but it says an error occurred.

    I'm not sure if an older unofficial version would work when the newer official version doesn't. It might be a problem with my device and not the lineage zip. I might have messed it up somehow with the huge amount of reflashing and resetting that I've done.
    new builds coming.
    1
    What did you do exactly?
    What did you do exactly?

    Here is a quick guide for anyone that brinks their unit.
    Here is the set of tools i used.


    Install Amlogic_USB_Burning_Tool_v2.2.0 and all the drivers that comes with it.
    Open the application, hold the side the button and plug in the device.
    The application will make the device hold state without looping.
    Close the applicaiton

    Open CMD and navigate to "aml-flash-tool-master\tools\windows"
    run the following commands,

    Code:
    update.exe partition dtbo C:\directory to\dtbo.img
    update.exe partition _aml_dtb C:\directory to\dtb.img
    update.exe partition recovery C:\directory to\recovery.img

    onces that done. reboot the device whiles holding the button.
    Open the burning tool get a hold of it and close it.

    run cmd and navigate back to "aml-flash-tool-master\tools\windows"
    run this command.

    Code:
    update.exe bulkcmd fastboot

    you cannot boot in to recovery as the wiki states. i have no idea why.
    so command "fastboot reboot-recovery" doesn't work.

    what worked for me was "fastboot boot path-to-recovery.img-file"

    from there on, install the lineage.zip file with adb command and whatever else you want to install.

    done.
    1
    Lineage working beautifully after Several days of running. I'm new to android TV. This little thing packs a punch.

    How do I buy developers a beer?

    Already donated to lineage organization.
    1
    Is dopinder already stable in streaming applications? Where can I see a list of fixed issues?
    1
    FYI - Anyone with a dynalink 4K that gets bricked, this is the full steps I took to unbrick it. Special thanks to npjohnson for letting be bug him with various technical questions out of the blue!



    =====================
    How to unbrick dynalink 4k if stuck at dynalink logo:
    =====================

    Assumptions made:
    - You're on ubuntu
    - All scripts run as root (sudo -iu root)
    - You can see your amlogic device listed running lsusb (also as root!)

    1. power off unit by unplugging
    2. plug unit back in to a computer while holding side button
    3. download and install https://github.com/khadas/utils/tree/master/aml-flash-tool/tools/linux-x86 on ubuntu
    4. go to the path of /home/your-user-name-here/Downloads/utils-master/aml-flash-tool/tools/linux-x86/ in a terminal window,
    5. run these cmds. you can get these files from the official lineageos page if you dont have them already.

    Note: you need to go to your own username, and of course in the future a different date will be on the recovery file, make sure to copy the file name from your specific dtb file.

    Bash:
    ./update partition dtbo /home/bryantdl7/Downloads/dtbo.img
    ./update partition _aml_dtb /home/bryantdl7/Downloads/lineage-19.1-20221024-dtb-wade.img
    ./update partition recovery /home/bryantdl7/Downloads/lineage-19.1-20221120-recovery-wade.img
    ./update bulkcmd fastboot

    6. verify you are in fastboot by doing:
    Bash:
    fastboot devices
    , it should display a device in fastboot.
    7. run
    Bash:
    fastboot reboot bootloader
    as a sanity check, sometimes it half loaded for me.
    8. download the factory images via OP's post
    9. run the flash all script inside the factory image.
    10. You are unbricked!
  • 27
    lineage-os-logo.png

    Amlogic G12*/SM1 Family Devices
    Code:
    - Your warranty is now void.
    - You have been warned.
    - Use at your own risk.

    Introduction:
    This is the Official Lineage OS 19.1 thread for the Amlogic G12*/SM1 SoC family of devices.

    Downloads:
    Please follow the install instructions in your device's Wiki page linked below exactly, and make sure your device's firmware matches the required firmware listed:

    Official Builds:

    Disclaimer: My unofficial builds have full Android TV Google Apps and some other goodies included. OTA's roll roughly once a month. Support not guaranteed or implied.

    Unofficial Builds:
    We also support a few development boards, but at least (for now, until we have time to write up instructions), you're on your own to figure out the install process and set things up:
    EDIT: The development boards don't boot on LineageOS 19.1 at the moment for some reason, we're looking into it.

    If you don't follow these instructions, or use 3rd party add-ons (like Magisk) please don't expect support here.

    Known Bugs:
    • Recent apps/Multitasking menu doesn't launch.
    • (sabrina only) The remote firmware sometimes gets hung up, you can reboot to solve this issue.
    • (dopinder/sabrina) L1 is currently broken, this is what is holding up official builds for these devices.
    Notes:
    • GApps are baked in on Unofficial builds - No, I will not be building without GApps included for this device. These builds are built, packaged, and signed by me, and not affiliated with LineageOS whatsoever.
    • Firmware is shipped in the ROM package for this device, so you'll end up on the newest version of compatible firmware after install. Please don't touch firmware partitions after install.
    • On the unofficial OTA is provided the same way officials would have them.
    • Find any more on an official build? Report them according to this guide.
    FAQ:
    • Does L1 Widevine DRM break when I unlock my bootloader?

      Nope, it works fine. L1 certificates, and the mechanism that reports is all still exist and work as expected.

    • Can I haz Netflix?

      Yup! Play Store has it for you. Unless you're on dopinder or sabrina, but that will be fixed soon hopefully.

    • Is this Android TV or Google TV?

      Android TV, with some of the better components of Google TV.

    • Can I go back to stock and relock the bootloader?

      Yeah, grab the factory image for your device and flash it just like you would for a Pixel device, you can find the factory images here. Don't know it I'd relock though, consider that process largely untested on these device. Especially on sabrina, where you can't necessarily re-unlock should you ever want to.

    • Are these the stock codenames for these devices?

      Astute observation, no, they are not. The ADT-3 is actaully `adt3`, but earlier in production is was `deadpool`, which is much cooler. The Dynalink box internally is extremely similar to the ADT-3, so we coined it `wade` after Wade Wilson, AKA deadpool. The Onn box is in the same family, but different enough to coin it `dopinder`, after, well, go watch Deadpool the movie I guess. sabrina is actually the codename given by Google - no clue as to the reason.

    • Does it pass SafetyNet?

      Maybe - the only sure fire way it Magisk, as our boot loader is unlocked and can't be relocked safely.

    • Does the stock remote work?

      Yup, just like it would on stock, in-remote-microphone and all! If it's an IR remote like wade's, it will even work in recovery!

    • Can we we support higher resolution than 4K, higher FPS, or HDR on non-certified screens?

      Nope.

    • I have a very similar device! Can I install these builds and use them?

      No. Please don't do that. You will brick your device, as we include firmware and bootloader images.

      If you're a developer looking to help port to a new device, contact me.

    Kernel Source: https://github.com/LineageOS/android_kernel_amlogic_linux-4.9

    Contributors:
    • npjohnson
    • bgcngm
    • stricted
    • webgeek1234
    • deadman96385
    • trautamaki
    • luca020400
    • aleasto
    14
    Yeah, you used the stock recovery. You need to fastboot flash, then fastboot boot recovery, I'll update the docs.

    For dopinder, it's needed right now.

    Found a procedure for dopinder without the need for keyboard/OTG.

    The docs under "Installing a custom recovery using fastboot" state to use "adb reboot fastboot" which doesn't work for booting recovery, needed to do "adb reboot bootloader" instead.

    Full command log (after unlocking bootloader and re-enabling USB debugging) of the install process with just a regular Micro USB to USB A cable:
    Code:
    adb reboot bootloader
    fastboot flash recovery lineage-18.1-20210805-recovery-dopinder.img
    fastboot boot lineage-18.1-20210805-recovery-dopinder.img
    adb reboot sideload
    adb sideload lineage-18.1-20210805-UNOFFICIAL-dopinder.zip
    # if successful then load bootloader and factory reset
    adb reboot bootloader
    fastboot -w
    fastboot reboot

    Successfully booted to LineageOS after this!
    7
    deadpool an wade are official again, hopefully we got it all right this time around.

    onto dopinder and Sabrina. Hoping to get those shipped soon.
    6
    Note:

    Since the Lineage Android TV Builds for this little box (aka Boxes), are stable for the most part, but seems
    people are bouncing back in forth from Stock to Lineage and back to stock.

    I created a batch file that will auto flash the stock images and wipe data and so on.. pretty much it will
    make your box as it was when you first booted it after taking it home to try it.

    2nd, I also created a batch file that will backup current images.. No need for a fancy recovery or anything like the
    such. it will use the worldcup or what I like to say, USB Burn mode, and backup each and every partition.
    as well as some not so much needed ones like, misc and metadata. (Just for giggles)..

    backups will be copied to backup dir, I also created a separate batch file to restore your backup.


    I am one that hates doing things the long way over and over, so I always create ways to make things simple
    in the future for people.

    This way, you all can test your hearts out all the new lineages and still have your full Stock backup (including data).
    and restore back in forth as you wish.

    I will upload the backup_restore zip package as soon as I can and with @npjohnson permission I will link
    in thread. Otherwise you will have to just DM/PM me and ill link you the location.

    I am just trying to help the many that I seen complain and dont understand how to go back in forth.
    so with this script, it should take care of most on that. No Fancy Recovery needed...

    you will need worldcup driver for Amlogic........ you can find that on your own.

    Also, to get into USB Burn mode, press side button while plugging in USB cable.
    Keep pressing till you see the LOGO or hear the sound from your computer.

    then just run the batch file and wait..

    if its easier for you:

    Run the batch file, it will keep saying waiting for device..
    Just press the side button while plugging in USB, when you see it start, then release button...........
    and wait till finished..

    Only TESTED On Dopinder Boxes, but im sure they are all the same as for the partition layouts.
    6
    wade and deadpool are official now!