Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎĵµ£º

ǶÈëʽLinuxϳ£ÓõĽ»²æ±àÒë·½·¨


ÒªÔÚǶÈëʽLinuxÏÂʹÓö¯Ì¬ÓïÑÔ£¬Ê×ÏÈÒª½â¾öµÄÊÇÓïÑÔ½âÊÍÆ÷»òÖ´ÐÐÒýÇæµÄ½»²æ±àÒëÎÊÌâ¡£
½»²æ±àÒëͨ³£ÓÐÒÔϼ¸ÖÖ;¾¶£º
1. Ö±½Óͨ¹ý½»²æ±àÒ빤¾ß£¬ÊÖ¹¤ÅäÖý»²æ±àÒë¡£½»²æ±àÒ빤¾ß¿ÉÒÔÀûÓÃÕâ¸ö½Å±¾À´×Ô¶¯Éú³É£º
http://kegel.com/crosstool/
´Ë·½·¨µÄºÃ´¦ÊǼò±ã¿ì½Ý£¬Ò»µ©crosstool×öºÃÒÔºó£¬ÐèҪʲô°üÖ±½Ó±àÒë¼´¿É£¬ ......

Linux Îļþϵͳ¸ÅÊö

Linux Îļþϵͳ¸ÅÊö
×÷Õߣº±±ÄÏÄϱ±
À´×Ô£ºLinuxSir.Org
ÕªÒª£º ±¾ÎÄͨ¹ýÎļþϵͳµÄ¶¨Òå˵Æð£¬È»ºóͨ¹ýÒýÎļòµ¥µÄ½éÉÜÁËÒ»ÏÂÎļþϵͳÀàÐÍ£»¶ÔLinux³£ÓõÄext2¡¢ext3¼°reiserfs ¸ù¾Ý±¾ÈËʹÓþ­ÑéÒ²·º·ºµÄ̸ÁË̸£¬µ«²¢²»ÊÇרҵµÄ¡£ÈçºÎÔĶÁ±¾ÎÄ£¬»¹ÊÇÓÃÂí¿Ë˼ÀíÂÛ¸æËßÎÒÃǵķ½·¨£ºÒ»·ÖΪ¶þ£¬±ß¿´±ßÅú°É£»Ä¿Â¼Ë÷Òý Ò»¡¢Ê²Ã´ ......

linuxËøµÄÓ¦ÓÃ

ѧ¹ý²Ù×÷ϵͳµÄÈËÖªµÀÓÐÒ»¸ö·Ç³£ÖøÃûµÄÎÊÌ⣺¶ÁÕߣ­Ð´ÕßÎÊÌâ¡£¶ÁÕߣ­Ð´ÕßÎÊÌâÊÇָϵͳµ±ÖеĵÄ×ÊÔ´ÔÚijһʱ¼äÀï¿ÉÒÔͬʱÔÊÐí¶à¸ö½ø³Ì¶Á£¬µ«Ö»ÔÊÐíÒ»¸ö½ø³Ìд¡£Õâ¸ö½ø³Ìͬ²½ÎÊÌâµÄ½â·¨ÓÐÐí¶àÖÖ£¬ÔÚwindowϵͳÀïÓû¥³â±äÁ¿À´½øÐнø³ÌµÄͬ²½¡£ÔÚLinuxÀïÓÐÁíÒ»ÖÖ·½·¨£¬ÄǾÍÊÇÎļþËø£¬ÎļþËøÀïµÄÎļþ²»µ¥µ¥Ö»Ö¸Æ½Ê±Ëù˵µÄÎļþËüÓ ......

libjpegµÄARM linuxÒÆÖ²

Ò»¡¢ÏÂÔØjpeg¿â
¶þ¡¢ÅäÖñàÒ룬Éú³ÉMakefileÎļþ¡£
#./configure --prefix=/usr/arm/arm-linux --exec-prefix=/usr/arm/arm-linux \
--enable-shared --enable-static
×¢Ò⣺prefixÊÇ×îºó°²×°Ê±¿â´æ·ÅµÄÎļþ£¬sharedÊDZàÒë³É¶¯Ì¬¿â£¬staticÊDZàÒë³É¾²Ì¬¿â
Èý¡¢ÐÞ¸ÄÉú³ÉµÄMakefile¡£
ʹÓÃgedit £Í£á£ë£å£æ£é£ì£å
½«CC ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ