MIPS: Clean up arch/mips/boot/compressed/ld.script
PATCH 1/1 MIPS: Clean up arch/mips/boot/compressed/ld.script
From: Wu Zhangjin <[email protected]>
- 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
--- arch/mips/boot/compressed/ld.script | 51 +++++++++++----------------------- 1 files changed, 17 insertions(+), 34 deletions(-)
arch/mips/boot/compressed/ld.script +17 -34
@@ -2,61 +2,44 @@ * ld.script for compressed kernel support of MIPS * * Copyright (C) 2009 Lemote Inc. - * Author: Wu Zhangjin <[email protected]> + * Author: Wu Zhangjin <[email protected]> + * Copyright (C) 2010 "Wu Zhangjin" <[email protected]> */ 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)
Signature · 1 line
1.7.0.4
PATCH 1/1 MIPS: Clean up arch/mips/boot/compressed/decompress.c
From: Wu Zhangjin <[email protected]>
- Remove several lines of out-of-date comments
- Clear the definition of zimage_start and zimage_size and the related usage
--- arch/mips/boot/compressed/decompress.c | 38 +++++++++++-------------------- 1 files changed, 14 insertions(+), 24 deletions(-)
arch/mips/boot/compressed/decompress.c +14 -24
@@ -1,9 +1,6 @@/* -* Misc. bootloader code for many machines. -* * Copyright 2001 MontaVista Software Inc. -* Author: Matt Porter <[email protected]> Derived from -* arch/ppc/boot/prep/misc.c +* Author: Matt Porter <[email protected]> * * Copyright (C) 2009 Lemote, Inc. * Author: Wu Zhangjin <[email protected]>
@@ -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" ); }
Signature · 1 line
1.7.0.4
Ralf Baechle
AppliedRe: [PATCH] MIPS: Clean up arch/mips/boot/compressed/decompress.c
Applied. Thanks,
Ralf
PATCH 1/1 MIPS: strip the un-needed sections of vmlinuz
In reply to Wu ZhangjinFrom: Wu Zhangjin <[email protected]>
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/
--- arch/mips/boot/compressed/Makefile | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/mips/boot/compressed/Makefile +3 -0
@@ -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
Signature · 1 line
1.7.0.4
Ralf Baechle
AppliedRe: [PATCH] MIPS: strip the un-needed sections of vmlinuz
Thanks, applied.
Ralf
Applied - but there was an entirely avoidable reject in that file *grrr* :-)
Thanks,
Ralf
Hi, Ralf
Quoted 2 lines · Ralf Baechle
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · wu zhangjin
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/
Quoted 7 lines
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