apps/examples/elf: Use strip command to make ELF binaries MUCH smaller.
This commit is contained in:
parent
e413211e6e
commit
9dcf0c5ecb
@ -66,7 +66,8 @@ DIRLIST_HDR = $(TESTS_DIR)/dirlist.h
|
||||
SYMTAB_SRC = $(TESTS_DIR)/symtab.c
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_ELF_ROMFS),y)
|
||||
FSIMG_DIR = $(TESTS_DIR)/romfs
|
||||
FSIMG_SUBDIR = romfs
|
||||
FSIMG_DIR = $(TESTS_DIR)/$(FSIMG_SUBDIR)
|
||||
ROMFS_IMG = $(TESTS_DIR)/romfs.img
|
||||
FSIMG_HDR = $(TESTS_DIR)/romfs.h
|
||||
else
|
||||
@ -74,7 +75,8 @@ else
|
||||
GENCROMFSSRC = gencromfs.c
|
||||
GENCROMFSEXE = gencromfs$(EXEEXT)
|
||||
|
||||
FSIMG_DIR = $(TESTS_DIR)/cromfs
|
||||
FSIMG_SUBDIR = cromfs
|
||||
FSIMG_DIR = $(TESTS_DIR)/$(FSIMG_SUBDIR)
|
||||
FSIMG_HDR = $(TESTS_DIR)/cromfs.h
|
||||
endif
|
||||
|
||||
@ -98,6 +100,11 @@ build: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_build)
|
||||
# Install each program in the file system image directory
|
||||
|
||||
install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install)
|
||||
ifneq ($(STRIP),)
|
||||
ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
$(Q) $(STRIP) $(wildcard $(FSIMG_SUBDIR)/*)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Create the file system image directory
|
||||
|
||||
@ -122,13 +129,13 @@ $(FSIMG_HDR) : $(ROMFS_IMG)
|
||||
else
|
||||
# Make sure that the NuttX gencromfs tool has been built
|
||||
|
||||
$(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE): $(NXTOOLDIR)$(DELIM)$(GENCROMFSSRC)
|
||||
$(NXTOOLDIR)/$(GENCROMFSEXE): $(NXTOOLDIR)/$(GENCROMFSSRC)
|
||||
$(Q) $(MAKE) -C $(NXTOOLDIR) -f Makefile.host $(GENCROMFSEXE)
|
||||
|
||||
# Create the cromfs.h header file from the populated cromfs directory
|
||||
|
||||
$(FSIMG_HDR) : populate $(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE)
|
||||
$(Q) $(NXTOOLDIR)$(DELIM)$(GENCROMFSEXE) $(FSIMG_DIR) $(FSIMG_HDR)
|
||||
$(FSIMG_HDR) : populate $(NXTOOLDIR)/$(GENCROMFSEXE)
|
||||
$(Q) $(NXTOOLDIR)/$(GENCROMFSEXE) $(FSIMG_DIR) $(FSIMG_HDR)
|
||||
|
||||
endif
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage="Usage: %0 <romfs-dir-path>"
|
||||
usage="Usage: %0 <fsimg-dir-path>"
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <romfs-dir-path>"
|
||||
echo "ERROR: Missing <fsimg-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
|
@ -63,6 +63,7 @@ redirect/redirect:
|
||||
$(Q) $(MAKE) -C redirect redirect TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)"
|
||||
|
||||
# Create the romfs.img file from the romfs directory
|
||||
# REVISIT: ELF binaries should be stripped so that they are not so big
|
||||
|
||||
$(ROMFS_IMG): hello/hello redirect/redirect testdata.txt $(ROMFS_DIR)
|
||||
$(Q) $(MAKE) -C hello install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)"
|
||||
|
Loading…
Reference in New Issue
Block a user