make: allow building flat binary plugins on USE_ELF targets
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 91ec6f1e1efe41577c2414cfcf62ec86d4a90e95 Author: Aidan MacDonald <[email protected]> Date: Wed Feb 4 10:49:09 2026 +0000 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 diff --git a/apps/plugins/chessbox/chessbox.make b/apps/plugins/chessbox/chessbox.make index 87f0a6ecc0..77a038febc 100644 --- a/apps/plugins/chessbox/chessbox.make +++ b/apps/plugins/chessbox/chessbox.make @@ -39,7 +39,7 @@ $(CHESSBOX_OBJDIR)/chessbox.ovl: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -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 $(CHESSBOX_OBJDIR)/%.o: $(CHESSBOX_SRCDIR)/%.c $(CHESSBOX_SRCDIR)/chessbox.make diff --git a/apps/plugins/goban/goban.make b/apps/plugins/goban/goban.make index 2201dc60f4..ae221e8840 100644 --- a/apps/plugins/goban/goban.make +++ b/apps/plugins/goban/goban.make @@ -36,4 +36,4 @@ $(GOBAN_BUILDDIR)/goban.ovl: $(GOBAN_OBJ) $(GOBAN_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -lgcc $(GOBAN_OVLFLAGS) - $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@) + $(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@) diff --git a/apps/plugins/imageviewer/imageviewer.make b/apps/plugins/imageviewer/imageviewer.make index 23f9813357..25701fc6d2 100644 --- a/apps/plugins/imageviewer/imageviewer.make +++ b/apps/plugins/imageviewer/imageviewer.make @@ -40,7 +40,7 @@ $(IMGVBUILDDIR)/%.ovl: $(IMGDEC_OUTLDS) $(filter-out $(PLUGIN_CRT0),$(filter %.o, $^)) \ $(filter %.a, $+) \ -lgcc $(IMGDEC_OVLFLAGS) - $(SILENT)$(call objcopy,$(IMGVBUILDDIR)/$*.elf,$@) + $(SILENT)$(call objcopy_plugin,$(IMGVBUILDDIR)/$*.elf,$@) # rule to create reference map for image decoder $(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS) diff --git a/apps/plugins/lua/lua.make b/apps/plugins/lua/lua.make index a5d1813a8b..ec8a7e8b38 100644 --- a/apps/plugins/lua/lua.make +++ b/apps/plugins/lua/lua.make @@ -73,7 +73,7 @@ $(LUA_BUILDDIR)/lua.ovl: $(LUA_OBJ) $(TLSFLIB) $(LUA_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -lgcc $(LUA_OVLFLAGS) - $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@) + $(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@) $(LUA_BUILDDIR): $(call PRINTS,MKDIR $@)mkdir -p $(LUA_BUILDDIR)/ diff --git a/apps/plugins/pictureflow/pictureflow.make b/apps/plugins/pictureflow/pictureflow.make index e13ba61a72..7436af2433 100644 --- a/apps/plugins/pictureflow/pictureflow.make +++ b/apps/plugins/pictureflow/pictureflow.make @@ -37,7 +37,7 @@ $(PICTUREFLOW_OBJDIR)/pictureflow.ovl: $(PICTUREFLOW_OBJ) $(PICTUREFLOW_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -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 $(PICTUREFLOW_OBJDIR)/%.o: $(PICTUREFLOW_SRCDIR)/%.c $(PICTUREFLOW_SRCDIR)/pictureflow.make diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make index 2babb329a5..8620d3f9c0 100644 --- a/apps/plugins/plugins.make +++ b/apps/plugins/plugins.make @@ -169,7 +169,7 @@ $(BUILDDIR)/%.rock: $(filter %.o, $^) \ $(filter %.a, $+) \ -lgcc $(PLUGINLDFLAGS) - $(SILENT)$(call objcopy,$(BUILDDIR)/$*.elf,$@) + $(SILENT)$(call objcopy_plugin,$(BUILDDIR)/$*.elf,$@) $(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua $(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/ diff --git a/apps/plugins/puzzles/puzzles.make b/apps/plugins/puzzles/puzzles.make index 91e84c50da..4c3322d32e 100644 --- a/apps/plugins/puzzles/puzzles.make +++ b/apps/plugins/puzzles/puzzles.make @@ -49,14 +49,14 @@ $(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/src/%.o $(PUZZLES_OBJDIR)/help/% $(filter %.o, $^) \ $(filter %.a, $+) \ -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) $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(PUZZLES_OBJDIR)/$*.elf \ $(filter %.o, $^) \ $(filter %.a, $+) \ -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 \ $(APPSDIR)/plugins/lib/pluginlib_exit.h \ diff --git a/apps/plugins/rockboy/rockboy.make b/apps/plugins/rockboy/rockboy.make index 8be44ef9c5..8725604933 100644 --- a/apps/plugins/rockboy/rockboy.make +++ b/apps/plugins/rockboy/rockboy.make @@ -37,7 +37,7 @@ $(ROCKBOY_OBJDIR)/rockboy.ovl: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -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 ifeq ($(APP_TYPE),ctru-app) diff --git a/apps/plugins/sdl/sdl.make b/apps/plugins/sdl/sdl.make index 9d666bd732..7234656268 100644 --- a/apps/plugins/sdl/sdl.make +++ b/apps/plugins/sdl/sdl.make @@ -95,7 +95,7 @@ $(SDL_OBJDIR)/wolf3d.ovl: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB) $(WOLF3D_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -lgcc -T$(WOLF3D_OUTLDS) $(SDL_OVLFLAGS) - $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@) + $(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@) # Quake ### @@ -113,7 +113,7 @@ $(SDL_OBJDIR)/quake.ovl: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB) $(QUAKE_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -lgcc -T$(QUAKE_OUTLDS) $(SDL_OVLFLAGS) - $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@) + $(call PRINTS,LD $(@F))$(call objcopy_plugin,$(basename $@).elf,$@) ### diff --git a/apps/plugins/zxbox/zxbox.make b/apps/plugins/zxbox/zxbox.make index 4638d5f0a2..1ee64d6fb5 100644 --- a/apps/plugins/zxbox/zxbox.make +++ b/apps/plugins/zxbox/zxbox.make @@ -45,7 +45,7 @@ $(ZXBOX_OBJDIR)/zxbox.ovl: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS) $(filter %.o, $^) \ $(filter %.a, $+) \ -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 $(ZXBOX_OBJDIR)/%.o: $(ZXBOX_SRCDIR)/%.c $(ZXBOX_SRCDIR)/zxbox.make diff --git a/lib/rbcodec/codecs/codecs.make b/lib/rbcodec/codecs/codecs.make index 6d790f5d9a..6f20a8c101 100644 --- a/lib/rbcodec/codecs/codecs.make +++ b/lib/rbcodec/codecs/codecs.make @@ -245,4 +245,4 @@ $(CODECDIR)/%.codec: $(CODECDIR)/%.o $(filter %.o, $^) \ $(filter %.a, $+) \ -lgcc $(CODECLDFLAGS) - $(SILENT)$(call objcopy,$(CODECDIR)/$*.elf,$@) + $(SILENT)$(call objcopy_plugin,$(CODECDIR)/$*.elf,$@) diff --git a/tools/configure b/tools/configure index 1e44235cb3..b166cf5a07 100755 --- a/tools/configure +++ b/tools/configure @@ -1755,6 +1755,7 @@ fi x1000tools="$genericbitmaptools scramble mkspl-x1000 uclpack" # default to not generating ELF files USE_ELF="no" + PLUGIN_USE_ELF="no" # ---- For each target ---- # @@ -5006,6 +5007,7 @@ export TTS_ENGINE=${TTS_ENGINE} export ENC_OPTS=${ENC_OPTS} export ENCODER=${ENCODER} export USE_ELF=${USE_ELF} +export PLUGIN_USE_ELF=${PLUGIN_USE_ELF} export RBDIR=${rbdir} export ROCKBOX_SHARE_PATH=${sharedir} export ROCKBOX_BINARY_PATH=${bindir} diff --git a/tools/functions.make b/tools/functions.make index 1c16e1415f..772db0eeda 100644 --- a/tools/functions.make +++ b/tools/functions.make @@ -38,15 +38,20 @@ a2lnk = $(patsubst lib%.a,-l%,$(notdir $(1))) # handles the $(1) == $(2) case too ifndef APP_TYPE 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))) objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy simulator +objcopy_plugin = objcopy else ifneq (,$(findstring ctru,$(MODELNAME))) # 3dsxtool requires symbols objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) +objcopy_plugin = objcopy else ifdef DEBUG objcopy = cp $(1) $(1).tmp;mv -f $(1).tmp $(2) # objcopy hosted (DEBUG) + objcopy_plugin = objcopy else objcopy = $(OC) -S -x $(1) $(2) # objcopy hosted (!DEBUG) + objcopy_plugin = objcopy endif endif -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs