Forum Discussion
Altera_Forum
Honored Contributor
21 years agoOk ... finally had some time to check a few things...
> When the code is executed the NIOS dies ... Hmmm ... the code was tested so I believe it to be correct. You can call it _after_ copying the kernel code. The p parameter should point to the address where you copied the kernel to, the len parameter is the length of the kernel (in bytes). >> 3. Make sure you have your stack setup. > Huh? Disregard ... the kernel code has no dependency on a bootloader stack. >> Check the kernel startup code to make sure its >> relocation implementation isn't broken. > I dunno what that is. Relocation implementation... > wheres that??? It's in arch/nios2nommu/kernel/head.S ... this is where it all begins ;-) The kernel startup code copies itself from an arbitrary address to its run-time (linked) address (vma, etc) as necessary. I didn't see any obvious problems unless ... you are copying the kernel to a location just below it's actual run-time addr such that it will overlap. The startup code does not account for such a situation ... it will over-write itself while it's relocating. Safest bet is to do one of the following: 1. Copy the kernel to its run-time address (vma). In which case your boot code must know the correct address. Or, 2. Copy the kernel up high in RAM, then let it relocate itself to a lower address. Regards, --Scott