[prev in list] [next in list] [prev in thread] [next in thread]
List: uclinux-dev
Subject: [uClinux-dev] HOW-TO compile linux to run directly from flash?
From: "Lars Holowko" <Lars.Holowko () lantronix ! com>
Date: 2009-04-13 21:57:35
Message-ID: 022254FBC8645942BBF88A022862CDD33C5FFC () 3putt ! int ! lantronix ! com
[Download RAW message or body]
Hi everyone,
To gain more RAM on our coldfire 5208 platform, I am trying to run Linux
from flash directly.
The problem I am facing right now is that
m68k-uclinux-objcopy -O binary linux-2.6.x/linux /tmp/linux.bin.my
creates a huge image file:
lars@larsubu:/tmp/a3$ ls -l /tmp/linux.bin.my -rwxr-xr-x 1 lars lars
1073613792 2009-04-08 09:56 /tmp/linux.bin.my lars@larsubu:/tmp/a3$ ls
-l linux-2.6.x/linux -rwxr-xr-x 2 lars lars 2209589 2009-04-08 09:29
linux-2.6.x/linux
These are my configuration values I used for the kernel
lars@larsubu:/tmp/a3/linux-2.6.x$ grep 'CONFIG_R[O|A]M' .config
CONFIG_RAMBASE=0x40000000
CONFIG_RAMSIZE=0x00800000
CONFIG_ROM=y
CONFIG_ROMBASE=0
CONFIG_ROMVEC=0x40020
CONFIG_ROMVECSIZE=0x100
CONFIG_ROMSTART=0x40420
CONFIG_ROMSIZE=0x400000
# CONFIG_RAMKERNEL is not set
CONFIG_ROMKERNEL=y
Obviously m68k-uclinux-objcopy dumps the whole address range between the
first symbol in System.map and the last one.
So I have to extract the segments individually and let the bootloader
copy the data segment to RAM before it jumps into Linux?
lars@larsubu:/tmp/a3$ m68k-uclinux-objdump -h /tmp/a3/linux-2.6.x/linux
/tmp/a3/linux-2.6.x/linux: file format elf32-m68k
Sections:
Idx Name Size VMA LMA File off Algn
0 .romvec 000000fc 00040020 00040020 001c1000 2**0
CONTENTS, READONLY
1 .text 0019f1c8 00040420 00040420 00000420 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .data 00012000 40000000 40000000 001a0000 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .init 0000f000 40012000 40012000 001b2000 2**2
CONTENTS, ALLOC, LOAD, CODE
4 .bss 0001002c 40021000 40021000 001c1000 2**4
ALLOC
5 .comment 0000474c 00000000 00000000 001c10fc 2**0
CONTENTS, READONLY
And what about the .init segment? Looks like it has to go into RAM too.
Does it use self-modifying code?
Isn't there an easier way? It doesn't make things like firmware
upogrades easier if I have to split the kernel into 3 pieces.
If I should get beyond this hurdle, will I have do anything else then
adding the following code to
linux-2.6.x/arch/m68knommu/platform/coldfire/vectors.c to initialize the
romvec table?
#if defined(CONFIG_ROMKERNEL)
asm (
"\t.global _start, __ramend\n\t"
".section .romvec\n"
"e_vectors:\n\t"
".long _ramend-4, _start, buserr, trap, trap, trap, trap,
trap\n\t"
".long trap, trap, trap, trap, trap, trap, trap, trap\n\t"
".long trap, trap, trap, trap, trap, trap, trap, trap\n\t"
".long inthandler, inthandler, inthandler, inthandler\n\t"
".long inthandler, inthandler, inthandler, inthandler\n\t"
/* TRAP #0-15 33-48*/
".long system_call, trap, trap, trap, trap, trap, trap,
trap\n\t"
".long trap, trap, trap, trap, trap, trap, trap, trap\n\t"
/* illegal traps 49-63*/
".long trap, trap, trap, trap, trap, trap, trap, trap\n\t"
".long trap, trap, trap, trap, trap, trap, trap\n\t"
".text\n"
"ignore: rte\n"
);
#endif
Any hint would be highly appreciated. Has someone done it successfully
on a coldfire platform?
Lars
**********************************************************************
This e-mail is the property of Lantronix. It is intended only for the person or \
entity to which it is addressed and may contain information that is privileged, \
confidential, or otherwise protected from disclosure. Distribution or copying of this \
e-mail, or the information contained herein, to anyone other than the intended \
recipient is prohibited. _______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic