Booting linux for 405EP --> mem_pieces_find( ) nightmare
Garcia Jérémie
GARCIAJ at 3il.fr
Tue Apr 26 23:27:35 EST 2005
Hi everybody,
I'm tryin to adapt a linux LSP deom Montavista (the one for the 405EP evaluation board) to a proprietary hardware using a 405EP.
Unfortunately, it is not as easy as I thought. Here is my problem:
To load our linux image (zImage.treeboot), we use the "VxWorks bootrom" bootloader which download the image via tftp.
That works well except the fact that in the LSP, linux tried to get a board info structure in flash memory at an address where we have nothing. So we replace this behavior in "embed_config.c" with the following lines (note: I had to re-code the strcpy although there is the #include<string.h> because it cannot find the reference at the link level... why???):
/* We use VxWorks bootrom, so we have to create ourselves the boot info structure */
bd_t my_bd_t;
char * my_strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
bd_t * get_board_info(void)
{
my_strcpy(my_bd_t.bi_s_version,"v1"); /* Version of this structure */
my_strcpy(my_bd_t.bi_r_version,"bootrom linux 1.0") ; /* Version of the IBM ROM */
my_bd_t.bi_memsize = 16000000 ; /* DRAM installed, in bytes */
my_strcpy(my_bd_t.bi_enetaddr[0],"00:01:73:01:C1:3B"); /* Local Ethernet MAC address */
my_strcpy(my_bd_t.bi_enetaddr[1],"00:01:73:01:C1:3C"); /* Local Ethernet MAC address */
my_bd_t.bi_intfreq = 200000000 ; /* Processor speed, in Hz */
my_bd_t.bi_busfreq = 100000000 ; /* PLB Bus speed, in Hz */
my_bd_t.bi_pllouta_freq = 800000000 ; /* PLL OUTA speed, in Hz */
my_bd_t.bi_opb_busfreq = 50000000 ; /* OPB Bus speed, in Hz */
my_bd_t.bi_iic_fast[0] = 0 ; /* Use fast i2c mode */
/* We return the address of our global structure */
return &my_bd_t;
}
void embed_config(bd_t **bdp)
{
u_char *cp;
int i;
bd_t *bd, *treeboot_bd;
bd = &bdinfo;
*bdp = bd;
if ((treeboot_bd = get_board_info()) != NULL)
memcpy(bd, treeboot_bd, sizeof(bd_t));
else
{
/* Give default values for our board info structure */
bd->bi_memsize = 16 * 1024 * 1024;
cp = (u_char *)def_enet_addr;
for (i=0; i<6; i++)
{
/* I should probably put different ones here,
* hopefully only one is used.
*/
bd->BD_EMAC_ADDR(0,i) = *cp;
}
bd->bi_intfreq = 200000000;
bd->bi_busfreq = 500000000;
}
/* Yeah, this look weird, but on Redwood 4 they are
* different object in the structure. Sincr Redwwood 5
* and Redwood 6 use OpenBIOS, it requires a special value.
*/
timebase_period_ns = 1000000000 / bd->bi_tbfreq;
}
That done, the linux booting process continues till the "MMU_init()" function, that drives me to the panic() function when it tries to do the mem_pieces_find() (see below).
/*
* Scan a region for a piece of a given size with the required alignment.
*/
void __init *
mem_pieces_find(unsigned int size, unsigned int align)
{
int i;
unsigned a, e;
struct mem_pieces *mp = &phys_avail;
for (i = 0; i < mp->n_regions; ++i) {
a = mp->regions[i].address;
e = a + mp->regions[i].size;
a = (a + align - 1) & -align;
if (a + size <= e) {
mem_pieces_remove(mp, a, size, 1);
return (void *) __va(a);
}
}
panic("Couldn't find %u bytes at %u alignment\n", size, align); /* <-- HERE WE GO !!.... */
return NULL;
}
I have no clue on what's happening (I'm a newbie in kernel sources dev...). Could you give me a tip please cause I really need help on that.
Tks a lot
Jérémie \\ (°.°) //~ ~ ~ HELP ~ ~ ~ \\ (°.°) //
More information about the Linuxppc-dev
mailing list