Hi Daniel,

Le lundi 11 juin 2012 02:44:21, Daniel Golle a écrit :
> Hi Felix,
> 
> On Sun, Jun 10, 2012 at 06:01:29PM +0200, Felix Fietkau wrote:
> > If it's just minor differences, the huge amount of code duplication is
> > probably a very bad idea. I'd rather see things unified, otherwise it's
> > way too easy for fixes done to one of the two to be lost on the other
> > one.
> 
> I agree, though I don't have any AR7 system at hand for testing (shouldn't
> be too difficult to find one)
> I see that this can work with by pre-compiler makro setting TEXT_BASE in
> the Platform file according to the chip-family selected in kernel's
> .config -- besides that everything could be probed in run-time.

It does not look like the physical offset is really different from AR7, so you 
could probably just have a the kernel be loaded at a different address and 
still have both kernel work on both platforms, can you try that?

> 
> > >  - during boot, the kernel claims that 9192k are reserved, leaving only
> > >  a tiny
> > >  
> > >    bit of memory to the user. This seems to be too much, the original
> > >    firmware of the MP-202 (Linux version 2.4.21openrg-rmk1) only
> > >    claims 3900k reserved during boot. Did Linux itself grow that much
> > >    since 2.4? Or is there something wrong here?
> > 
> > My guess is that the memory before the kernel image isn't marked as
> > free. The load address is higher, so it marks more memory as reserved.
> > AR7 could probably use a similar fix.
> 
> Thanks for that excellent hint. Applying the patch below gave me
> Freeing prom memory: 5924k freed
> Which is exactly the distance between the the end of the first page in
> memory and the kernel's text-base.
> Obviously, this can work similarly on many systems.
> 
> diff --git a/target/linux/ac49x/files/arch/mips/ac49x/memory.c
> b/target/linux/ac49x/files/arch/mips/ac49x/memory.c index c58832e..06f742c
> 100644
> --- a/target/linux/ac49x/files/arch/mips/ac49x/memory.c
> +++ b/target/linux/ac49x/files/arch/mips/ac49x/memory.c
> @@ -67,5 +67,11 @@ void __init prom_meminit(void)
> 
>  void __init prom_free_prom_memory(void)
>  {
> -     /* Nothing to free */
> +/* adapted from arch/mips/txx9/generic/setup.c */
> +     unsigned long saddr = PHYS_OFFSET + PAGE_SIZE;
> +     unsigned long eaddr = __pa_symbol(&_text);
> +
> +     /* free memory between prom-record and kernel _text base */
> +     if (saddr < eaddr)
> +             free_init_pages("prom memory", saddr, eaddr);
>  }

-- 
Florian
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to