Compile Linux Kernel Modules
ÎÒÕýÔÚѧϰдlinux device driver for embedded system.
ÎÒÓÐÒ»¸ölinuxǶÈëʽÉ豸£¬Ò²ÓÐÕâ¸öÉ豸µÄlinuxÔ´´úÂë¡£Ò²ÓÐcross compiler tool chain.
µÚÒ»²½£¬¾ÍÊÇдһ¸ö¼òµ¥µÄhelloÄ£¿é£¬È»ºó×°µ½É豸ÖС£ÒÔÑéÖ¤ÎÒÕâ¸ö¿ª·¢»·¾³¡£
ÔÚÍøÉÏËÑË÷ÁËһϣ¬ how to cross compile linux device driver
·¢ÏÖÔÚlinux´úÂë¸ùĿ¼µÄMakefileÖÐÓйØÓÚcross compileµÄÃèÊö
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
#
# When performing cross compilation for other architectures ARCH shall be set
# to the target architecture. (See arch/* for the possibilities).
# ARCH can be set during invocation of make:
# make ARCH=ia64
# Another way is to have ARCH set in the environment.
# The default ARCH is the host where make is executed.
# CROSS_COMPILE specify the prefix used for all executables used
# during compilation. Only gcc and related bin-utils executables
# are prefixed with $(CROSS_COMPILE).
# CROSS_COMPILE can be set on the command line
# make CROSS_COMPILE=ia64-linux-
# Alternatively CROSS_COMPILE can be set in the environment.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
Ö»ÒªÖ¸¶¨ARCHºÍCROSS_COMPILE¾Í¿ÉÒÔÁË¡£
ÔÚÎÒµÄÕâ¸öMakefileÖУ¬ÒѾָ¶¨ÁËARCH=arm£¬CROSS_COMPILE=arm-linux-
ÒòΪÔÚ±àÒëmoduleµÄʱºò£¬Ê¹ÓõÄÊÇÄں˹¹Ôìϵͳ£¬Ò²¾ÍÊÇʹÓõÄÉÏÃæËù˵µÄÕâ¸öÔÚÄÚºËÔ´Âë¸ùĿ¼µÄMakefile¡£ËùÒÔÎҾͲ»ÐèÒªÔÚÎÒµ÷ÓÃmakeµÄÃüÁîÐÐÖÐÖ¸¶¨ARCHºÍCROSS_COMPILEÁË¡£
ÓÃÀ´²âÊÔµÄhelloÄ£¿éµÄÔ´ÂëÀ´×Ô http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html
hello.c
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
static int __init hello_start(void)
{
printk(KERN_INFO "Loading hello module...\n");
printk(KERN_INFO "Hello world\n");
return 0;
}
static void
Ïà¹ØÎĵµ£º
´´½¨×ÀÃæÍ¼±ê
Ŀǰ½«ÍøÂçÓ¦ÓÃÀ©Õ¹µ½×ÀÃæÊÇÒ»¸öÇ÷ÊÆ£¬´æÔÚןܶà½â¾ö·½°¸£¬±¾ÎÄÒÔ Mozilla Prism ΪÀý£¬ÀàËÆµÄ·½·¨Í¬ÑùÊÊÓÃÓÚ Google Chrome ¡£
1. µ½ Mozilla Prism µÄÍøÕ¾ÉÏÏÂÔØ Prism£¬µã»÷ Download Now Ö®ºó»áÌáʾÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÒÔ Mozilla Firefox À©Õ¹µÄ·½Ê½£¬ÊʺÏÒѾ°²×°ÓÐ Firefox µÄÅóÓÑ£»Ò»Ö ......
ÓÉÓÚ¹¤×÷ÐèÒªÏÖÔÚ¿ªÊ¼´Óͷѧϰlinux£¬ÏÂÃæÏȼǼamlogic openlinux°²×°²½Öè¡££¨Ç°ÌáÊǰ²×°ÁËÐéÄâ»ú£©
Amlogic open linux ±àÒë»·¾³°²×°
Ò»¡¢gcc¹¤¾ßµÄ°²×°
1¡¢´ÓAmlogicÍøÕ¾ÉÏÏÂÔØgcc¹¤¾ß
ÔÚÏÂÃæÏÂÔØIndex of /download/linux/gnutools
gnutools-arc2.2-p4-ubuntu-9.04-2010- ......
1. I/O Port
¡¡¡¡ºÍÓ²¼þ´ò½»µÀÀë²»¿ªI/O Port£¬ÀϵÄISAÉ豸¾³£ÊÇÕ¼ÓÃʵ¼ÊµÄI/O¶Ë¿Ú£¬ÔÚlinuxÏ£¬²Ù×÷ϵͳûÓжÔI/O¿ÚÆÁ±Î£¬Ò²¾ÍÊÇ˵£¬ÈκÎÇý¶¯³ÌÐò¶¼¿É¶ÔÈÎÒâµÄI/O¿Ú²Ù×÷£¬ÕâÑù¾ÍºÜÈÝÒ×ÒýÆð»ìÂÒ¡£Ã¿¸öÇý¶¯³ÌÐòÓ¦¸Ã×Ô¼º±ÜÃâÎóÓö˿ڡ£
¡¡¡¡ÓÐÁ½¸öÖØÒªµÄkernelº¯Êý¿É ......
ÔÚlinuxÏÂopengl±à³Ì£¬Ê×ÏÈÐèÒª°²×°glut°ü¡£
1 °²×°glut
£¨1£©ÏÂÔØµØÖ·£º
http://fidelio.cacs.louisiana.edu/resources/linux/glut.zip
£¨2£©½«glut.zip½âѹ£º
unzip glut.zip
½âѹºó£¬ÀïÃæÓÐÒ»¸örpm°²×°°ü£¬Ò»¸ö²âÊÔÎļþ£¬Ò»¸öglut.h,Ò»¸ömakefile, Õ⼸¸öÎļþ¶¼·Ç³£ÖØÒª¡£
£¨3£©°²×°£º
rpm -i glut-3.7-8.i386. ......
ʹÓùý³ÌÖеÄÐĵãº
Ò»¡¢½â³ýĿ¼ӳÉä¹ØÏµ
umount Ŀ¼¿ÉÒÔ½â³ý¹ØÁª¹ØÏµ
±ØÐëÏÈÔÚ¿Í»§¶Ëumount£¬È»ºóÔÚ·þÎñÆ÷¶ËÍ£Ö¹nfs·þÎñ£¬ÒÔ¼°ÐÞ¸Ä/etc/exports£¬·ñÔòµÄ»°»áµ¼ÖÂdf -hÎÞ·¨¹Ø±Õ
¶þ¡¢mount.nfs: Input/output error
½â¾ö:ÔÚ¿Í»§¶ËÒ²ÐèÆô¶¯portmap
Èý¡¢ÐÞ¸ÄÍê±Ï/etc/exportsÎļþÖ®ºó£¬¿ÉÒÔÖØÆônfs·þÎñ£¬Ò²¿ÉÒÔʹÓÃexp ......