Forum Discussion
Altera_Forum
Honored Contributor
19 years agoHello world build error!
Hi all, When build the hello_world.c, I encount a error, Is any one can help me out? the hello_world.c as follows: #include <linux/init.h># include <linux/module.h># include <linux/kerne...
Altera_Forum
Honored Contributor
19 years ago --- Quote Start --- originally posted by helmchen@Feb 3 2007, 10:52 PM didn't you try
make arch=nios2nommu cross_compile=nios2-linux-uclibc- -c ~/uclinux-dist/linux-2.6.x m=`pwd` modules
which you will need to compile device drivers
instead of
nios2-linux-uclibc-gcc linux-2.6.x/drivers/misc/hello.c -o hello -elf2flt="-s 4000" which suits for user programm.
you will find detailed explanation in the kernel docs.
hope this helps, but i'm not a kernel crack
maybe you take a look at the nioswiki for the module programming example.
by the way let me ask you, what do you want to do?
do you want to write a device driver or a user program.
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=21184)</div> --- Quote End --- hi Helmchen, thank you very much for your reply, I'm porting uCLinux on my own NiosII board, and start develope programme according to hippo's post: http://forum.niosforum.com/forum/index.php?showtopic=3174 (http://forum.niosforum.com/forum/index.php?showtopic=3174) when come to 11 tips, I have tied code he provided: -----------------
nios2-linux-uclibc-gcc hello.c -o hello -elf2flt
cp hello ~/rootfs/bin Rebuild the kernel image for initramfs, boot nios2 uClinux, and run hello ----------------- Here the 'hello.c' is a user programme, I mistake it to a device driver, and use nios2-linux-uclibc-gcc linux-2.6.x/drivers/misc/hello.c -o hello -elf2flt="-s 4000" which is applied for user programme, so got the errors. Now I write a "hello world" user programme, and compiled successfully according the code. Thanks again! And I have a question: I have make a "hello_world" module which is a simple device driver, but I can only dynamic add it by "modprobe hello_world". Do you know how to add it with static method,namely add this module in when the kernel start?