yashsingh1/xdaforums huggingface dataset:
[Fire TV Original Android Development] Pro-me3us:
View attachment 5976735

Lightweight Linux distribution based on Kodi for Amlogic hardware

View attachment 5977519	View attachment 5976731	View attachment 5976733
View attachment 5989709	View attachment 5989717	View attachment 5989731
View attachment 5989721	View attachment 5989719	View attachment 5989859

Customizable skins --- Arctic Zephyr - Reloaded

View attachment 6066561	View attachment 6066562	View attachment 6064230	View attachment 6064231

Boots from a USB flash drive on the 2nd gen FireTV Cube. FireOS is completely untouched, allowing to switch between CoreELEC and FireOS by simply unplugging the USB drive. This is currently a work in progress.

What's working:

Hardware video playback, HDR10, HDR10+, 8k@30fps

Dolby Vision (profiles 5, 8, 7 FEL & MEL)

Audio out, lossless audio passthrough (TrueHD/DTS-MA)

Disable HDR option (HDR to SDR tone mapping)

WiFi

USB peripherals

CEC and CEC remote control

IR Control

IR Blaster (requires custom build)

Bluetooth BR/EDR

What's not working:

Bluetooth LE

What's required:

Unlocked bootloader (new & old methods)

OTG cable & USB stick (8GB or larger recommended)

Etcher to flash USB stick

CoreELEC 21.0 Nexus generic image

DoVi kernel module

Kernel packed with raven DTB (included here)

Creating a CoreELEC USB boot stick:

Download

Etcher (program to flash USB stick)

CoreELEC NG 21.0 from Github (Generic NG image)

dovi.ko (DoVi kernel module)

CE-NG_21.0.zip (attached to this post)

Install Etcher on computer (Windows, MAC or Linux)

a) Select your flash drive

b) Select CoreELEC NG 21.0 image file

c) Flash USB stick

Unzip CE-NG_21.0.zip, and move kernel.img to the CoreELEC partition of the newly flashed USB stick.

Also copy dovi.ko to the CoreELEC partition.

Plug USB stick into Cube, reboot

**First boot will setup the CoreELEC environment, followed by an automatic reboot

CoreELEC forum support thread

Also checkout EmuELEC for the 2nd gen Cube

Thanks to:

The CoreELEC team especially Portisch & VPeter for all the help debugging raven for CE.

@Functioner for sharing the Dolby Vision fix

@Michajin for helping figure out a longstanding video out problem

Changelog:

April 7th, 2024​

updated kernel.img for CoreELEC 21.0 (release notes)

Includes fixes for TV-led Dolby Vision & CMV2.9 and CMV4.0

more Dolby Vision playback fixes and tweaks

March 5th, 2024​

updated kernel.img for CoreELEC 20.5 (release notes)

Dolby Vision support added (including DV FEL)

February 5th, 2024​

updated kernel.img for CoreELEC 20.3 (release notes)

August 28th, 2023​

Initial release to boot CoreELEC 20.2 on 2nd gen Cube.
[Fire TV Original Android Development] Pro-me3us:
Frequently Asked Questions

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.

Spoiler content hidden.
[Fire TV Original Android Development] Pro-me3us:
This is working well enough that it's ready for testing by others. Follow the installation steps in the main post. A few things to keep in mind.

Bluetooth is no working, and the FireTV remote won't work. At the moment you need to use a remote that is paired to your TV to control the Cube through CEC.

You can boot CoreELEC off of an OTG cable and flash drive, but it's easier if you attach a USB hub (preferably powered) that you can connect USB mouse, keyboard, or a compatible USB bluetooth dongle.

The Cube only has USB2, but that is enough for 30-40MB/s read speeds. Don't cheap out too much on USB sticks, you want one that can read at somewhere in that range.

Looking for a couple people with capable AVRs to test lossless formats like TrueHD/DTS-MA/DTS-X. I can only test these to a limited extent with what I have. Use HDMI audio for lossless passthrough and HDMI multi ch for LPCM.
[Fire TV Original Android Development] DeciBelioS:
Could it be possible in the future for Fire stick lite/3nd gen?
[Fire TV Original Android Development] Pro-me3us:
Not with CoreELEC, it's build specifically for Amlogic hardware. CoreELEC is a fork (Kodi >> OpenELEC >> LibreELEC >> CoreELEC). I'm not sure if there is MediaTek support upstream anywhere? The FireStick bootloader would also have to be modified to enable USB booting.

I don't know much about the FireStick/MediaTek resources out there, or what's possible with it's bootloader. The FireStick team that does the bootloader unlocks and ROM development could answer that better.
[Fire TV Original Android Development] DeciBelioS:
Too bad then, I would have loved to have a Kodi-only system, thanks anyway!
[Fire TV Original Android Development] Pro-me3us:
Updated the OP to CoreELEC 20.3. Added some FAQ to the 2nd post.

Thanks to @Michajin for helping trouble shoot a long standing video out issue. Anyone getting a black/pink/green screen when booting CE, make sure that HDR is set to adaptive (not always) in FireOS.

Currently working on getting DoVi for the next build, piggy-backing off of the amazing work of CE team. DoVi playback is working, even Profile 7 FEL. Unfortunately all the player UI and subtitles are black during DoVi playback.

Dolby Vision FEL test

View attachment 6066574
[Fire TV Original Android Development] Pro-me3us:
@Michajin There's an easy fix for the WiFi connectivity issue when running more that one Cube with CoreELEC/EmuELEC at the same time. CE/EE use the same default WiFi MAC address on any USB drive, causing a network conflict.

The MAC address can be changed, to make it unique for that CE/EE USB installation by adding wifi.cfg to

/storage/.config/firmware/wifi.cfg

In wifi.cfg modify the line MacAddr 00:0c:e7:66:32:dd. Attached is the entire wifi.cfg from FireOS, in case there are any other parameters you want to change, but a blank file with just these two lines are enough

MacOverride 1
MacAddr 00:0c:e7:66:32:dd

Added this to the FAQ with the simpler wifi.cfg. The wifi.cfg file is only for the MT7668 WiFi chip in the Cube, it won't be applied to any USB WiFi/Ethernet adapters.
[Fire TV Original Android Development] Michajin:
thanks, right now i am only running EmuElec. Totally loving the retro gaming... :) Would be awesome if we could get Linux working on it. I am not a fan of kodi as it seems installing app's and access to streaming content is spotty. I like kodi as more of a media player for local content.
[Fire TV Original Android Development] ECrispy:
Is root recommended or required? I read that its much easier to block OTA if rooted, but that means you can't use Prime etc right?

I'm planning to buy a 2nd gen cube, so recommendation is to block OTA during setup and unlock bootloader, then use this method correct? is there any reason to install custom launcher and do they allow still using Prime?
[Fire TV Original Android Development] Pro-me3us:
The unlock is required. Stock Cubes can't USB boot, that is added with the unlock exploit.

Unlocking the Cube doesn't affect DRM, Prime Video are unaffected. Some more aggressive apps will force close if they detect the device is rooted but they are well in the minority (eg Comcast apps like Peacock, NowTV, Sky). That can be circumvented by hiding root with Shamiko.

You would need to buy a new/sealed Cube to be sure it's unlockable. And you also need to skip the 'forced' update during device setup. This is mostly covered in this thread, and more details can be provided there if you need. Be careful with setup, if it does update then all exploits are patched.

Custom launcher is up to you, the Amazon homepage is a bit cluttered and a lot of folks prefer something cleaner.

It's possible to install Ubuntu on top of CoreELEC. I've only tried it recently, and it's a not as clean as I would like. I'll post some more details this week.
[Fire TV Original Android Development] Michajin:
A custom os would be great from a USB. Be great to really open up the options. Thanks for your work!
[Fire TV Original Android Development] ECrispy:
Thank you. I understand that bootloader unlock is required - I plan to use method 3- permanent unlock with twrp+magisk. since this installs a custom recovery and magisk and looks it also roots the device, correct? In this case is it still possible to boot to regular emmc with FireOS? My only experience with root etc is with my phone and you need to use a custom rom.

Once I boot FireOS, is the OTA block still in place? is there anything else needed?
[Fire TV Original Android Development] Pro-me3us:
Yes Magisk patches the stock boot.img, enabling root. Other than that change (and TWRP), you are still using stock FireOS. Magisk & TWRP also provide an extra safeguard against an accidental OTA update.

Yeah booting CoreELEC is the equivalent of booting a live USB stick on a computer. When the CoreELEC USB Stick is plugged in during a reboot, the Cube will boot off of the USB stick. CoreELEC doesn't mount or interact with the eMMC, so FireOS isn't affected. Shutting down CoreELEC, unplugging the USB stick, and powering on again, the Cube boots normally to FireOS. The same is true for EmuELEC.

If you are new to FireOS, updates are much more aggressive than Android. After you get past device setup, you'll want to enable ADB debugging and disable updates ASAP (pm disable com.amazon.device.software.ota). The root script puts a couple safe guards in place to prevent accidental updates, but simply blocking that one package is enough by itself. Once you disabled that package, it will stay disabled unless you do a TWRP data wipe.

I'm going to add a couple minor improvements to the root script. I'll have it posted in the next two days, it should also simplify the process a just a little.
[Fire TV Original Android Development] ECrispy:
I have a couple of Fire devices (FireStick4k, tablet) but never disabled OTA etc. What I read in the root thread was it supposedly blocks updates, plus you can write 0.0.0.0 in the hosts file for the update url. But from what you said just disabling that package should also work.

So since I am new to this, please dont mind if some of these seem obvious. steps I need to do -

- with new Cube 2, for initial setup, use a wifi hotspot from phone

- use trick in that thread to stop updates in setup

- enable developer options and adb

- connect from pc via adb, run root script, flash twrp

- while in adb, disable updater

- do I need to update firmware ??

- reboot, should now be in FireOS locked to sw it came with

- verify everything works.

- prepare usb with coreelec

- connect usb and reboot to use CE

did I miss anything? does this also mean I can use old FireTv without the ads and everything will work? thats a huge win and I won't need a custom launcher.
[Fire TV Original Android Development] Pro-me3us:
Ok so you know what to expect. There are a number of ways to block updates. Disabling the OTA package has been enough so far. You can do that without root on any FireTV device on older firmware.

A new Cube will come with PS7229 or older. Modifying the host file with Magisk is a possibility too. Or you could even delete the OTA app with root and dm-verity disabled.

There are number of ways to do this as too. There's this popular guide, but if you are using WiFi you can do a DNS block during setup which is really easy. During setup when you pick the WiFi AP to connect to, and have to type in the WiFi password, select the advanced button on the on on-screen keyboard first. Enter Ighor's DNS that blocks Amazon OTA updates. After registration, I'd just keep it offline until you are done with everything. Try the DNS block now on your 4K Stick, and that will cause updates to fail when you check for updates in settings.

After blocking updates, follow the root install script instructions and that will take care of the rest. That also blocks updates. You don't have to update FireOS if you don't want to. It will be on firmware from early 2021 at the latest.

Once the Cube is unlocked, you can USB whenever ready, to setup CE on your USB Stick.
[Fire TV Original Android Development] simondd:
So practically subtitles doesn't work?
[Fire TV Original Android Development] Pro-me3us:
Yes subtitles during DV playback are black rather than white, so effectively not working. Still looking for what is causing this.

EDIT: Tempory fix is to disable SDR->HDR OSD (player controls & subtitles) conversion during DV playback. This results in subtitles that are readable but discolored (yellow rather than white). DV video is unaffected.
[Fire TV Original Android Development] Pro-me3us:
Updating OP to CoreELEC 20.5. This release adds Dolby Vision support, including profile 7 support for FEL/MEL. There's a problem properly displaying the player controls & subtitles during DV playback. A temporary workaround is to add the following command to the autostart file

echo 5 > /sys/module/amdolby_vision/parameters/dolby_vision_mask

This leaves player controls & subtitles in SDR during DV playback so that they are usable, but their colors are distorted. Alternatively Dolby Vision support can be disabled under

Settings / System / CoreELEC / Disable Dolby Vision Support
[Fire TV Original Android Development] Pro-me3us:
@signde @ddogishere I was looking for a better way to handle the WiFi driver lockup problem. I think a cleaner way to handle it is to add an automatic 2sec delay to starting the connection manager service. This way we don't have to rely on the shutdown script to have run, in order for the autostart script to succeed.

SSH into the Cube

CoreELEC:~ # systemctl edit connman.service

Add the following two lines:

### Anything between here and the comment below will become the contents of the drop-in file

[Service]
ExecStartPre=/bin/sleep 2

### Edits below this comment will be discarded

Tap Ctrl+S (save), Ctrl+X (exit). You can then remove the shutdown script, and remove everything from autostart.sh except for the IR line:

# Enable IR demodulation, needed for IR control

echo "0xff8080c4 0x81FF03E8" >/sys/kernel/debug/aml_reg/paddr

These two files are in /storage/.config (Samba ConfigFiles).

Handling the delay this way should work as good or better than the autostart/shutdown scripts. I did 10 reboots in a row with no hangs. But maybe it will hang on the 20th boot? Ultimately you can also remove the MT7668 Bluetooth driver from the blacklist. The Cube will be able to regulate power consumption a tiny bit better having use of that driver.

If there are any problems with addons or mounts trying to access the network before it's available on boot:

Settings > CoreELEC Settings > Network > Wait for network before starting Kodi (check box)
[Fire TV Original Android Development] ddogishere:
@Pro-me3us thank you, will try that although I'm getting minimal lockups with bt blacklist.

Btw, anyone tried the nfs-kernel server in CE, any tutorial how to go about it?

Many thanks.
[Fire TV Original Android Development] abdul1907:
Hello friend, it has been 3 months since our conversation, but I have just got the device 😅

I set up the device without updating, similar to the root process, but I cannot root it. I have enabled the USB debugging option on my Cube device, but when I connect it to the PC, it doesn't respond at all. The `adb shell` command doesn't recognize the device. Am I missing any driver that needs to be installed?

My home screen is like this right now and this is my software version. Which root method is the simplest?
[Fire TV Original Android Development] Pro-me3us:
Long shipping time? Better to go through the unlocking steps in the root thread.
[Fire TV Original Android Development] signde:
I just tried this with the Ugoos. If I suspend from CE, I cannot get the device to wake from the remote.

FWIW I am using the remote.conf specified in the Ugoos guide. Not sure if that is relevant.

I have the Cube and Ugoos side by side so I was already sure it would not wake it from being off from the Ugoos remote.

I ran ir-keytable on the Cube while pressing the red power button and black power button on the Ugoos remote. Strangely, they seem to be the same command from each button?

CoreELEC:~ # ir-keytable -u
Protocols changed to irmp
Waiting for IRMP decode event. Please, press CTRL-C to abort.
Received IRMP code: remotewakeup='0x00ffff00', decode_type='0x0', remotewakeupmask='0xffffffff'
Received IRMP code: remotewakeup='0x00ffff00', decode_type='0x0', remotewakeupmask='0xffffffff'

Either way it looks like those commands do not match the codes you referenced.
[Fire TV Original Android Development] abdul1907:
@Pro-me3us Thank you very much. After trying it a few times, I rooted the device, downloaded Coreleci and wrote it to flash. I added the kernel.img and dovi.ko files to the main directory of the flash memory, but when I boot from USB, I see a green screen.
[Fire TV Original Android Development] Pro-me3us:
'Always HDR' needs to be changed to 'Adaptive' in FireOS.

Settings > Display > Dynamic Range Settings > Adaptive

FireOS settings menu might be a little different in PS7206, so look for that option under display. Then reboot to CE.
[Fire TV Original Android Development] Pro-me3us:
The AM6+ doesn't respond to IR in suspend, but it does in a shutdown state, that's odd. I guess that's the bug referenced by the BL301 tool.

Then then AM6+ isn't using the default value wakeup codes. The w400 is the Amlogic reference board for the s922x SOC, and it as well as the other Amlogic reference boards i checked used the same wakeup scancodes as the Cube. So it's still possible Cube is able to wake from shutdown by IR with one of the reference codes. It might not make a difference without a remote capablle of issuing one of those codes.

I don't have the CE build with irblaster support anymore to test those codes. If I get ahold of another working build I'll test it.

You can try this suspend script if you like. It will allow suspending and waking the Cube by IR in CE. The problem is that Kodi restarts on wakeup adding a ~20 sec delay. But in your case this might be more of a feature than a bug. Restarting Kodi might be all you need.
[Fire TV Original Android Development] abdul1907:
Thank you. For now, I haven’t experienced any issues with CoreELEC except for occasional freezing and staying on the startup screen. However, today, when I connected it to my sound system, it doesn’t recognize Dolby Atmos or DTS sound. It shows as multi PCM on my soundbar.

There are no issues with Dolby Vision, but it can’t passthrough the audio files. Is it working for you?
[Fire TV Original Android Development] Pro-me3us:
Follow these instructions for the bootup freezes if you haven't already.

Are you using ALSA: AML-AUGESOUND, HDMI?

Settings > System > Audio > Audio ouput device
[Fire TV Original Android Development] abdul1907:
When I select this, there is no sound from the movie.
[Fire TV Original Android Development] Pro-me3us:
Is passthrough enabled, along with any audio codecs supported by your soundbar?

Settings > System > Audio > Allow passthrough
[Fire TV Original Android Development] abdul1907:
It worked when I activated the options below. As you mentioned, I also solved the boot problem. I don't think there is a solution for the remote control, right? I don't know if anyone has used it, but I couldn't install realdebrid in coreelec. They install it with the resolveurl plugin on the internet, but that plugin is not in the coreelec library.

Everything looks good now. What would you suggest to make coreelec better?
[Fire TV Original Android Development] abdul1907:
By the way, after rooting, some licensed applications could not be opened even though I had a Widevine L1 license. Is it because my version is not up to date or do I need to install Playstore or something?
[Fire TV Original Android Development] Pro-me3us:
Do you mean Bluetooth pairing the Fire remote in CE? You can buy a BT USB dongle to get BLE functionality in CE, they're pretty cheap (~$5). But keep in mind it's not possible to have one BT remote paired both in CE and FireOS/Android. This isn't a Cube limitation, it's because CE uses Bluez, and FireOS/Android uses Bluedroid. If you want to use a single remote for FireOS and CE, either use CEC or get a remote with IR+BT, then use IR in CE and BT in FireOS.

I don't know about realdebrid, I've never used it. I think other's here are more familar with Kodi. You can ask on the CE forum, but they don't allow discussion about banned Kodi addon's.

ps regarding FireOS apps.
[Fire TV Original Android Development] Pro-me3us:
@signde I tested the 5 IR wake scancodes, but none were able to wake the Cube from a shutdown state. It looks like the IR receiver is off.

I was seeing if the IR receiver responsivity can be improved. Since IR is working on the 3rd gen Cube and it uses the same receiver, I copied all it's IR configurations but I can't tell if there's any improvement. You can judge for youself.

SSH into CE, copy & paste all the lines in one block. The change will be immediate, and gone after the next reboot. Switch back and forth between the two configurations to judge.

Current CE configuration

echo "0xff8080c4 0x81FF03E8" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808040 0x1F40190" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808044 0x12C00C8" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808048 0x960050" >/sys/kernel/debug/aml_reg/paddr
echo "0xff80804c 0x480028" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808050 0x70DAC013" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808058 0x88616B00" >/sys/kernel/debug/aml_reg/paddr
echo "0xff80805c 0x9F00" >/sys/kernel/debug/aml_reg/paddr

Gazelle configuration

echo "0xff8080c4 0x82FF03E8" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808040 0x1D801AC" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808044 0xF800CA" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808048 0x7A0066" >/sys/kernel/debug/aml_reg/paddr
echo "0xff80804c 0x44002C" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808050 0x70FA0013" >/sys/kernel/debug/aml_reg/paddr
echo "0xff808058 0x8915D00" >/sys/kernel/debug/aml_reg/paddr
echo "0xff80805c 0x9f80" >/sys/kernel/debug/aml_reg/paddr
[Fire TV Original Android Development] ddogishere:
Hey @Pro-me3us @signde Can you please provide step by step guide & files I need to try ir with my minix u22-xj max remote.

I'm not as Linux savvy as you guys.

Many thanks.
[Fire TV Original Android Development] Pro-me3us:
Find the remote.conf file for your remote here, and copy it to /storage/.config/remote.conf in CE. After a reboot, the remote should work over IR.
[Fire TV Original Android Development] Wagmans:
Hmm. Stuck on the Coreelec animation again. Not sure why.

Aaaand I copied kernel.img over again and that time it worked. Go figure. Thing is fussy as hell.
[Fire TV Original Android Development] Pro-me3us:
Did you already apply this fix, without it there will be sporadic boot lockups.
[Fire TV Original Android Development] Pro-me3us:
The player controls and subtitles display properly during Dolby Vision playback. Dolby Vision playback is now in fully working condition. Thanks to @Functioner for sharing the fix.
[Fire TV Original Android Development] abdul1907:
If I buy a Certified Refurbished Fire TV Cube (2nd Generation) through Amazon.com, does anyone know which version it will come with? I can't find the zero one, but if I do, do all zero cube 2nd generation devices come with the same software version? I found a few second-hand devices, but unfortunately they are all updated. Is there a chance we can downgrade them now?
[Fire TV Original Android Development] Pro-me3us:
We can't be sure what FireOS version might be on a refurbished unit. Amazon does have a good 30day return policy, so it can always be returned if you aren't happy with what you get.

$100 is a little expensive for a refurbished 2nd gen Cube. There are new/sealed Cubes on Ebay for less than $100. Any new/sealed Cube will be on old unlockable firmware. If you aren't already familiar with FireOS, you will need to skip the firmware update during registration.

Firmware can't be downgraded after PS7292 (last firmware that can be unlocked) because of anti-rollback protection.
[Fire TV Original Android Development] abdul1907:
Yes, when I checked ebay, I found a much cheaper sealed box, but if I buy it, I won't have the chance to return it, it's brand new products, they definitely come with old versions, right?