[BusyBox] Re: busybox init memory problems
bug1
bug1 at netconnect.com.au
Fri Jun 2 18:30:27 UTC 2000
Erik Andersen wrote:
>
> On Fri Jun 02, 2000 at 10:54:24PM +1000, bug1 wrote:
> >
> > The sysinfo struct has changed going to 2.[34], whats the best way to
> > fix this ?
> >
>
> Ahh. This explains it. Thanks for tracking this down. Hmm. Looks like you
> must have compiled it under 2.2.x and then run it under 2.4.x then, correct?
> Could you track down the exact kernel rev where it changed?
>
> In busybox init.c I have some code where I do
>
> #ifndef KERNEL_VERSION
> #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
> #endif
>
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
> foo
> #endif
>
> but that approach is probably the wrong thing to do (i.e. setting it at compile
> time instead of at runtime), since it is clear that folks compile under some
> kernels and run with others and busybox should cope. It would be best here to
> use get_kernel_revision() from utility.c
>
> int kernelVersion = 0;
> kernelVersion = get_kernel_revision();
> if (kernelVersion > 0 && kernelVersion <= KERNEL_VERSION(2,4,0)) {
> foo();
> }
>
> And then it looks like we need to compile in our own versions of sysinfo
> structs so we can accomodate both kernels at runtime. sigh. All this
> pain is to avoid using /proc from init.
>
> -Erik
>
Yea, i did compile under 2.2 and run under 2.4, i didnt even think about
it.
The sysinfo struct changed three times, going from
2.3.15 -> 2.3.16
2.3.16 -> 2.3.17
2.3.22 -> 2.3.23
I guess thats going to make it a bit ugly.
Glenn
More information about the busybox
mailing list