[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Ntpd config file support
From:       Mike Dean <mdean () emacinc ! com>
Date:       2014-03-24 16:58:01
Message-ID: CAPMJ7HpbqL_ZAqiyG8g7qFHf5AY4qDnMnwXpui0HH=iAt8uXWg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


In the 2.6 and 3.x kernels, you annotate your init functions with the
__init macro, like so:

static int __init myinit( void )  { return 0; }

No more hoops are needed, but no fewer.  It's simple, and it works well for
the kernel.


Mike Dean

mdean@emacinc.com
http://www.emacinc.com/

Engineer
EMAC, Inc.
618-529-4525 Ext. 330
618-457-0110 Fax
2390 EMAC Way
Carbondale, Il 62901



On Sat, Mar 22, 2014 at 5:47 AM, Lauri Kasanen <curaga@operamail.com> wrote:

> On Sat, Mar 22, 2014, at 1:57, Laurent Bercot wrote:
> > On 21/03/2014 23:10, Cathey, Jim wrote:
> > > The only thing BB would need would be to isolate initialization
> > > into separate functions that would be grouped together by the
> > > linker.  (And an associated link control file.)  The usual demand-paged
> > > kernel will take care of the rest.
> >
> > Yes, that would definitely be the right approach. However, it conflicts
> > with code organization, and thus, maintainability: currently, the code is
> > sharded by functionality, which is sane and sound - but the linker would
> > need the code to be sharded by type, init or non-init, which is exactly
> > orthogonal to functionality. I'm not up to date with latest linkers, but
> > unless you can annotate functions inside a single .c, it means that you
> > now need to split every single functionality into at least two .c files.
>
> Slightly off tangent, but I remember reading a thesis on link time
> optimization for the 2.4 linux kernel.
>
> Among other things they managed to do was automatic recognition of init
> code, and moving such to its own section. It was quite interesting tech,
> no annotations needed; given the kernel already had some annotations,
> the tech merged the newly found init code to the annotated one. It could
> even detect parts that could not be annotated, because on some arch they
> would be called more than once - if your arch didn't, into the init
> section they went.
>
> So this could be done entirely in the linker, no busybox code needed.
>
> - Lauri
>
> --
> http://www.fastmail.fm - A fast, anti-spam email service.
>
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>

[Attachment #5 (text/html)]

<div dir="ltr">In the 2.6 and 3.x kernels, you annotate your init functions with the \
__init macro, like so:<div><br></div><div>static int __init myinit( void )  { return \
0; }</div><div><br></div><div>No more hoops are needed, but no fewer.  It&#39;s \
simple, and it works well for the kernel.</div> <div><br></div></div><div \
class="gmail_extra"><br clear="all"><div><div dir="ltr">Mike \
Dean<div><br></div><div><a href="mailto:mdean@emacinc.com" \
target="_blank">mdean@emacinc.com</a></div><div><a href="http://www.emacinc.com/" \
style="font-family:arial;font-size:small" \
target="_blank">http://www.emacinc.com/</a></div> \
<div><br><div>Engineer</div><div>EMAC, Inc.</div><div>618-529-4525 Ext. \
330<br></div></div><div>618-457-0110<span \
style="font-family:Arial,sans-serif;font-size:13.333333015441895px"> \
Fax</span><br></div><div><span \
style="font-family:Arial,sans-serif;font-size:13.333333015441895px">2390 EMAC \
Way</span><br style="font-family:Arial,sans-serif;font-size:13.333333015441895px"> \
<span style="font-family:Arial,sans-serif;font-size:13.333333015441895px">Carbondale, \
Il 62901</span><span \
style="font-family:Arial,sans-serif;font-size:13.333333015441895px"><br></span></div><div><span \
style="font-family:Arial,sans-serif;font-size:13.333333015441895px"><br> \
</span></div></div></div> <br><br><div class="gmail_quote">On Sat, Mar 22, 2014 at \
5:47 AM, Lauri Kasanen <span dir="ltr">&lt;<a href="mailto:curaga@operamail.com" \
target="_blank">curaga@operamail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div class="">On Sat, Mar 22, 2014, at 1:57, Laurent Bercot \
wrote:<br> &gt; On 21/03/2014 23:10, Cathey, Jim wrote:<br>
&gt; &gt; The only thing BB would need would be to isolate initialization<br>
&gt; &gt; into separate functions that would be grouped together by the<br>
&gt; &gt; linker.  (And an associated link control file.)  The usual demand-paged<br>
&gt; &gt; kernel will take care of the rest.<br>
&gt;<br>
&gt; Yes, that would definitely be the right approach. However, it conflicts<br>
&gt; with code organization, and thus, maintainability: currently, the code is<br>
&gt; sharded by functionality, which is sane and sound - but the linker would<br>
&gt; need the code to be sharded by type, init or non-init, which is exactly<br>
&gt; orthogonal to functionality. I&#39;m not up to date with latest linkers, but<br>
&gt; unless you can annotate functions inside a single .c, it means that you<br>
&gt; now need to split every single functionality into at least two .c files.<br>
<br>
</div>Slightly off tangent, but I remember reading a thesis on link time<br>
optimization for the 2.4 linux kernel.<br>
<br>
Among other things they managed to do was automatic recognition of init<br>
code, and moving such to its own section. It was quite interesting tech,<br>
no annotations needed; given the kernel already had some annotations,<br>
the tech merged the newly found init code to the annotated one. It could<br>
even detect parts that could not be annotated, because on some arch they<br>
would be called more than once - if your arch didn&#39;t, into the init<br>
section they went.<br>
<br>
So this could be done entirely in the linker, no busybox code needed.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Lauri<br>
<br>
--<br>
<a href="http://www.fastmail.fm" target="_blank">http://www.fastmail.fm</a> - A fast, \
anti-spam email service.<br> </font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
busybox mailing list<br>
<a href="mailto:busybox@busybox.net">busybox@busybox.net</a><br>
<a href="http://lists.busybox.net/mailman/listinfo/busybox" \
target="_blank">http://lists.busybox.net/mailman/listinfo/busybox</a><br> \
</div></div></blockquote></div><br></div>



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic