Discussion:
[uClinux-dev] uClinux dist changes from 20120401 to 20120620
Luis Alves
2012-08-05 14:00:39 UTC
Permalink
Hi,

Yesterday I have downloaded latest uClinux-dist (20120620). I was
using uClinux-dist-20120401.

After applying my 68000 changes, when targeting the kernel to be
placed on ROM the linker is giving me extra headers (.rodata, __param
and __modver):

[...]
linux-3.x/vmlinux: file format elf32-m68k

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 001b4010 00810000 00810000 00002000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00039a48 00001000 009c4010 001b7000 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 __param 00000330 0003aa48 009fda58 001f0a48 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 __modver 00000288 0003ad78 009fdd88 001f0d78 2**1
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .data 00014860 0003b000 009fe010 001f1000 2**4
CONTENTS, ALLOC, LOAD, DATA
5 .init.text 0000d8c2 00050000 00a13010 00206000 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
6 .init.data 0000373c 0005d8c4 00a208d4 002138c4 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .bss 0000caec 00061000 00a24010 00217000 2**4
ALLOC
8 .comment 000026d0 00000000 00000000 00217000 2**0
CONTENTS, READONLY
[...]




With the previous vmlinux-nommu.lds I had:


[...]
linux-3.x/linux: file format elf32-m68k

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 001edd8c 00810000 00810000 00028000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00015000 00001000 00001000 00001000 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init.text 0000d8c2 00016000 00016000 00016000 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .init.data 0000373c 000238c4 000238c4 000238c4 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .bss 0000caec 00027000 00027000 00027000 2**4
ALLOC
5 .comment 000026d0 00000000 00000000 00215d8c 2**0
CONTENTS, READONLY
[...]




And my makefile was generating the linux.bin like this:

[...]
$(CROSS_COMPILE)objcopy -O binary -j .data -j .init.text -j .init.data \
$(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data
$(CROSS_COMPILE)objcopy -O binary -j .text \
$(ROOTDIR)/$(LINUXDIR)/linux \
$(IMAGEDIR)/linux.text
cat $(IMAGEDIR)/linux.text $(IMAGEDIR)/linux.data > $(IMAGEDIR)/linuxrom.bin
[...]


I had to replace the new vmlinux-nommu.lds with the previous one to be
able to generate the bin.

How should I modify the objcopy's so that I can use the new vmlinux-nommu.lds ?


Memory layout is like this:
0x0 - 0x7FFFFF: ram (8Mb)
0x800000 - 0xBFFFFF: flash (4Mb)

Kernel being booted at 0x810000 and base ram for linux begining at 0x1000


Thanks,
Luis Alves
Greg Ungerer
2012-08-07 06:38:46 UTC
Permalink
Hi Luis,
Post by Luis Alves
Yesterday I have downloaded latest uClinux-dist (20120620). I was
using uClinux-dist-20120401.
After applying my 68000 changes, when targeting the kernel to be
placed on ROM the linker is giving me extra headers (.rodata, __param
The changes to the linker scripts where made to bring the non-mmu
one more into line with the standard mmu one. That means we use
most of the kernels generic linker symbols. (These occasionally
got broken before, since the non-mmu linker scripts was rolling its
own version of quite a few of the section macros).
Post by Luis Alves
[...]
linux-3.x/vmlinux: file format elf32-m68k
Idx Name Size VMA LMA File off Algn
0 .text 001b4010 00810000 00810000 00002000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00039a48 00001000 009c4010 001b7000 2**4
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 __param 00000330 0003aa48 009fda58 001f0a48 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 __modver 00000288 0003ad78 009fdd88 001f0d78 2**1
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .data 00014860 0003b000 009fe010 001f1000 2**4
CONTENTS, ALLOC, LOAD, DATA
5 .init.text 0000d8c2 00050000 00a13010 00206000 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
6 .init.data 0000373c 0005d8c4 00a208d4 002138c4 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .bss 0000caec 00061000 00a24010 00217000 2**4
ALLOC
8 .comment 000026d0 00000000 00000000 00217000 2**0
CONTENTS, READONLY
[...]
So it looks like LMA's are wrong now. What config switches do you
have enabled, and what are they set to for the kernel memory layout?

Important ones to look at are:

CONFIG_RAMBASE
CONFIG_RAMSIZE
CONFIG_VECTORBASE
CONFIG_KERNELBASE
CONFIG_ROM
CONFIG_RAMKERNEL
CONFIG_ROMKERNEL

The CONFIG_ROMKERNEL is particularly important. The linker script
does different things based on that.
Post by Luis Alves
[...]
linux-3.x/linux: file format elf32-m68k
Idx Name Size VMA LMA File off Algn
0 .text 001edd8c 00810000 00810000 00028000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00015000 00001000 00001000 00001000 2**4
CONTENTS, ALLOC, LOAD, DATA
2 .init.text 0000d8c2 00016000 00016000 00016000 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
3 .init.data 0000373c 000238c4 000238c4 000238c4 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .bss 0000caec 00027000 00027000 00027000 2**4
ALLOC
5 .comment 000026d0 00000000 00000000 00215d8c 2**0
CONTENTS, READONLY
[...]
[...]
$(CROSS_COMPILE)objcopy -O binary -j .data -j .init.text -j .init.data \
$(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data
You may need to change this too, with the new linker script:

$(CROSS_COMPILE)objcopy -O binary \
-j .rodata \
-j __param \
-j __modver \
-j .data \
-j .init.text \
-j .init.data \
$(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data

Regards
Greg
Post by Luis Alves
$(CROSS_COMPILE)objcopy -O binary -j .text \
$(ROOTDIR)/$(LINUXDIR)/linux \
$(IMAGEDIR)/linux.text
cat $(IMAGEDIR)/linux.text $(IMAGEDIR)/linux.data > $(IMAGEDIR)/linuxrom.bin
[...]
I had to replace the new vmlinux-nommu.lds with the previous one to be
able to generate the bin.
How should I modify the objcopy's so that I can use the new vmlinux-nommu.lds ?
0x0 - 0x7FFFFF: ram (8Mb)
0x800000 - 0xBFFFFF: flash (4Mb)
Kernel being booted at 0x810000 and base ram for linux begining at 0x1000
Thanks,
Luis Alves
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg at snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Luis Alves
2012-08-09 23:31:08 UTC
Permalink
Hi Greg,
Post by Greg Ungerer
So it looks like LMA's are wrong now. What config switches do you
have enabled, and what are they set to for the kernel memory layout?
CONFIG_RAMBASE
0x1000
Post by Greg Ungerer
CONFIG_RAMSIZE
0x7ff000
Post by Greg Ungerer
CONFIG_VECTORBASE
0x0
Post by Greg Ungerer
CONFIG_KERNELBASE
0x810000
Post by Greg Ungerer
CONFIG_ROM
y
Post by Greg Ungerer
CONFIG_RAMKERNEL
not set
Post by Greg Ungerer
CONFIG_ROMKERNEL
y
Post by Greg Ungerer
$(CROSS_COMPILE)objcopy -O binary \
-j .rodata \
-j __param \
-j __modver \
-j .data \
-j .init.text \
-j .init.data \
$(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data
Well, it works with these changes.
I was pretty sure I had tried that, I guess I screwed up somewhere...


Thanks a lot,
Luis

Loading...