Project

General

Profile

Bug #6177

Cross-compiling issues, mainly in Makefile.ffmpeg

Added by Kevin Ingwersen over 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
non-x86
Target version:
-
Start date:
2022-06-07
Due date:
% Done:

0%

Estimated time:
Found in version:
v4.3-2024-g420786927
Affected Versions:

Description

Hello!

I bought a LG OLED TV a few days ago and after learning about the RootMyTV stuff, I can now do whatever I want with it. Since the v4l and TV drivers are all present, I decided to try my hand at cross-compiling TVH to see where it'd lead me.

Problem is, I have been fighting with the build tool the past few days but there are so many little problems... But, they all seem to come from Makefile.ffmpeg.

Here's what I figured out so far:

1.

CC
is not respected in
.config.mk
and needs to manually be overridden when invoking Make.
2. FFMPEG's configure script isn't given any flags for cross compilation; I had to manually patch the Makefile to add that; mainly
--host=arm-webos-linux-gnueabi

3. Not TVH's buildsystem fault, but during the build,
$(HOST)-as
is invoked with
-D...
flags. That won't do, because this is used to generate debug output (
-D produce assembler debugging messages
).
4. CMake options to
x265_3.5
can also not be passed. Now, CMake itself should be smart enough to figure out that this is a cross-compile toolchain - and yet, it still attempted to compile for
-march=i686
... so I'd somehow need to adjust that, too.

This is as far as I have gotten so far.

My configure invocation:

env CFLAGS="$CFLAGS -I/opt/webos-sdk-x86_64/1.0.g/extra/include" LDFLAGS="$LDFLAGS -L/opt/webos-sdk-x86_64/1.0.g/extra/lib" ./configure --host=arm-webos-linux-gnueabi --prefix=/opt/webos-sdk-x86_64/1.0.g/extra

I set

AS=arm-webos-linux-gnueabi-gcc

and used make like so:

make COMPILER="$CC" FFMPEG_HOST="arm-webos-linux-gnueabi" FFMPEG_CONFIGURE_FLAGS="--host=arm-webos-linux-gnueabi"

And patched Makefile.ffmpeg like this:

diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
index 94f6e977a..5204239ca 100644
--- a/Makefile.ffmpeg
+++ b/Makefile.ffmpeg
@@ -174,7 +174,8 @@ AUTOGEN   := ./autogen.sh

 CONFIGURE := FFMPEG_PREFIX=$(EPREFIX) \
              PKG_CONFIG=$(ROOTDIR)/support/pkg-config.ffmpeg \
-             ./configure --prefix=/ffmpeg --enable-static --disable-shared
+             ./configure --prefix=/ffmpeg --enable-static --disable-shared \
+             $(FFMPEG_CONFIGURE_FLAGS)
 CONFIGURE_PI := CC="$(COMPILER) $(CFLAGS_PI)" $(CONFIGURE)
 CONFIGURE_FFMPEG := $(CONFIGURE)

@@ -231,7 +232,6 @@ $(LIB_ROOT)/$(LIBX264)/.tvh_build: \
                $(LIB_ROOT)/$(NASM)/.tvh_build \
                $(LIB_ROOT)/$(LIBX264)/.tvh_download
        cd $(LIB_ROOT)/$(LIBX264) && $(CONFIGURE) \
-               --extra-asflags="-DPIC" \
                --extra-cflags="$(CFLAGS_PI)" \
                --disable-cli \
                --disable-swscale \

(The removal of -DPIC was an earlier attempt to work around the assembler issues untill I realized I could just re-define $AS to be GCC).

Do you have any ideas how I can improve on this? Or how I can work around the other problems?

I honestly don't even know how far TVH will be able to go when installed to a TV; but I do see stuff in /dev/dvb so I am curious to try :)

root@LGwebOSTV:/dev/dvb# pwd
/dev/dvb
root@LGwebOSTV:/dev/dvb# ls
adapter0

Kind regards,
Ingwie

History

#1

Updated by Flole Systems over 2 years ago

You could just disable the static ffmpeg, then you should at least be able to build Tvheadend and see what happens if you try to run it on the TV.

Also available in: Atom PDF