Hi,<br><br>About the previuos e-mail, I think this last is not necessary:<br>*Comment line on linux/kernel-../arch/l4/Makefile the one that says: include $(KBUILD_SRC)/$(ARCH_DIR)/sys-$(SYSTEM)/Makefile<br>cp linux/kernel-../l4linux_config_<arch> linux/kernel/.config<br>
make menuconfig<br>*Uncomment commented line of linux/kernel/arch/l4/Makefile<br>rm linux/kernel/.config*<br><br>All the best,<br><br>Jorge<br><br><div class="gmail_quote">On Tue, Apr 8, 2008 at 8:40 PM, Jorge Torres <<a href="mailto:jorge.torres.maldonado@gmail.com">jorge.torres.maldonado@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br><br>I dont know what would be the best way for doing this, I've also done this as follows:<br>
<br>*Adding driver at:<br>linux/kernel-2.6.11-v2/arch/l4/drivers/hello.c<br><br>*at linux/kernel-2.6.11-v2/arch/l4/drivers/Makefile:<br>
<br>obj-$(CONFIG_HELLO) += hello.o<br><br>*at linux/kernel-2.6.11-v2/arch/l4/Kconfig:<br><br>menu "HELLO"<br><br>config HELLO<br> bool "add hello"<br> default y<br>endmenu<br><br><br><br>Hope it helps,<br>
<br>Cheers,<br><font color="#888888"><br>Jorge</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Mon, Mar 31, 2008 at 12:31 PM, Remy Gottschalk <<a href="mailto:rgottschalk@linagora.com" target="_blank">rgottschalk@linagora.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi again<br>
<br>
This howto directly follows the previous one (HelloWorld Iguana server<br>
HowTo) and explain how interacting with the helloworld server from wombat.<br>
The next will probably deal with more elaborate communication and shared<br>
memory.<br>
<br>
<br>
----------------------------<br>
Using the server from Wombat<br>
----------------------------<br>
<br>
Now we have a functional hello server we will use it from the<br>
para-virtualized Linux. We will do so using a new entry in /proc.<br>
<br>
1 Library<br>
---------<br>
<br>
The first thing to do is to link the kernel to our client library<br>
libhello.a. To achieve this we simply add a -lhello flag to the kernel<br>
Makefile.<br>
<br>
$ cat linux/kernel-2.6.11-v2/arch/l4/Makefile<br>
[...]<br>
libs-y += -lvtimer -lvserial -ll4e -lll -liguana -ll4 -lgcc -lmutex<br>
-lcircular_buffer -lnaming -lhello<br>
[...]<br>
<br>
2 A new module<br>
--------------<br>
<br>
We will now create a new kernel module to allow use interacting with the<br>
server using a /proc entry.<br>
We will work directly in a hello folder in the kernel root in order to<br>
make things fast and easy.<br>
<br>
$ mkdir linux/kernel-2.6.11-v2/hello<br>
$ touch linux/kernel-2.6.11-v2/hello/Makefile<br>
$ touch linux/kernel-2.6.11-v2/hello/my_l4_hello.c<br>
$ ls linux/kernel-2.6.11-v2/hello<br>
Makefile my_l4_hello.c<br>
<br>
We need to modify the global Makefile :<br>
$ cat linux/kernel-2.6.11-v2/Makefile<br>
[...]<br>
core-y := usr/ hello/<br>
[...]<br>
and create a new one for our source file.<br>
$ cat linux/kernel-2.6.11-v2/hello/Makefile<br>
obj-y += my_l4_hello.o<br>
<br>
Now here is the code for our module :<br>
<br>
$ cat linux/kernel-2.6.11-v2/hello/my_l4_hello.c<br>
#include <linux/module.h><br>
#include <linux/kernel.h><br>
#include <linux/proc_fs.h><br>
#include <linux/string.h><br>
#include <linux/vmalloc.h><br>
#include <asm/uaccess.h><br>
<br>
#include <hello/hello.h><br>
<br>
/* Defines the license for this LKM */<br>
MODULE_LICENSE("GPL");<br>
MODULE_DESCRIPTION("L4 Hello Wrapper");<br>
<br>
static struct proc_dir_entry *proc_entry;<br>
<br>
int hello_read( char *page, char **start, off_t off,<br>
int count, int *eof, void *data )<br>
{<br>
say_hello();<br>
return 0;<br>
}<br>
<br>
int my_module_init( void )<br>
{<br>
int ret = 0;<br>
<br>
proc_entry = create_proc_entry( "hello", 0644, NULL );<br>
if (proc_entry == NULL)<br>
{<br>
ret = -ENOMEM;<br>
printk(KERN_INFO "fortune: Couldn't create proc entry\n");<br>
}<br>
else<br>
{<br>
proc_entry->read_proc = hello_read;<br>
proc_entry->write_proc = hello_write;<br>
proc_entry->owner = THIS_MODULE;<br>
printk(KERN_INFO "<===== Hello Module Started =====>\n");<br>
}<br>
hello_init();<br>
return ret;<br>
}<br>
<br>
void my_module_cleanup( void )<br>
{<br>
remove_proc_entry("hello", &proc_root);<br>
printk(KERN_INFO "<===== Hello Module Unloaded =====>\n");<br>
return;<br>
}<br>
<br>
module_init( my_module_init );<br>
module_exit( my_module_cleanup );<br>
<br>
This module creates a new entry in /proc (/proc/hello) and calls say_hello<br>
on each reading access.<br>
<br>
We can see that using our server is pretty simple, three line are<br>
concerned :<br>
#include <hello/hello.h><br>
To include user library headers<br>
hello_init();<br>
In order to initiate the communication.<br>
say_hello();<br>
To interact with our server.<br>
<br>
3 Final test<br>
------------<br>
<br>
We compile and test :<br>
<br>
$ ./tools/build.py machine=ia32_pc99 project=iguana wombat=True<br>
toolprefix=i686-unknown-linux-gnu- simulate<br>
[...]<br>
<===== Hello Module Started =====><br>
[...]<br>
<===== Hello Server Started =====><br>
[...]<br>
Please press Enter to activate this console.<br>
<br>
BusyBox v1.00 (2008.03.28-14:47+0000) Built-in shell (ash)<br>
Enter 'help' for a list of built-in commands.<br>
<br>
/ # cat /proc/hello<br>
I say hello<br>
/ #<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Remy Gottschalk - <a href="mailto:rgottschalk@linagora.com" target="_blank">rgottschalk@linagora.com</a><br>
Ingénieur informatique embarquée<br>
Groupe LINAGORA - <a href="http://www.linagora.com" target="_blank">http://www.linagora.com</a><br>
Tél.: +33(0)1 58 18 68 28 - Fax : +33(0)1 58 18 68 29<br>
<br>
<br>
<br>
_______________________________________________<br>
Developer mailing list<br>
<a href="mailto:Developer@okl4.org" target="_blank">Developer@okl4.org</a><br>
<a href="https://lists.okl4.org/mailman/listinfo/developer" target="_blank">https://lists.okl4.org/mailman/listinfo/developer</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>