Skip to content

Instantly share code, notes, and snippets.

@satori99
Created July 1, 2019 09:09
Show Gist options
  • Save satori99/2bdb3902e64370ca057741c0746b93a8 to your computer and use it in GitHub Desktop.
Save satori99/2bdb3902e64370ca057741c0746b93a8 to your computer and use it in GitHub Desktop.
Patch Raspberry Pi boodcode to enable HW MPG2 enc/dec
#!/bin/bash
# https://www.reddit.com/r/raspberry_pi/comments/5x7xbo/patch_for_mpeg2_vc1_license/
function do_patch() {
if [ -f "/boot/${1}" ]; then
cp "/boot/${1}" "/boot/${1}_backup"
perl -pne 's/\x47\xE9362H\x'${2}'\x18/\x47\xE9362H\x'${2}'\x1F/g' < "/boot/${1}_backup" > "/boot/${1}"
echo "Patched /boot/${1}..."
fi
}
do_patch start.elf 3C
do_patch start_x.elf 1D
vcgencmd codec_enabled MPG2
vcgencmd codec_enabled WVC1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment