Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widevine AARCH64 now available #530

Closed
matthuisman opened this issue Feb 7, 2023 · 13 comments · Fixed by #533
Closed

Widevine AARCH64 now available #530

matthuisman opened this issue Feb 7, 2023 · 13 comments · Fixed by #533

Comments

@matthuisman
Copy link

64bit ARM Linux Widevine CDM now out in the wild 🙂
@tmm1 found it. looks like was just released last month in a new 64bit beta chrome os

"
seems new development https://groups.google.com/a/chromium.org/g/chromium-os-dev/c/GdZ0mebutXw
inside https://gsdview.appspot.com/chromeos-localmirror/distfiles/chromeos-lacros-arm64-squash-zstd-112.0.5579.0
"

i managed to open the above squash-zstd file in windows using an extended version of 7zip: https://github.com/mcmilk/7-Zip-zstd

tmm1 said its not working in the arm64 build of LibreELEC due to "libwidevinecdm.so: undefined symbol: __aarch64_ldadd4_acq_rel" but the LibreELEC guys are looking into it

inputstream helper will need to add support for this.
Not sure if there is any recovery image that contains it yet.
Unless there is a Beta channel recovery.
Looking for Acer Chromebook Spin 13 (CP713-1WN) on Chrome version 112
Current "Stable" seems to be chrome 109

UPDATE:
"LE folks got aarch64 widevine working! Might require some glibc patches, will see how it shakes out"

@tmm1
Copy link

tmm1 commented Feb 8, 2023

Okay so I found arm64 widevinecdm.so in two places:

gs://chromeos-localmirror has squashfs archives containing arm64 chrome which are part of Lacros

According to https://chromium.googlesource.com/chromiumos/docs/+/HEAD/archive_mirrors.md#public-mirrors, this bucket is used by google developers to "manually copy files for mirroring purposes". However it seems there is some automated process uploading builds there, because there are many months worth of chrome builds going back to chrome v99

A full list is available on this url: https://gsdview.appspot.com/chromeos-localmirror/distfiles/?marker=distfiles%2Fchromeos-lacros-amd64-squash-zstd-106.0.5249.42

These can be extracted using unsquashfs as follows:

$ wget https://gsdview.appspot.com/chromeos-localmirror/distfiles/chromeos-lacros-arm64-squash-zstd-112.0.5579.0
$ unsquashfs chromeos-lacros-arm64-squash-zstd-112.0.5579.0
$ file squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so
ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b71fd3342a03fdb140e1f7a757960df219d63625, stripped

beta update images for certain Acer chromebooks (trogdor / lazor) use arm64 userland

According to https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices/, the existing ARM chromebooks all currently using aarch64 kernel combined with arm userland.

However according to this thread, someone reported that beta on their chromebook was using arm64 userland.

Unfortunately the https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.json endpoint only lists STABLE builds. On https://chromiumdash.appspot.com/serving-builds?deviceCategory=ChromeOS you can see the latest beta and canary builds, but there is no way to download them.

This was confirmed according to this reddit post that there are no recovery images available for beta and canary builds builds. There is a feature request active for beta recovery images, but has not seen any traction.

Looking for a way to download beta update images, I found this reddit post which talks about how to find the urls on an actual device inside /var/log/update_engine.log. The url format used is also provided.

Based on that information, I found this blog post which explains how google's "omaha" update service serves up beta updates. The post includes some python code to make an update request yourself, which is available in this repo: https://github.com/ajorg/cros-updates

I cloned that repo, and after some searching I was able to find the relevant variables for the trogdor device, which are typically available on the device as follows:

Screenshot 2023-02-05 at 4 50 54 PM

With those vars, I made the following change to cros-updates:

--- a/lambda_function.py
+++ b/lambda_function.py
@@ -53,10 +53,10 @@ CHROMEBOOKS_JSON = (
     environ.get("CHROMEBOOKS_JSON")
     or """[
   {
-    "appid": "{92A7272A-834A-47A3-9112-E8FD55831660}",
-    "track": "stable-channel",
-    "board": "kevin-signed-mpkeys",
-    "hardware_class": "KEVIN D25-A3E-B2A-O8Y"
+    "appid": "{9023C063-08D6-4A4F-908C-BCF97DE8BA69}",
+    "track": "beta-channel",
+    "board": "trogdor-signed-mpkeys",
+    "hardware_class": "LAZOR-FHYR D5B-B2A-F4G-R2W-B5X"
   }
 ]"""
 )

Then running python3 lambda_function.py produces the URL to the latest beta image for that device:

$ python3 lambda_function.py
{"Request": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<request protocol=\"3.0\" ismachine=\"1\">\n  <app appid=\"{9023C063-08D6-4A4F-908C-BCF97DE8BA69}\" track=\"beta-channel\" board=\"trogdor-signed-mpkeys\" hardware_class=\"LAZOR-FHYR D5B-B2A-F4G-R2W-B5X\" delta_okay=\"false\">\n    <updatecheck/>\n  </app>\n</request>"}
{"Response": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response protocol=\"3.0\" server=\"prod\"><daystart elapsed_days=\"5882\" elapsed_seconds=\"40272\"/><app appid=\"{9023C063-08D6-4A4F-908C-BCF97DE8BA69}\" cohort=\"1:6:\" cohortname=\"trogdor_lazor_beta\" status=\"ok\"><updatecheck _eol_date=\"22067\" _firmware_version=\"1.1\" _firmware_version_0=\"1.1\" _firmware_version_1=\"1.1\" _firmware_version_2=\"1.1\" _firmware_version_3=\"1.1\" _firmware_version_4=\"1.1\" _kernel_version=\"1.1\" _kernel_version_0=\"1.1\" _kernel_version_1=\"1.1\" _kernel_version_2=\"1.1\" _kernel_version_3=\"1.1\" _kernel_version_4=\"1.1\" status=\"ok\"><urls><url codebase=\"http://edgedl.me.gvt1.com/edgedl/chromeos/trogdor/15278.51.0/beta-channel/\"/><url codebase=\"http://dl.google.com/chromeos/trogdor/15278.51.0/beta-channel/\"/><url codebase=\"https://edgedl.me.gvt1.com/edgedl/chromeos/trogdor/15278.51.0/beta-channel/\"/><url codebase=\"https://dl.google.com/chromeos/trogdor/15278.51.0/beta-channel/\"/></urls><manifest version=\"15278.51.0\"><actions><action event=\"install\" run=\"chromeos_15278.51.0_trogdor_beta-channel_full_mp-v7.bin-gyzwiyrwmezgn7gx74jxtm47d4vece3i.signed\"/><action ChromeOSVersion=\"15278.51.0\" ChromeVersion=\"110.0.5481.82\" IsDeltaPayload=\"false\" MaxDaysToScatter=\"14\" MetadataSignatureRsa=\"HBo/h/FnoHniouS7gmZOVk60LDhhiNBxYG7qFErgp8GqWj5W4+1Jkm8fvK7mUGlqZ5B2lO3Q3CDgJdHgVUjSWzcO7oiqRWeGXjqgabovTPvAMANYhmMo2xyX+1hQGX8smScVxqqB6I5+PVOClEWkxsc5Sb+6uer/6FoNrJPmIAuZ/qxHe3z1kvnnUULUUvwdwXMOc3x6N+qMTlYF4Vu7H3IZ572nSbRf4LP+2WR4aWtwvj0Hvvu9G4jc1QGgrojlw4PKgTpUOFOLwe9V9MSqEOtYmTZbIyFRytbOItczTbwn3773bZfgApm4cNcUFxLN5i8+w41aURdhutsr9pVKPw==\" MetadataSize=\"66182\" event=\"postinstall\" sha256=\"7p45aYKjOGD9gtdGQeZ1/pu36MM/9iRfI8lagq0lwAw=\"/></actions><packages><package fp=\"3.ee9e396982a33860fd82d74641e675fe9bb7e8c33ff6245f23c95a82ad25c00c\" hash_sha256=\"ee9e396982a33860fd82d74641e675fe9bb7e8c33ff6245f23c95a82ad25c00c\" name=\"chromeos_15278.51.0_trogdor_beta-channel_full_mp-v7.bin-gyzwiyrwmezgn7gx74jxtm47d4vece3i.signed\" required=\"true\" size=\"1251102522\"/></packages></manifest></updatecheck></app></response>", "Status": 200}
Acer Chromebook Spin 513, CP513-1H/1HL, R841T/LT updated to 110.0.5481.82

The URL constructed out of the json/xml response is:

https://dl.google.com/chromeos/trogdor/15278.51.0/beta-channel/chromeos_15278.51.0_trogdor_beta-channel_full_mp-v7.bin-gyzwiyrwmezgn7gx74jxtm47d4vece3i.signed

Looking at this file, you'll notice the first four bytes are CrAU. Searching for that, I discovered this project to extract these files: https://github.com/sebanc/chromeos-ota-extract/blob/master/extract_android_ota_payload.py

Running that produces:

$ python3 extract_android_ota_payload.py chromeos_15278.51.0_trogdor_beta-channel_full_mp-v7.bin-gyzwiyrwmezgn7gx74jxtm47d4vece3i.signed
Extracting 'root.img'
Extracting 'kernel.img'

where root.img is an ext2 filesystem:

$ file root.img
root.img: Linux rev 1.0 ext2 filesystem data, UUID=00000000-0000-0000-0000-000000000000, volume name "ROOT-A" (large files)

I was able to loopback mount this, and inside I found the same widevinecdm.so:

$ file /mnt/ROOT-A/opt/google/chrome/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so
ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b71fd3342a03fdb140e1f7a757960df219d63625, stripped

@matthuisman
Copy link
Author

There should be a way to download it using chromes extension updater as well. If someone with arm64 useland opened chrome components and check for update on widevine module and record the request. This is how I grab all the others. Small downloads as well.

@jollySleeper
Copy link

Hi, @jakermx and @matthuisman. I was successfully able to run widewine on Kodi on arm64. I just replaced the libwidevinecdm.so in .kodi/cdm and it was working. The libwidevinecdm.so was extracted from 64bit beta chromeOs releases by theofficialgman (follow this thread). I just downloaded this file and extracted the libwidevinecdm.so file.
image
And removed the arm64 check in __init.py__ on line 146.

Hope you find this helpful. This plugin is much appreciated ❤️

@tmm1
Copy link

tmm1 commented Feb 24, 2023

Stable chromeOS now includes aarch64 widevine according to xbmc/inputstream.adaptive#1128 (comment)

@matthuisman
Copy link
Author

matthuisman commented Mar 14, 2023

the widevine 4.10.2557.0 arm64 for anyone that needs it:
https://slyguy.uk/.decryptmodules/widevine/4.10.2557.0-linux-arm64.so
or
http://archive.raspberrypi.org/debian/pool/main/w/widevine/libwidevinecdm0_4.10.2252.0+1_arm64.deb
(deb name is 4.10.2254 but the widevine cdm is actually 4.10.2257.0)

@lameventanas
Copy link

Hi, @jakermx and @matthuisman. I was successfully able to run widewine on Kodi on arm64. I just replaced the libwidevinecdm.so in .kodi/cdm and it was working. The libwidevinecdm.so was extracted from 64bit beta chromeOs releases by theofficialgman (follow this thread). I just downloaded this file and extracted the libwidevinecdm.so file. image And removed the arm64 check in __init.py__ on line 146.

Hope you find this helpful. This plugin is much appreciated ❤️

Kodi still prompts me to download "a newer version" of the library, and proceeds to download a ChromeOS image.
I think there must be other files present in the cdm directory.

@CastagnaIT
Copy link

hi there, there are still active maintainers on ISH?
CE and LE devs are wondering how to proceed because aarch/arm64 system images for some devices are ready
but on ISH still lacks this support, this will be a problem for users and add-ons, since we are all stuck

i want remind you that time ago i left a message on Add-ons slack channel, but no answers by anyone
in that message i summarised the situation of common kodi platform/systems, which i quote here:

  • coreelec: arm64/aarch64 officially supported from kodi 21
  • libreelec: arm64/aarch64 officially supported from kodi 21, but some user may make a custom LE build with Kodi 20
  • kodi on linux: users may build or find third party PPA with arm64/aarch64 support
  • inpustream adaptive: we already added and released ISA patched for arm64/aarch64, from kodi 20

@horstle
Copy link
Collaborator

horstle commented Mar 21, 2023

I'll try to find some time in the next days to add support in ISH. Two questions:

  • How should we determine which library to install? I would check whether the hardware ist 64bit and the version number of ISA. Is that enough?
  • Do you know how to determine before the download which images contain the 32bit version of the library and which have the 64bit version?

@horstle
Copy link
Collaborator

horstle commented Mar 26, 2023

Alright, I think #533 is ready to test now.

@slavid
Copy link

slavid commented Apr 6, 2023

Hi, @jakermx and @matthuisman. I was successfully able to run widewine on Kodi on arm64. I just replaced the libwidevinecdm.so in .kodi/cdm and it was working. The libwidevinecdm.so was extracted from 64bit beta chromeOs releases by theofficialgman (follow this thread). I just downloaded this file and extracted the libwidevinecdm.so file. image And removed the arm64 check in __init.py__ on line 146.

Hope you find this helpful. This plugin is much appreciated ❤️

Hi @jollySleeper and @matthuisman, would you mind explaining with a little bit more of detail the steps you took to make it work? I'm trying to do what you wrote but it is not working.

  • I have a Raspberry Pi 4
  • Raspberry Pi OS 64-bit
  • SlyGuy repository
  • Trying to play Widevine content from HBO Addon

This is what I have done so far:

Downloaded https://slyguy.uk/.decryptmodules/widevine/4.10.2557.0-linux-arm64.so and put it in /home/pi/.kodi/cdm/libwidevinecdm.so

$ pwd
/home/pi/.kodi/cdm
$ ls -la libwidevinecdm.so
-rwxr--r-- 2 pi pi 9490256 Apr  7 01:16 libwidevinecdm.so
$ file libwidevinecdm.so
libwidevinecdm.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b71fd3342a03fdb140e1f7a757960df219d63625, stripped

Edited file /home/pi/.kodi/addons/script.module.inputstreamhelper/lib/inputstreamhelper/__init__.py and comented out lines 146-151 so the file looks like this:

138     @staticmethod
    139     def _supports_widevine():
    140         """Checks if Widevine is supported on the architecture/operating system/Kodi version."""
    141         if arch() not in config.WIDEVINE_SUPPORTED_ARCHS:
    142             log(4, 'Unsupported Widevine architecture found: {arch}', arch=arch())
    143             ok_dialog(localize(30004), localize(30007, arch=arch()))  # Widevine not available on this architecture
    144             return False
    145
    146 #        if arch() == 'arm64' and system_os() != 'Android':
    147 #            import struct
    148 #            if struct.calcsize('P') * 8 == 64:
    149 #                log(4, 'Unsupported 64-bit userspace found. User needs 32-bit userspace on {arch}', arch=arch())
    150 #                ok_dialog(localize(30004), localize(30039))  # Widevine not available on ARM64
    151 #                return False
    152
    153         if system_os() not in config.WIDEVINE_SUPPORTED_OS:
    154             log(4, 'Unsupported Widevine OS found: {os}', os=system_os())
    155             ok_dialog(localize(30004), localize(30011, os=system_os()))  # Operating system not supported by Widevine
    156             return False
    157
    158         if parse_version(config.WIDEVINE_MINIMUM_KODI_VERSION[system_os()]) > parse_version(kodi_version()):
    159             log(4, 'Unsupported Kodi version for Widevine: {version}', version=kodi_version())
    160             ok_dialog(localize(30004), localize(30010, version=config.WIDEVINE_MINIMUM_KODI_VERSION[system_os()]))  # Kodi too old
    161             return False
    162
    163         if 'WindowsApps' in translate_path('special://xbmcbin/'):  # uwp is not supported
    164             log(4, 'Unsupported UWP Kodi version detected.')
    165             ok_dialog(localize(30004), localize(30012))  # Windows Store Kodi falls short
    166             return False
    167
    168         return True

But when I try to play something on HBO Max I see an error on the screen to check the logs and these are the logs that I get:

2023-04-07 01:28:44.060 T:648      INFO <general>: initializing python engine.
2023-04-07 01:28:46.292 T:648      INFO <general>: slyguy.hbo.max - Widevine Current MD5: 9b68488364ac2a7d4e7e15cb36ebb489
2023-04-07 01:28:46.302 T:648      INFO <general>: CPythonInvoker(8, /home/pi/.kodi/addons/slyguy.hbo.max/default.py): script successfully run
2023-04-07 01:28:46.340 T:563      INFO <general>: VideoPlayer::OpenFile: plugin://slyguy.hbo.max/?_=play&_play=1&[URL]&_noresume=.pvr
2023-04-07 01:28:46.341 T:1100     INFO <general>: Creating InputStream
2023-04-07 01:28:46.343 T:1100     INFO <general>: AddOnLog: inputstream.adaptive: SetVideoResolution (3840 x 2160)
2023-04-07 01:28:46.488 T:648      INFO <general>: initializing python engine.
2023-04-07 01:28:46.585 T:648      INFO <general>: CPythonInvoker(8, /home/pi/.kodi/addons/slyguy.hbo.max/default.py): script successfully run
2023-04-07 01:28:48.237 T:1100     INFO <general>: AddOnLog: inputstream.adaptive: Successfully parsed manifest file. #Periods: 1, #Streams in first period: 5, Type: VOD, Download speed: 10284746.2166 Bytes/s
2023-04-07 01:28:48.241 T:1100    ERROR <general>: AddOnLog: inputstream.adaptive: Unable to load widevine shared library (/home/pi/.kodi/cdm/libwidevinecdm.so)
2023-04-07 01:28:48.241 T:1100    ERROR <general>: AddOnLog: inputstream.adaptive: OpenDRMSystem failed
2023-04-07 01:28:48.242 T:1100    ERROR <general>: CVideoPlayer::OpenInputStream - error opening [plugin://slyguy.hbo.max/?_=play&_play=1[URL]&_noresume=.pvr]
2023-04-07 01:28:48.242 T:1100     INFO <general>: CVideoPlayer::OnExit()
2023-04-07 01:28:48.243 T:1100     INFO <general>: ADDON: Dll Destroyed - InputStream Adaptive
2023-04-07 01:28:48.294 T:563      INFO <general>: CVideoPlayer::CloseFile()
2023-04-07 01:28:48.305 T:563      INFO <general>: VideoPlayer: waiting for threads to exit
2023-04-07 01:28:48.305 T:563      INFO <general>: VideoPlayer: finished waiting

Any idea on how to fix it?

@matthuisman
Copy link
Author

matthuisman commented Apr 7, 2023

if using slyguy addon, they already support aarch64 so will download the correct arm64 for you
my addons dont use or require inputstream helper.

simply go into hbo addon > settings > advances > install widevine CDM

However, your issue is "Raspberry Pi OS 64-bit"
Pretty sure they may need some patches to make it work.
Best to ask on the Raspberry Pi OS forums

@horstle
Copy link
Collaborator

horstle commented Apr 7, 2023

@slavid You could also try the test version of inputstreamhelper here, but I also assume you need a newer version of inputstream.adaptive than provided for your system.

@slavid
Copy link

slavid commented Apr 7, 2023

I've tried with the test version of inputstreamhelper with no luck, same result. I guess I'll have to wait for a newer version of inputstream.adaptive or support for Kodi 20 which apparently both are being worked on according to Raspberry Pi OS forums:

https://forums.raspberrypi.com/viewtopic.php?t=323303&hilit=inputstream&start=425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants