List Info

Thread: Dynamically created kernel .c files




Dynamically created kernel .c files
country flaguser name
United Kingdom
2007-06-02 06:31:52
I've been wondering if there is an easy way to dynamically
create
.c files for the kernel build?

In particular compat/svr4/svr4_stream.c can be created from
compat/svr4_32/svr4_32_stream.c with a 'simple' sed command,
and it
seems rather a shame to have to keep two 2000 line files in
sync.

The makefile rule would be easy, but where would it be added
?

	David

-- 
David Laight: davidl8s.co.uk

Re: Dynamically created kernel .c files
user name
2007-06-02 06:36:16
davidl8s.co.uk wrote:

> I've been wondering if there is an easy way to
dynamically create
> .c files for the kernel build?
> 
> In particular compat/svr4/svr4_stream.c can be created
from
> compat/svr4_32/svr4_32_stream.c with a 'simple' sed
command, and it
> seems rather a shame to have to keep two 2000 line
files in sync.
> 
> The makefile rule would be easy, but where would it be
added ?

I think it looks better to have a script like
sys/kern/makesyscalls.sh
and sys/kern/Makefile then "update a base file and
regen others"
rather than creating them dynamically on each kernel build.
---
Izumi Tsutsui

Re: Dynamically created kernel .c files
country flaguser name
United Kingdom
2007-06-02 06:49:28
On Sat, Jun 02, 2007 at 08:36:16PM +0900, Izumi Tsutsui
wrote:
> davidl8s.co.uk wrote:
> 
> > I've been wondering if there is an easy way to
dynamically create
> > .c files for the kernel build?
> > 
> > In particular compat/svr4/svr4_stream.c can be
created from
> > compat/svr4_32/svr4_32_stream.c with a 'simple'
sed command, and it
> > seems rather a shame to have to keep two 2000 line
files in sync.
> > 
> > The makefile rule would be easy, but where would
it be added ?
> 
> I think it looks better to have a script like
sys/kern/makesyscalls.sh
> and sys/kern/Makefile then "update a base file and
regen others"
> rather than creating them dynamically on each kernel
build.

Why, I'd rather go the other way....

	David

-- 
David Laight: davidl8s.co.uk

Re: Dynamically created kernel .c files
country flaguser name
United States
2007-06-02 12:37:43
On Jun 2, 2007, at 4:31 AM, David Laight wrote:

> I've been wondering if there is an easy way to
dynamically create
> .c files for the kernel build?
>
> In particular compat/svr4/svr4_stream.c can be created
from
> compat/svr4_32/svr4_32_stream.c with a 'simple' sed
command, and it
> seems rather a shame to have to keep two 2000 line
files in sync.
>
> The makefile rule would be easy, but where would it be
added ?

Do the same trick that exec_elf{32,64} does and make the cpp
do the  
work.

Re: Dynamically created kernel .c files
country flaguser name
United Kingdom
2007-06-02 16:48:48
On Sat, Jun 02, 2007 at 05:42:58PM +0000, Christos Zoulas
wrote:
> In article <31FDFD34-5E05-40BE-A3FE-7703CDDABEFA3am-software.com>,
> Matt Thomas  <matt3am-software.com>
wrote:
> >
> >On Jun 2, 2007, at 4:31 AM, David Laight wrote:
> >
> >> I've been wondering if there is an easy way to
dynamically create
> >> .c files for the kernel build?
> >>
> >> In particular compat/svr4/svr4_stream.c can be
created from
> >> compat/svr4_32/svr4_32_stream.c with a
'simple' sed command, and it
> >> seems rather a shame to have to keep two 2000
line files in sync.
> >>
> >> The makefile rule would be easy, but where
would it be added ?
> >
> >Do the same trick that exec_elf{32,64} does and
make the cpp do the  
> >work.
> 
> That is even better. The only disadvantage is that the
files are less
> readable.

I've done something even better.
svr4_32/svr4_32_stream.c now just includes
svr4/svr4_stream.c, the latter
contains a few defines at the top and extra macro calls
where the _32
code needed them.

	David

-- 
David Laight: davidl8s.co.uk

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )