-
-
Save teacupx/9393507ad6250429707f0318b04f1a3b to your computer and use it in GitHub Desktop.
#!/bin/sh -eu | |
# Make sure we have wget or curl | |
available () { | |
command -v "$1" >/dev/null 2>&1 | |
} | |
if available wget; then | |
DL="wget -O-" | |
DL_SL="wget -qO-" | |
elif available curl; then | |
DL="curl -L" | |
DL_SL="curl -s" | |
else | |
echo "Install Wget or cURL" >&2 | |
exit 1 | |
fi | |
# Find a URL to a suitable arm64 ChromeOS recovery image | |
CHROMEOS_URL="$($DL_SL https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf | grep -A11 C101PA | sed -n 's/^url=//p')" | |
CHROMEOS_IMG="$(basename "$CHROMEOS_URL" .zip)" | |
if [ -e "$CHROMEOS_IMG" ]; then | |
CHROMEOS_IMG_PATH="./" | |
DEL_IMG=N | |
else | |
CHROMEOS_IMG_PATH="$(mktemp -td ChromeOS-IMG.XXXXXX)" | |
DEL_IMG=Y | |
# Fetch the recovery image (2Gb+ on disk after download) | |
$DL "$CHROMEOS_URL" | zcat > "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
fi | |
# Note the next free loop device in a variable | |
LOOPD="$(losetup -f)" | |
# If root, we can mount silently (no popup windows after mount) | |
if [ "$USER" = "root" ]; then | |
MNTPNT="$(mktemp -d -t ChromeOS.XXXXXX)" | |
losetup -Pf "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
mount -o ro "${LOOPD}p3" "$MNTPNT" | |
else | |
# Associate all the partitions on the disk image with loop devices: | |
udisksctl loop-setup -rf "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
sleep 1 | |
# Mount the third partition of the disk image (if the previous did not do it automatically) | |
if ! lsblk -lo MOUNTPOINT "${LOOPD}p3" | tail -n1 | grep -q \.; then | |
udisksctl mount -b "${LOOPD}p3" | |
fi | |
# Note the mount point in a variable | |
MNTPNT="$(lsblk -lo MOUNTPOINT "${LOOPD}p3" | tail -n1)" | |
fi | |
# Extract the libs out and copy them to a compressed tar archive | |
ARCHIVE_NAME="widevine-flash-$(date '+%Y%m%d')_arm64.tgz" | |
echo "Extracting and compressing files" | |
tar -C"$MNTPNT" -caf "$ARCHIVE_NAME" opt/google/chrome/libwidevinecdm.so opt/google/chrome/pepper/libpepflashplayer.so --xform 's/pepper/PepperFlash/' --format ustar | |
echo "Created: $ARCHIVE_NAME" | |
# Cleanup | |
if [ "$USER" = "root" ]; then | |
umount "$MNTPNT" | |
losetup -d "$LOOPD" | |
rmdir "$MNTPNT" | |
else | |
ALLMNTS="$(lsblk -lo NAME,MOUNTPOINT "$LOOPD" | sed -n '/\//s/^\(loop[0-9]\+p[0-9]\+\).*/\1/p')" | |
echo "$ALLMNTS" | xargs -I{} -n1 udisksctl unmount -b /dev/{} | |
if [ "$LOOPD" != "$(losetup -f)" ]; then | |
udisksctl loop-delete -b "$LOOPD" | |
fi | |
fi | |
if [ "$DEL_IMG" = "N" ] || [ "${1:-EMPTY}" = "-k" ]; then | |
: | |
else | |
rm "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
rmdir -v "$CHROMEOS_IMG_PATH" | |
fi | |
# Inform the user how to proceed | |
cat <<EOF | |
To install the contents of these files on an ARM64 device, copy the tar archive over to the target machine and issue the following: | |
sudo tar -C/ -xf $ARCHIVE_NAME | |
EOF |
#!/bin/sh -eu | |
# Make sure we have wget or curl | |
available () { | |
command -v "$1" >/dev/null 2>&1 | |
} | |
if available wget; then | |
DL="wget -O-" | |
DL_SL="wget -qO-" | |
elif available curl; then | |
DL="curl -L" | |
DL_SL="curl -s" | |
else | |
echo "Install Wget or cURL" >&2 | |
exit 1 | |
fi | |
# Find a URL to a suitable armhf ChromeOS recovery image | |
CHROMEOS_URL="$($DL_SL https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf | grep -A11 CB5-312T | sed -n 's/^url=//p')" | |
CHROMEOS_IMG="$(basename "$CHROMEOS_URL" .zip)" | |
if [ -e "$CHROMEOS_IMG" ]; then | |
CHROMEOS_IMG_PATH="./" | |
DEL_IMG=N | |
else | |
CHROMEOS_IMG_PATH="$(mktemp -td ChromeOS-IMG.XXXXXX)" | |
DEL_IMG=Y | |
# Fetch the recovery image (2Gb+ on disk after download) | |
$DL "$CHROMEOS_URL" | zcat > "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
fi | |
# Note the next free loop device in a variable | |
LOOPD="$(losetup -f)" | |
# If root, we can mount silently (no popup windows after mount) | |
if [ "$USER" = "root" ]; then | |
MNTPNT="$(mktemp -d -t ChromeOS.XXXXXX)" | |
losetup -Pf "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
mount -o ro "${LOOPD}p3" "$MNTPNT" | |
else | |
# Associate all the partitions on the disk image with loop devices: | |
udisksctl loop-setup -rf "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
sleep 1 | |
# Mount the third partition of the disk image (if the previous did not do it automatically) | |
if ! lsblk -lo MOUNTPOINT "${LOOPD}p3" | tail -n1 | grep -q \.; then | |
udisksctl mount -b "${LOOPD}p3" | |
fi | |
# Note the mount point in a variable | |
MNTPNT="$(lsblk -lo MOUNTPOINT "${LOOPD}p3" | tail -n1)" | |
fi | |
# Extract the libs out and copy them to a compressed tar archive | |
ARCHIVE_NAME="widevine-flash-$(date '+%Y%m%d')_armhf.tgz" | |
echo "Extracting and compressing files" | |
tar -C"$MNTPNT" -caf "$ARCHIVE_NAME" opt/google/chrome/libwidevinecdm.so opt/google/chrome/pepper/libpepflashplayer.so --xform 's/pepper/PepperFlash/' --format ustar | |
echo "Created: $ARCHIVE_NAME" | |
# Cleanup | |
if [ "$USER" = "root" ]; then | |
umount "$MNTPNT" | |
losetup -d "$LOOPD" | |
rmdir "$MNTPNT" | |
else | |
ALLMNTS="$(lsblk -lo NAME,MOUNTPOINT "$LOOPD" | sed -n '/\//s/^\(loop[0-9]\+p[0-9]\+\).*/\1/p')" | |
echo "$ALLMNTS" | xargs -I{} -n1 udisksctl unmount -b /dev/{} | |
if [ "$LOOPD" != "$(losetup -f)" ]; then | |
udisksctl loop-delete -b "$LOOPD" | |
fi | |
fi | |
if [ "$DEL_IMG" = "N" ] || [ "${1:-EMPTY}" = "-k" ]; then | |
: | |
else | |
rm "$CHROMEOS_IMG_PATH/$CHROMEOS_IMG" | |
rmdir -v "$CHROMEOS_IMG_PATH" | |
fi | |
# Inform the user how to proceed | |
cat <<EOF | |
To install the contents of these files on an ARMhf device, copy the tar archive over to the target machine and issue the following: | |
sudo tar -C/ -xf $ARCHIVE_NAME | |
EOF |
@Niek lucky for use someone else has already written a tool to extract these payloads, I used https://github.com/tobyxdd/android-ota-payload-extractor
https://github.com/theofficialgman/testing/releases/download/gmans-releases/WidevineCdm.tar.gz
I can't seem to get it working though on chromium
unforuntatly it working with nothing but chromeOS right now
firstly you have this problem as described here: https://thebrokenrail.com/2022/12/31/xfinity-stream-on-linux.html#how-do-i-actually-do-this you have to patch and rebuid your system GLIBC in order to even allow the library to load (no small feat)
and then you have the problem that since arm64 widevine doesn't normally exist for linux, browsers (all of that I have found except for rpm fusion chromium-freeworld) have widevine loading disabled and don't even attempt to load it.
At this point I wonder if it'd be easier to patch the CDM itself
Or just create some sort of shim that does the same thing
Like, it might be easier to just defeat the DRM altogether.
Interesting resource on how glibc was patched in PiOS: raspberrypi/Raspberry-Pi-OS-64bit#11 (comment)
Thanks for the extracted tarball, @theofficialgman! Seems like the URL will be: https://dl.google.com/widevine-cdm/4.10.2557.0-cros-arm64.zip (404 at the time of writing).
When trying to load the library I get a symbol lookup error undefined symbol: __aarch64_ldadd4_acq_rel
on Ubuntu 22.04. On Ubuntu 22.10 I get the DT_RELR without GLIBC_ABI_DT_RELR dependency
error mentioned before. Instead of patching glibc, this could probably be resolved with a small LD_PRELOADed library. Ideally, the ChromeOS toolchain will update to a newer glibc version so this error won't happen in future builds.
I've requested assistance from RPi developers over on this github repo: raspberrypi/Raspberry-Pi-OS-64bit#248
Thanks for the extracted tarball, @theofficialgman! Seems like the URL will be: https://dl.google.com/widevine-cdm/4.10.2557.0-cros-arm64.zip (404 at the time of writing).
I have never seen any other chromeos (cros
) links there. only windows and linux (win
x64 and arm64, and linux
x64)
Thank You @teacupx @theofficialgman and all the guys involved in this thread ❤️ .
I was successfully able to run widewine needed playback on Kodi 19.4 on Arm64 with some modification to Input Stream Helper Plugin using the libwidevinecdm.so
aarch64 version.
Widewine CDM on Kodi for Arm64 is a thing now.
Thanks to all of you again <3
Good one! I checked the
trogdor
boards and picked a random one from recovery.json, theLibera-Merdeka Chromebook C100/C110/C120/C150
withhwidmatch=^PAZQUEL-HGNV .*
. I found the ID of this device in this list:9023C063-08D6-4A4F-908C-BCF97DE8BA69
. Now we can make a request to the Omaha update service to get the latest dev-channel image:So the resulting image is: http://edgedl.me.gvt1.com/edgedl/chromeos/trogdor/15329.8.0/dev-channel/chromeos_15329.8.0_trogdor_dev-channel_full_mp-v7.bin-gyzwiyjsgrstofwmrqotalztdgqyfxjj.signed
I don't have time to figure out how to extract the contents of this file, but that should be possible. The file format is described here: https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/#update-payload-file-specification