mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
make: allow building flat binary plugins on USE_ELF targets
From what I can see the Creative Zen Vision ports, which were the only ones to set USE_ELF prior to the Echo R1 port, do not work except for a bootloader and never even got to the point of booting Rockbox. This explains why they build codecs and plugins as ELF binaries, yet there is no code to load ELF format codecs or plugins. Anyhow, add a new setting, PLUGIN_USE_ELF, which controls whether plugins & codecs are left as ELF or converted to flat binaries. This makes it possible for the Echo R1 to use the flat binary .rock format, and makes it possible to have ELF plugins/codecs on targets with non-ELF main binaries. Seeing as nothing needs ELF plugins/codecs right now, the new default is to generate them as flat binaries unless the target requests otherwise. Change-Id: I9ffae669978de5cc7ad214cd50d97ad6e8938394
This commit is contained in:
parent
0484b46165
commit
91ec6f1e1e
13 changed files with 20 additions and 13 deletions
|
|
@ -39,7 +39,7 @@ $(CHESSBOX_OBJDIR)/chessbox.ovl: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(CHESSBOX_OVLFLAGS)
|
-lgcc $(CHESSBOX_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
# special pattern rule for compiling chessbox with extra flags
|
# special pattern rule for compiling chessbox with extra flags
|
||||||
$(CHESSBOX_OBJDIR)/%.o: $(CHESSBOX_SRCDIR)/%.c $(CHESSBOX_SRCDIR)/chessbox.make
|
$(CHESSBOX_OBJDIR)/%.o: $(CHESSBOX_SRCDIR)/%.c $(CHESSBOX_SRCDIR)/chessbox.make
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,4 @@ $(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(GOBAN_OVLFLAGS)
|
-lgcc $(GOBAN_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ $(IMGVBUILDDIR)/%.ovl: $(IMGDEC_OUTLDS)
|
||||||
$(filter-out $(PLUGIN_CRT0),$(filter %.o, $^)) \
|
$(filter-out $(PLUGIN_CRT0),$(filter %.o, $^)) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(IMGDEC_OVLFLAGS)
|
-lgcc $(IMGDEC_OVLFLAGS)
|
||||||
$(SILENT)$(call objcopy,$(IMGVBUILDDIR)/$*.elf,$@)
|
$(SILENT)$(call objcopy_plugin,$(IMGVBUILDDIR)/$*.elf,$@)
|
||||||
|
|
||||||
# rule to create reference map for image decoder
|
# rule to create reference map for image decoder
|
||||||
$(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS)
|
$(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ $(LUA_BUILDDIR)/lua.ovl: $(LUA_OBJ) $(TLSFLIB) $(LUA_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(LUA_OVLFLAGS)
|
-lgcc $(LUA_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
$(LUA_BUILDDIR):
|
$(LUA_BUILDDIR):
|
||||||
$(call PRINTS,MKDIR $@)mkdir -p $(LUA_BUILDDIR)/
|
$(call PRINTS,MKDIR $@)mkdir -p $(LUA_BUILDDIR)/
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ $(PICTUREFLOW_OBJDIR)/pictureflow.ovl: $(PICTUREFLOW_OBJ) $(PICTUREFLOW_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(PICTUREFLOW_OVLFLAGS)
|
-lgcc $(PICTUREFLOW_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
# special pattern rule for compiling pictureflow with extra flags
|
# special pattern rule for compiling pictureflow with extra flags
|
||||||
$(PICTUREFLOW_OBJDIR)/%.o: $(PICTUREFLOW_SRCDIR)/%.c $(PICTUREFLOW_SRCDIR)/pictureflow.make
|
$(PICTUREFLOW_OBJDIR)/%.o: $(PICTUREFLOW_SRCDIR)/%.c $(PICTUREFLOW_SRCDIR)/pictureflow.make
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ $(BUILDDIR)/%.rock:
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(PLUGINLDFLAGS)
|
-lgcc $(PLUGINLDFLAGS)
|
||||||
$(SILENT)$(call objcopy,$(BUILDDIR)/$*.elf,$@)
|
$(SILENT)$(call objcopy_plugin,$(BUILDDIR)/$*.elf,$@)
|
||||||
|
|
||||||
$(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua
|
$(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua
|
||||||
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/
|
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,14 @@ $(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/%.o $(PUZZLES_OBJDIR)/help/%
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(filter-out -Wl%.map, $(PLUGINLDFLAGS)) -Wl,$(LDMAP_OPT),$(PUZZLES_OBJDIR)/src/$*.map
|
-lgcc $(filter-out -Wl%.map, $(PLUGINLDFLAGS)) -Wl,$(LDMAP_OPT),$(PUZZLES_OBJDIR)/src/$*.map
|
||||||
$(SILENT)$(call objcopy,$(PUZZLES_OBJDIR)/$*.elf,$@)
|
$(SILENT)$(call objcopy_plugin,$(PUZZLES_OBJDIR)/$*.elf,$@)
|
||||||
|
|
||||||
$(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/unfinished/%.o $(PUZZLES_OBJDIR)/help/%.o $(PUZZLES_SHARED_OBJ) $(TLSFLIB)
|
$(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/unfinished/%.o $(PUZZLES_OBJDIR)/help/%.o $(PUZZLES_SHARED_OBJ) $(TLSFLIB)
|
||||||
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(PUZZLES_OBJDIR)/$*.elf \
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(PUZZLES_OBJDIR)/$*.elf \
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(filter-out -Wl%.map, $(PLUGINLDFLAGS)) -Wl,$(LDMAP_OPT),$(PUZZLES_OBJDIR)/src/$*.map
|
-lgcc $(filter-out -Wl%.map, $(PLUGINLDFLAGS)) -Wl,$(LDMAP_OPT),$(PUZZLES_OBJDIR)/src/$*.map
|
||||||
$(SILENT)$(call objcopy,$(PUZZLES_OBJDIR)/$*.elf,$@)
|
$(SILENT)$(call objcopy_plugin,$(PUZZLES_OBJDIR)/$*.elf,$@)
|
||||||
|
|
||||||
$(PUZZLES_SRCDIR)/rbcompat.h: $(APPSDIR)/plugin.h \
|
$(PUZZLES_SRCDIR)/rbcompat.h: $(APPSDIR)/plugin.h \
|
||||||
$(APPSDIR)/plugins/lib/pluginlib_exit.h \
|
$(APPSDIR)/plugins/lib/pluginlib_exit.h \
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ $(ROCKBOY_OBJDIR)/rockboy.ovl: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(ROCKBOY_OVLFLAGS)
|
-lgcc $(ROCKBOY_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
# special rule to build with devkitarm gcc
|
# special rule to build with devkitarm gcc
|
||||||
ifeq ($(APP_TYPE),ctru-app)
|
ifeq ($(APP_TYPE),ctru-app)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ $(SDL_OBJDIR)/wolf3d.ovl: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB) $(WOLF3D_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc -T$(WOLF3D_OUTLDS) $(SDL_OVLFLAGS)
|
-lgcc -T$(WOLF3D_OUTLDS) $(SDL_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
# Quake
|
# Quake
|
||||||
###
|
###
|
||||||
|
|
@ -113,7 +113,7 @@ $(SDL_OBJDIR)/quake.ovl: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB) $(QUAKE_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc -T$(QUAKE_OUTLDS) $(SDL_OVLFLAGS)
|
-lgcc -T$(QUAKE_OUTLDS) $(SDL_OVLFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ $(ZXBOX_OBJDIR)/zxbox.ovl: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS)
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(ZXBOX_LDFLAGS)
|
-lgcc $(ZXBOX_LDFLAGS)
|
||||||
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
$(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@)
|
||||||
|
|
||||||
# special pattern rule for compiling zxbox with extra flags
|
# special pattern rule for compiling zxbox with extra flags
|
||||||
$(ZXBOX_OBJDIR)/%.o: $(ZXBOX_SRCDIR)/%.c $(ZXBOX_SRCDIR)/zxbox.make
|
$(ZXBOX_OBJDIR)/%.o: $(ZXBOX_SRCDIR)/%.c $(ZXBOX_SRCDIR)/zxbox.make
|
||||||
|
|
|
||||||
|
|
@ -245,4 +245,4 @@ $(CODECDIR)/%.codec: $(CODECDIR)/%.o
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
-lgcc $(CODECLDFLAGS)
|
-lgcc $(CODECLDFLAGS)
|
||||||
$(SILENT)$(call objcopy,$(CODECDIR)/$*.elf,$@)
|
$(SILENT)$(call objcopy_plugin,$(CODECDIR)/$*.elf,$@)
|
||||||
|
|
|
||||||
2
tools/configure
vendored
2
tools/configure
vendored
|
|
@ -1755,6 +1755,7 @@ fi
|
||||||
x1000tools="$genericbitmaptools scramble mkspl-x1000 uclpack"
|
x1000tools="$genericbitmaptools scramble mkspl-x1000 uclpack"
|
||||||
# default to not generating ELF files
|
# default to not generating ELF files
|
||||||
USE_ELF="no"
|
USE_ELF="no"
|
||||||
|
PLUGIN_USE_ELF="no"
|
||||||
|
|
||||||
# ---- For each target ----
|
# ---- For each target ----
|
||||||
#
|
#
|
||||||
|
|
@ -5006,6 +5007,7 @@ export TTS_ENGINE=${TTS_ENGINE}
|
||||||
export ENC_OPTS=${ENC_OPTS}
|
export ENC_OPTS=${ENC_OPTS}
|
||||||
export ENCODER=${ENCODER}
|
export ENCODER=${ENCODER}
|
||||||
export USE_ELF=${USE_ELF}
|
export USE_ELF=${USE_ELF}
|
||||||
|
export PLUGIN_USE_ELF=${PLUGIN_USE_ELF}
|
||||||
export RBDIR=${rbdir}
|
export RBDIR=${rbdir}
|
||||||
export ROCKBOX_SHARE_PATH=${sharedir}
|
export ROCKBOX_SHARE_PATH=${sharedir}
|
||||||
export ROCKBOX_BINARY_PATH=${bindir}
|
export ROCKBOX_BINARY_PATH=${bindir}
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,20 @@ a2lnk = $(patsubst lib%.a,-l%,$(notdir $(1)))
|
||||||
# handles the $(1) == $(2) case too
|
# handles the $(1) == $(2) case too
|
||||||
ifndef APP_TYPE
|
ifndef APP_TYPE
|
||||||
objcopy = $(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $(1) $(2) # objcopy native
|
objcopy = $(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $(1) $(2) # objcopy native
|
||||||
|
objcopy_plugin = $(OC) $(if $(filter yes, $(PLUGIN_USE_ELF)), -S -x, -O binary) $(1) $(2)
|
||||||
else ifneq (,$(findstring sdl-sim,$(APP_TYPE)))
|
else ifneq (,$(findstring sdl-sim,$(APP_TYPE)))
|
||||||
objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy simulator
|
objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy simulator
|
||||||
|
objcopy_plugin = objcopy
|
||||||
else ifneq (,$(findstring ctru,$(MODELNAME))) # 3dsxtool requires symbols
|
else ifneq (,$(findstring ctru,$(MODELNAME))) # 3dsxtool requires symbols
|
||||||
objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2)
|
objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2)
|
||||||
|
objcopy_plugin = objcopy
|
||||||
else
|
else
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy hosted (DEBUG)
|
objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy hosted (DEBUG)
|
||||||
|
objcopy_plugin = objcopy
|
||||||
else
|
else
|
||||||
objcopy = $(OC) -S -x $(1) $(2) # objcopy hosted (!DEBUG)
|
objcopy = $(OC) -S -x $(1) $(2) # objcopy hosted (!DEBUG)
|
||||||
|
objcopy_plugin = objcopy
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue