Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save opensiriusfox/3190693 to your computer and use it in GitHub Desktop.
Save opensiriusfox/3190693 to your computer and use it in GitHub Desktop.
OMXPlayer Patch to enable Native Raspberry Pi Builds (Jul 27 2012) [FOR 105837c7971bd82a031efe3da2b58873ff0a1ed7]
diff -ru Makefile Makefile
--- Makefile 2012-07-27 13:41:32.149454618 -0700
+++ Makefile 2012-07-27 13:42:17.221419499 -0700
@@ -1,6 +1,6 @@
include Makefile.include
-CFLAGS+=-DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST -Wno-psabi -I$(SDKSTAGE)/opt/vc/include/
+CFLAGS+=-DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST -Wno-psabi -I/opt/vc/include/
LDFLAGS+=-L./ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -Lffmpeg_compiled/usr/local/lib/
INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/
@@ -57,9 +57,9 @@
dist: omxplayer.bin
mkdir -p omxplayer-dist/usr/lib/omxplayer
- mkdir -p omxplayer-dist/usr/usr/bin
+ mkdir -p omxplayer-dist/usr/bin
mkdir -p omxplayer-dist/usr/share/doc
- cp omxplayer omxplayer.bin omxplayer-dist/usr/usr/bin
+ cp omxplayer omxplayer.bin omxplayer-dist/usr/bin
cp COPYING omxplayer-dist/usr/share/doc/
cp README.md omxplayer-dist/usr/share/doc/README
cp -a ffmpeg_compiled/usr/local/lib/*.so* omxplayer-dist/usr/lib/omxplayer/
diff -ru Makefile.ffmpeg Makefile.ffmpeg
--- Makefile.ffmpeg 2012-07-27 13:41:32.179455926 -0700
+++ Makefile.ffmpeg 2012-07-27 13:42:49.122705483 -0700
@@ -8,11 +8,11 @@
copy:
find ffmpeg -name '*.so*' -exec cp {} . \;
- $(HOST)-strip *.so*
+ strip *.so*
compile:
cd ffmpeg; \
- make -j9
+ make
configure:
cd ffmpeg; \
@@ -20,7 +20,6 @@
LDFLAGS="" \
./configure \
--extra-cflags="-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog" \
- --enable-cross-compile \
--enable-shared \
--disable-static \
--arch=arm \
@@ -52,9 +51,7 @@
--enable-armv6 \
--enable-armvfp \
--enable-hardcoded-tables \
- --disable-runtime-cpudetect \
- --disable-debug \
- --cross-prefix=$(HOST)-
+ --disable-debug
clean:
@rm -rf ffmpeg
@@ -64,6 +61,6 @@
cd ffmpeg; git checkout master; git checkout 13a7bd70c8d94c5a46c14e7ac23a170b77eff52e
install:
- cd ffmpeg; make -j9 DESTDIR="$(WORK)/ffmpeg_compiled" install
- $(HOST)-strip ffmpeg_compiled/usr/local/lib/*.so
+ cd ffmpeg; make DESTDIR="$(WORK)/ffmpeg_compiled" install
+ strip ffmpeg_compiled/usr/local/lib/*.so
diff -ru Makefile.include Makefile.include
--- Makefile.include 2012-07-27 13:41:32.169455490 -0700
+++ Makefile.include 2012-07-27 13:43:34.314207867 -0700
@@ -1,38 +1,9 @@
-USE_BUILDROOT=1
FLOAT=hard
-ifeq ($(USE_BUILDROOT), 1)
-BUILDROOT :=/opt/xbmc-bcm/buildroot
-SDKSTAGE :=$(BUILDROOT)/output/staging
-TARGETFS :=$(BUILDROOT)/output/target
-TOOLCHAIN :=$(BUILDROOT)/output/host/usr/
-HOST :=arm-unknown-linux-gnueabi
-SYSROOT :=$(BUILDROOT)/output/host/usr/arm-unknown-linux-gnueabi/sysroot
-else
-BUILDROOT :=/opt/bcm-rootfs
-SDKSTAGE :=/opt/bcm-rootfs
-TARGETFS :=/opt/bcm-rootfs
-TOOLCHAIN :=/usr/local/bcm-gcc
-HOST :=bcm2708
-SYSROOT :=$(TOOLCHAIN)/arm-bcm2708-linux-gnueabi/sys-root
-endif
-
-JOBS=7
-
-CFLAGS := -isystem$(PREFIX)/include
CXXFLAGS := $(CFLAGS)
CPPFLAGS := $(CFLAGS)
-LDFLAGS := -L$(BUILDROOT)/lib
-LD := $(TOOLCHAIN)/bin/$(HOST)-ld --sysroot=$(SYSROOT)
-CC := $(TOOLCHAIN)/bin/$(HOST)-gcc --sysroot=$(SYSROOT)
-CXX := $(TOOLCHAIN)/bin/$(HOST)-g++ --sysroot=$(SYSROOT)
-OBJDUMP := $(TOOLCHAIN)/bin/$(HOST)-objdump
-RANLIB := $(TOOLCHAIN)/bin/$(HOST)-ranlib
-STRIP := $(TOOLCHAIN)/bin/$(HOST)-strip
-AR := $(TOOLCHAIN)/bin/$(HOST)-ar
CXXCP := $(CXX) -E
-PATH := $(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)
CFLAGS += -pipe -mfloat-abi=$(FLOAT) -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
-LDFLAGS += -L$(SDKSTAGE)/lib -L$(SDKSTAGE)/usr/lib -L$(SDKSTAGE)/opt/vc/lib/
-INCLUDES += -isystem$(SDKSTAGE)/staging/usr/include -isystem$(SDKSTAGE)/staging/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
+LDFLAGS += -L/lib -L/usr/lib -L/opt/vc/lib/
+INCLUDES += -isystem/usr/include -isystem/opt/vc/include -isystem/usr/include -isystem/opt/vc/include/interface/vcos/pthreads
@ph0ng
Copy link

ph0ng commented Jul 28, 2012

Nice :) I was thinking about posting something similar. One question though, can you build ffmpeg with the 224 Mb ram split or is this with the new arm240_start.elf image? Even when I remove the -j9 flag I run out of memory (on one of the h264 files I believe). Or maybe you mount a swap for this?

@opensiriusfox
Copy link
Author

I had the exact same question so I data log of memory while I did my last build.
http://www.dabblee.com/2012/07/omxplayer-build-memory-usage/

You need the swap file to make this happen. When the libavcodec/h264.o part of the ffmpeg build comes up my total swap+memory came just shy of 350MB.

@ph0ng
Copy link

ph0ng commented Jul 28, 2012

Good post, will give it a try someday. Right now I settle for linking against one of the Arch ffmpeg binaries that I find suitable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment