On Tue, Jun 1, 2010 at 11:27 PM, Sam Ravnborg <email@example.com> wrote:
>> diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
>> index 4667a5f..f210b09 100644
>> --- a/arch/mips/boot/.gitignore
>> +++ b/arch/mips/boot/.gitignore
>> @@ -3,3 +3,4 @@ elf2ecoff
> Does this do any good in this file?
> I had assumed this covered only the same dir as the .gitignore file
> is stored. But I may be wrong.
I have tried to add this to boot/compressed/.gitignore, but there was
no .gitignore there and found the vmlinux.* in boot/.gitignore, it
worked to hide the vmlinux.* under boot/compressed/, then I put the
calc_vmlinuz_load_addr to this .gitignore too ;) it really hided the
calc_vmlinuz_load_addr, that's it.
BTW: I just don't want to add a new file for one line if it is not necessary ;)
>> diff --git a/arch/mips/boot/compressed/Makefile
>> index 7204dfc..cd9ee04 100644
>> --- a/arch/mips/boot/compressed/Makefile
>> +++ b/arch/mips/boot/compressed/Makefile
>> -LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T
>> -vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/piggy.o
>> - $(call cmd,ld)
>> +# Calculate the load address of the compressed kernel
>> +hostprogs-y := calc_vmlinuz_load_addr
>> +vmlinuzobjs-y += $(obj)/piggy.o
>> +quiet_cmd_zld = LD $@
>> + cmd_zld = $(LD) $(LDFLAGS) -Ttext $(shell
>> $(obj)/calc_vmlinuz_load_addr $(objtree)/$(KBUILD_IMAGE)
>> $(VMLINUX_LOAD_ADDRESS)) -T $< $(vmlinuzobjs-y) -o $@
> The line seriously fail the 80 char limit.
> Something like this:
> load_addr = $(shell $(obj)/calc_vmlinuz_load_addr \
> $(objtree)/$(KBUILD_IMAGE) $(VMLINUX_LOAD_ADDRESS)
> quiet_cmd_zld = LD $@
> cmd_zld = $(LD) $(LDFLAGS) -Ttext $(load-addr) -T $< $(vmlinuzobjs-y) -o
> Note: The load_addr local variable _must_ use "=" asignment
This is the _key_ stuff. I tried to use VMLINUZ_LOAD_ADDR(like your
load_addr) as the load address, but failed all the time, seems I used
the ":=" assignment, now with "=", it works, thanks!
And could you please explain their differences?
>> +vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
>> + $(call cmd,zld)
>> $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@
> Does objcopy support equally named input and out files?
> If this is the case you could use:
> $(call cmd,objcopy) as the last line.
Just checked the ld.script, and found the .reginfo section have been
discarded, then it's time to remove this objcopy line(this objcopy
line only remove the .reginfo section).
>> + /* Align with 65536 */
>> + vmlinuz_load_addr += (65536 - vmlinux_size % 65536);
> You have plenty of rooms for a comment about why you do this.
> Would be good to use this possibility.
The address of "vmlinux_load_addr + vmlinux_size" may be not aligned
with the standard data type of MIPS, that's why we need the alignment,
but here 65536, 64k(about several pages), is really a little big, I
will use 16 bytes in the next revision and add more comments for it:
+ * Align with 16 bytes: "greater than that used for any standard data
+ * types by a MIPS compiler." -- See MIPS Run Linux (Second Edition).
+ vmlinuz_load_addr += (16 - vmlinux_size % 16);
Thanks & Regards,
Studying engineer. Wu Zhangjin
Lanzhou University http://www.lzu.edu.cn
Distributed & Embedded System Lab http://dslab.lzu.edu.cn
School of Information Science and Engeneering http://xxxy.lzu.edu.cn
Address:Tianshui South Road 222,Lanzhou,P.R.China Zip Code:730000