From 5b369233293f3fe927fcfec0a9844d7f16e5e934 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 01:01:29 +0000 Subject: [PATCH] Add Stasik0's prepare-native-raspbian.sh script to help building on the Pi --- README.md | 16 ++++++----- prepare-native-raspbian.sh | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-) create mode 100755 prepare-native-raspbian.sh diff --git a/README.md b/README.md index 9e47916b..3de9afd6 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,6 @@ development headers to install on the running Pi system for the crosscompiling. Edit Makefile.include and change the settings according your locations. -### Compiling on the Pi - -You can also compile it on the PI the native way ;) - -Running OMXPlayer ------------------ - make ffmpeg make make dist @@ -39,6 +32,15 @@ Installing OMXPlayer Copy over `omxplayer-dist/*` to the Pi `/`. You may want to specify a valid font path inside the `omxplayer` shell script. +### Compiling on the Pi + +You can also compile it on the PI the native way ;) +Run this script (which will install packages and update firmware) + ./prepare-native-raspbian.sh +and build with + make ffmpeg + make + Using OMXPlayer --------------- diff --git a/prepare-native-raspbian.sh b/prepare-native-raspbian.sh new file mode 100755 index 00000000..79645c03 --- /dev/null +++ b/prepare-native-raspbian.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +echo "Patching makefiles..." +echo "FLOAT=hard + +CFLAGS += -mfloat-abi=hard -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -O3 -mstructure-size-boundary=32 -mno-sched-prolog -march=armv6zk + +BUILDROOT :=/usr/local/src/omxplayer +TOOLCHAIN :=/usr/ +LD := \$(TOOLCHAIN)/bin/ld +CC := \$(TOOLCHAIN)/bin/gcc +CXX := \$(TOOLCHAIN)/bin/g++ +OBJDUMP := \$(TOOLCHAIN)/bin/objdump +RANLIB := \$(TOOLCHAIN)/bin/ranlib +STRIP := \$(TOOLCHAIN)/bin/strip +AR := \$(TOOLCHAIN)/bin/ar +CXXCP := \$(CXX) -E + +LDFLAGS += -L/opt/vc/lib -L/lib -L/usr/lib -lfreetype +INCLUDES += -I/opt/vc/include/interface/vcos/pthreads \ + -I/opt/vc/include \ + -I/opt/vc/include/interface/vmcs_host \ + -I/usr/include \ + -I/usr/include/freetype2" > Makefile.include + +sed -i '/--enable-cross-compile \\/d;' Makefile.ffmpeg +sed -i 's/ --cross-prefix=$(HOST)-//g;' Makefile.ffmpeg +sed -i 's/ --disable-debug \\/ --disable-debug /g;' Makefile.ffmpeg + +sed -i 's/$(HOST)-//g;' Makefile.* +sed -i 's/ -j9//g;' Makefile.* +sed -i 's/#arm-unknown-linux-gnueabi-strip/arm-unknown-linux-gnueabi-strip/g;' Makefile +sed -i 's/arm-unknown-linux-gnueabi-strip/strip/g;' Makefile + +echo " +install: dist + cp omxplayer-dist/* / -r" >> Makefile + +echo "Installing packages..." +sudo apt-get update +sudo apt-get -y install ca-certificates git-core subversion binutils libva1 libpcre3-dev libidn11-dev libboost1.50-dev libfreetype6-dev libusb-1.0-0-dev +sudo apt-get -y install gcc-4.7 g++-4.7 +pushd /usr/bin && sudo rm gcc && sudo ln -s gcc-4.7 gcc && sudo rm g++ && sudo ln -s g++-4.7 g++ && popd + + +echo "Installing the rpi-update script..." +sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update +echo "Updating firmware..." +sudo rpi-update + +echo "In order to compile ffmpeg you need to set memory_split to 16 for 256MB RAM PIs (0 does not work) or to at most 256 for 512MB RAM PIs, respectively. Otherwise there is not enough RAM to compile ffmpeg. Please do the apropriate in the raspi-config and select finish to reboot your RPi. Warning: to run compiled omxplayer please start raspi-config again and set memory_split to at least 128. [Press RETURN to continue]" +read -r REPLY +sudo raspi-config +