Skip to contentSkip to conversation

MIPS: Reduce kernel image size for !CONFIG_DEBUG_ZBOOT

PATCH In review Wu Zhangjin 1 participant 2 messages Dec 25, 2010 – Dec 29, 2010 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Reduce kernel image size for !CONFIG_DEBUG_ZBOOT

!CONFIG_DEBUG_ZBOOT doesn't need puts() and puthex(), remove them and the according strings for !CONFIG_DEBUG_ZBOOT, as a result, it saves about 1280 bytes.

---
 arch/mips/boot/compressed/Makefile     |    3 ++-
 arch/mips/boot/compressed/decompress.c |    5 +++++
 2 files changed, 7 insertions(+), 1 deletions(-)
arch/mips/boot/compressed/Makefile +2 -1
index 5042d51..aab6d7f 100644
@@ -28,9 +28,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
 targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
 
 # decompressor objects (linked with vmlinuz)
-vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
+vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o
 
 ifdef CONFIG_DEBUG_ZBOOT
+vmlinuzobjs-y += $(obj)/dbg.o
 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
 vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
 endif
arch/mips/boot/compressed/decompress.c +5 -0
index 5cad0fa..c9cbff5 100644
@@ -27,8 +27,13 @@ unsigned long free_mem_end_ptr;
 extern unsigned char __image_begin, __image_end;
 
 /* debug interfaces  */
+#ifdef CONFIG_DEBUG_ZBOOT
 extern void puts(const char *s);
 extern void puthex(unsigned long long val);
+#else
+#define puts(s) do {} while (0)
+#define puthex(val) do {} while (0)
+#endif
 
 void error(char *x)
 {
Signature · 1 line
1.7.1
#1 lore raw
Quoted 2 lines · Wu Zhangjin

!CONFIG_DEBUG_ZBOOT doesn't need puts() and puthex(), remove them and the according strings for !CONFIG_DEBUG_ZBOOT, as a result, it saves

         ^^^^^ --> corresponding
Quoted 46 lines

about 1280 bytes.

---
 arch/mips/boot/compressed/Makefile     |    3 ++- arch/mips/boot/compressed/decompress.c |    5 +++++

 2 files changed, 7 insertions(+), 1 deletions(-)
arch/mips/boot/compressed/Makefile +0 -0
index 5042d51..aab6d7f 100644
@@ -28,9 +28,10 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \

 targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o

 # decompressor objects (linked with vmlinuz)
arch/mips/boot/compressed/Makefile +1 -1
-vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
+vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o

 ifdef CONFIG_DEBUG_ZBOOT
+vmlinuzobjs-y += $(obj)/dbg.o vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)                += $(obj)/uart-alchemy.o endif

arch/mips/boot/compressed/decompress.c +5 -1
index 5cad0fa..c9cbff5 100644
@@ -27,8 +27,13 @@ unsigned long free_mem_end_ptr;
  extern unsigned char __image_begin, __image_end;
 
  /* debug interfaces  */
+#ifdef CONFIG_DEBUG_ZBOOT
  extern void puts(const char *s);
  extern void puthex(unsigned long long val);
+#else
+#define puts(s) do {} while (0)
+#define puthex(val) do {} while (0)
+#endif
 
  void error(char *x)
  {
--

1.7.1