linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script
@ 2010-06-16  7:52 Wu Zhangjin
  2010-06-16  7:52 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c Wu Zhangjin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wu Zhangjin @ 2010-06-16  7:52 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, Wu Zhangjin

From: Wu Zhangjin <wuzhangjin@gmail.com>

- Remove un-needed symbols: _fdata, _text, only _edata and _end are
needed by head.S
- Remove un-needed sections: .sbss, .stab, .gptab.sdata, .gptab.sbss
- Change the alignment to 16bytes: ensure it is greater than any
standard data types by a MIPS compiler
- Clear the comments

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/boot/compressed/ld.script |   51 +++++++++++-----------------------
 1 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index c4b6491..8e6b07c 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -2,61 +2,44 @@
  * ld.script for compressed kernel support of MIPS
  *
  * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin <wuzhangjin@gmail.com>
+ * Author: Wu Zhangjin <wuzhanjing@gmail.com>
+ * Copyright (C) 2010 "Wu Zhangjin" <wuzhanjing@gmail.com>
  */
 
 OUTPUT_ARCH(mips)
 ENTRY(start)
 SECTIONS
 {
-	/* . = VMLINUZ_LOAD_ADDRESS */
-	/* read-only */
-	_text = .;	/* Text and read-only data */
-	.text	: {
-		_ftext = . ;
+	/* Text and read-only data */
+	/* . = VMLINUZ_LOAD_ADDRESS; */
+	.text : {
 		*(.text)
 		*(.rodata)
-	} = 0
-	_etext = .;	/* End of text section */
+	}
+	/* End of text section */
 
-	/* writable */
-	.data	: {	/* Data */
-		_fdata = . ;
+	/* Writable data */
+	.data : {
 		*(.data)
-		/* Put the compressed image here, so bss is on the end. */
+		/* Put the compressed image here */
 		__image_begin = .;
 		*(.image)
 		__image_end = .;
 		CONSTRUCTORS
 	}
-	.sdata	: { *(.sdata) }
-	. = ALIGN(4);
-	_edata  =  .;	/* End of data section */
+	. = ALIGN(16);
+	_edata = .;
+	/* End of data section */
 
 	/* BSS */
-	__bss_start = .;
-	_fbss = .;
-	.sbss	: { *(.sbss) *(.scommon) }
-	.bss	: {
-		*(.dynbss)
+	.bss : {
 		*(.bss)
-		*(COMMON)
 	}
-	.  = ALIGN(4);
-	_end = . ;
-
-	/* These are needed for ELF backends which have not yet been converted
-	 * to the new style linker.  */
-
-	.stab 0 : { *(.stab) }
-	.stabstr 0 : { *(.stabstr) }
-
-	/* These must appear regardless of  .  */
-	.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
-	.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
+	. = ALIGN(16);
+	_end = .;
 
 	/* Sections to be discarded */
-	/DISCARD/	: {
+	/DISCARD/ : {
 		*(.MIPS.options)
 		*(.options)
 		*(.pdr)
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c
  2010-06-16  7:52 [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Wu Zhangjin
@ 2010-06-16  7:52 ` Wu Zhangjin
  2010-08-05  1:20   ` Ralf Baechle
  2010-06-16  7:52 ` [PATCH] MIPS: strip the un-needed sections of vmlinuz Wu Zhangjin
  2010-08-05  1:13 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Ralf Baechle
  2 siblings, 1 reply; 8+ messages in thread
From: Wu Zhangjin @ 2010-06-16  7:52 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, Wu Zhangjin

From: Wu Zhangjin <wuzhangjin@gmail.com>

- Remove several lines of out-of-date comments
- Clear the definition of zimage_start and zimage_size and the related
usage

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/boot/compressed/decompress.c |   38 +++++++++++--------------------
 1 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 5db43c5..5cad0fa 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -1,9 +1,6 @@
 /*
- * Misc. bootloader code for many machines.
- *
  * Copyright 2001 MontaVista Software Inc.
- * Author: Matt Porter <mporter@mvista.com> Derived from
- * arch/ppc/boot/prep/misc.c
+ * Author: Matt Porter <mporter@mvista.com>
  *
  * Copyright (C) 2009 Lemote, Inc.
  * Author: Wu Zhangjin <wuzhangjin@gmail.com>
@@ -19,12 +16,12 @@
 
 #include <asm/addrspace.h>
 
-/* These two variables specify the free mem region
+/*
+ * These two variables specify the free mem region
  * that can be used for temporary malloc area
  */
 unsigned long free_mem_ptr;
 unsigned long free_mem_end_ptr;
-char *zimage_start;
 
 /* The linker tells us where the image is. */
 extern unsigned char __image_begin, __image_end;
@@ -83,38 +80,31 @@ void *memset(void *s, int c, size_t n)
 
 void decompress_kernel(unsigned long boot_heap_start)
 {
-	int zimage_size;
-
-	/*
-	 * We link ourself to an arbitrary low address.  When we run, we
-	 * relocate outself to that address.  __image_beign points to
-	 * the part of the image where the zImage is. -- Tom
-	 */
-	zimage_start = (char *)(unsigned long)(&__image_begin);
+	unsigned long zimage_start, zimage_size;
+
+	zimage_start = (unsigned long)(&__image_begin);
 	zimage_size = (unsigned long)(&__image_end) -
 	    (unsigned long)(&__image_begin);
 
-	/*
-	 * The zImage and initrd will be between start and _end, so they've
-	 * already been moved once.  We're good to go now. -- Tom
-	 */
 	puts("zimage at:     ");
-	puthex((unsigned long)zimage_start);
+	puthex(zimage_start);
 	puts(" ");
-	puthex((unsigned long)(zimage_size + zimage_start));
+	puthex(zimage_size + zimage_start);
 	puts("\n");
 
-	/* this area are prepared for mallocing when decompressing */
+	/* This area are prepared for mallocing when decompressing */
 	free_mem_ptr = boot_heap_start;
 	free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE;
 
-	/* Display standard Linux/MIPS boot prompt for kernel args */
+	/* Display standard Linux/MIPS boot prompt */
 	puts("Uncompressing Linux at load address ");
 	puthex(VMLINUX_LOAD_ADDRESS_ULL);
 	puts("\n");
+
 	/* Decompress the kernel with according algorithm */
-	decompress(zimage_start, zimage_size, 0, 0,
+	decompress((char *)zimage_start, zimage_size, 0, 0,
 		   (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error);
-	/* FIXME: is there a need to flush cache here? */
+
+	/* FIXME: should we flush cache here? */
 	puts("Now, booting the kernel...\n");
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] MIPS: strip the un-needed sections of vmlinuz
  2010-06-16  7:52 [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Wu Zhangjin
  2010-06-16  7:52 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c Wu Zhangjin
@ 2010-06-16  7:52 ` Wu Zhangjin
  2010-08-05  1:34   ` Ralf Baechle
  2010-08-05  1:13 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Ralf Baechle
  2 siblings, 1 reply; 8+ messages in thread
From: Wu Zhangjin @ 2010-06-16  7:52 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, Wu Zhangjin

From: Wu Zhangjin <wuzhangjin@gmail.com>

This patch use "strip -s" to strip the .symtab and .strtab sections of
vmlinuz.

Note: This patch is based on http://patchwork.linux-mips.org/patch/1324/

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 arch/mips/boot/compressed/Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 9ef6e2f..1910702 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -65,8 +65,11 @@ vmlinuzobjs-y += $(obj)/piggy.o
 
 quiet_cmd_zld = LD      $@
       cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
+quiet_cmd_strip = STRIP   $@
+      cmd_strip = $(STRIP) -s $@
 vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
 	$(call cmd,zld)
+	$(call cmd,strip)
 
 #
 # Some DECstations need all possible sections of an ECOFF executable
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script
  2010-06-16  7:52 [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Wu Zhangjin
  2010-06-16  7:52 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c Wu Zhangjin
  2010-06-16  7:52 ` [PATCH] MIPS: strip the un-needed sections of vmlinuz Wu Zhangjin
@ 2010-08-05  1:13 ` Ralf Baechle
  2010-08-05  2:42   ` wu zhangjin
       [not found]   ` <AANLkTi=sOLr8Bh+VPipWaqb1rPQNeqKy7EfRVUkSfKAc@mail.gmail.com>
  2 siblings, 2 replies; 8+ messages in thread
From: Ralf Baechle @ 2010-08-05  1:13 UTC (permalink / raw)
  To: Wu Zhangjin; +Cc: linux-mips

Applied - but there was an entirely avoidable reject in that file *grrr* :-)

Thanks,

  Ralf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c
  2010-06-16  7:52 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c Wu Zhangjin
@ 2010-08-05  1:20   ` Ralf Baechle
  0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2010-08-05  1:20 UTC (permalink / raw)
  To: Wu Zhangjin; +Cc: linux-mips

Applied.  Thanks,

  Ralf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] MIPS: strip the un-needed sections of vmlinuz
  2010-06-16  7:52 ` [PATCH] MIPS: strip the un-needed sections of vmlinuz Wu Zhangjin
@ 2010-08-05  1:34   ` Ralf Baechle
  0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2010-08-05  1:34 UTC (permalink / raw)
  To: Wu Zhangjin; +Cc: linux-mips

Thanks, applied.

  Ralf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script
  2010-08-05  1:13 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Ralf Baechle
@ 2010-08-05  2:42   ` wu zhangjin
       [not found]   ` <AANLkTi=sOLr8Bh+VPipWaqb1rPQNeqKy7EfRVUkSfKAc@mail.gmail.com>
  1 sibling, 0 replies; 8+ messages in thread
From: wu zhangjin @ 2010-08-05  2:42 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

Hi, Ralf

On Thu, Aug 5, 2010 at 9:13 AM, Ralf Baechle <ralf@linux-mips.org> wrote:
> Applied - but there was an entirely avoidable reject in that file *grrr* :-)
>

Thanks, Just took a look at your upstream-linus.git git repo and found
you have applied them in a wrong order and have forgotten applying the
first one of them ;)

1. [v2] MIPS: Unify the suffix of compressed vmlinux.bin
http://patchwork.linux-mips.org/patch/1323/

This one should be applied as the first one, but seems this is still
in the patchwork ;)

2. [v4] MIPS: Clean up the calculation of VMLINUZ_LOAD_ADDRESS
http://patchwork.linux-mips.org/patch/1324/

3. MIPS: Clean up arch/mips/boot/compressed/ld.script
http://patchwork.linux-mips.org/patch/1381/

4. MIPS: Clean up arch/mips/boot/compressed/decompress.c
http://patchwork.linux-mips.org/patch/1382/

5. MIPS: strip the un-needed sections of vmlinuz
http://patchwork.linux-mips.org/patch/1383/

Sould I resend all of them in one patchset? But I can only do it tonight.

Thanks & Regards,
Wu Zhangjin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script
       [not found]   ` <AANLkTi=sOLr8Bh+VPipWaqb1rPQNeqKy7EfRVUkSfKAc@mail.gmail.com>
@ 2010-08-05  2:53     ` Ralf Baechle
  0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2010-08-05  2:53 UTC (permalink / raw)
  To: wu zhangjin; +Cc: linux-mips

On Thu, Aug 05, 2010 at 10:08:47AM +0800, wu zhangjin wrote:

> This one should be applied as the first one, but seems this is still in the
> patchwork ;)
> 
> 2. [v4] MIPS: Clean up the calculation of VMLINUZ_LOAD_ADDRESS
> http://patchwork.linux-mips.org/patch/1324/
> 
> 3. MIPS: Clean up arch/mips/boot/compressed/ld.script
> http://patchwork.linux-mips.org/patch/1381/
> 
> 4. MIPS: Clean up arch/mips/boot/compressed/decompress.c
> http://patchwork.linux-mips.org/patch/1382/
> 
> 5. MIPS: strip the un-needed sections of vmlinuz
> http://patchwork.linux-mips.org/patch/1383/
> 
> Sould I resend all of them in one patchset? But I can only do it tonight.

No need but thanks for the offer.

  Ralf

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-05  2:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-16  7:52 [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Wu Zhangjin
2010-06-16  7:52 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c Wu Zhangjin
2010-08-05  1:20   ` Ralf Baechle
2010-06-16  7:52 ` [PATCH] MIPS: strip the un-needed sections of vmlinuz Wu Zhangjin
2010-08-05  1:34   ` Ralf Baechle
2010-08-05  1:13 ` [PATCH] MIPS: Clean up arch/mips/boot/compressed/ld.script Ralf Baechle
2010-08-05  2:42   ` wu zhangjin
     [not found]   ` <AANLkTi=sOLr8Bh+VPipWaqb1rPQNeqKy7EfRVUkSfKAc@mail.gmail.com>
2010-08-05  2:53     ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).