Sorry if this might sound stupid but finding documentation on this doesn't seem to be easy.
I'm searching for a way to compile my own binaries for LibreELEC / Raspberry Pi 3. These binaries should not be Kodi addons as I want to start them with the help of .config/autostart.sh (or systemd) and said binaries should handle things like fan control, LED control and so on.
So I'm simply searching a way to cross-compile for LibreELEC. Is there any good entry point for documentation?
Side question: This is my (quick&dirty) Makefile, is there anything to do better (i.e. CFLAGS, I guess -march=native won't work while cross compiling) ?
Code
#
# Makefile
#
# compiler to use
CC = gcc
AR = "gcc-ar"
NM = "gcc-nm"
RANLIB = "gcc-ranlib"
# flags to pass compiler
CFLAGS = -march=native -O2 -pipe -fno-ident -flto=8 -fuse-linker-plugin -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fgraphite-identity -std=c99 -Wall -Werror
LDFLAGS = "-Wl,-O1 -Wl,--as-needed ${CFLAGS}"
# name for executable
EXE = testbinary
# space-separated list of header files
HDRS = gpio.h strtonum.h
# space-separated list of libraries, if any,
# each of which should be prefixed with -l
LIBS =
# space-separated list of source files
SRCS = gpio.c strtonum.c main.c
# automatically generated list of object files
OBJS = $(SRCS:.c=.o)
# default target
$(EXE): $(OBJS) $(HDRS) Makefile
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
# dependencies
$(OBJS): $(HDRS) Makefile
# housekeeping
clean:
rm -f core $(EXE) $(OBJS)
Display More