LinuxÉ豸Çý¶¯Ñ§Ï°£Davinci¿ª·¢°åÉÏÔËÐеÄhelloÄ£¿é
LinuxÉ豸Çý¶¯Ñ§Ï°£Davinci¿ª·¢°åÉÏÔËÐеÄhelloÄ£¿é
¿´Á˺ܶà¸öhello worldÁË£¬×Ô¼ºÀ´Ð´Ò»¸öÔÚdavinci°å¿éÉÏÅܵİɡ£
Ö÷ÌåºÜ¼òµ¥£¬¾ÍÊÇÒ»¸öCÎļþhello_davinci.c¡£
/*================hello_davinci.c==============*/
#include <linux/module.h> /*ËùÓÐÄ£¿é¶¼ÐèÒªµÄÍ·Îļþ*/
#include <linux/kernel.h>
#include <linux/init.h> /* initºÍexitÏà¹Øºê*/
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("lintax");
static int hello_init(void)
{
printk(KERN_ALERT " Hello Davinci!\n");
return 0;
}
static void hello_exit(void)
{
printk( KERN_ALERT " Goodbye, Davinci.\n ");
}
module_init(hello_init);
module_exit(hello_exit);
/*================hello_davinci.c end===========*/
¸øÆäÅä¸öMakefileÎļþ£º
/*================Makefile==================*/
obj-m := hello_davinci.o
KERNELDIR := /opt/ti-davinci/
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
/*================Makefile end===============*/
ºÃÁË£¬±àÒë°É¡£
ÎҵĺÃÐÄÇéÁ¢Âí±»ÆËÃðÁË£¬error£¬ÓÖ¼ûerror£º
˵ÕÒ²»µ½/opt/ti-davinci/include/asm/ ϵÄij¸öÍ·Îļþ£¬²éÁËһϣ¬Ã»Õâ¸öĿ¼Âµ±È»ÕÒ²»µ½ÁË¡£¼ÇµÃÒÔÇ°ÊÇ¿´¼û¹ýµÄ£¬²¢ÇÒÓëasm-armÊÇÒ»ÑùµÄ£¬Ó¦¸ÃÊDZàÒëʱ¸´ÖƵÄÒ»·Ý¡£²»ÇÉÎÒÇ°¼¸Ìì¾õµÃÓ²ÅÌ¿Õ¼äÓÐЩ²»¹»£¬¾Í°ÑºÃ¼¸¸öÄں˶¼
make cleanÁËÒ»´Î¡£ÄǾÍÔÙmakeÒ»´ÎÂok£¬Éú³ÉÁËhello_davinci.ko¡£
תÒƵ½davinci¿ª·¢°åÉÏ£¬Ö´ÐвåÈëÄ£¿éÃüÁ
insmod hello_davinci.ko
Êä³öÐÅÏ¢£º
Hello Davinci!
ͨ¹ýlsmod²é¿´£¬Ò²ÓÐÁËhello_davinci Ä£¿é¡£
È»ºóÖ´ÐÐÒƳýÄ£¿éÃüÁ
rmmod hello_davinci
Êä³öÐÅÏ¢£º
Goodbye Davinci.
ÔÙÓÃlsmodÀ´²é¿´£¬¾ÍÕÒ²»µ½hello_davinciÁË¡£
ÓÐÒÔϼ¸µãҪעÒ⣺
1£¬ËùʹÓõÄÄں˻·¾³±ØÐëÊDZàÒë¹ýµÄ£¬·ñÔò£¬¾ÍµÈ×ÅÖص¸Îҵĸ²ÕÞ°É¡£
2£¬¶ÔÓÚ±àÒë¹ý³ÌÖÐÀàËÆÓÚ£º²»ÄÜ´´½¨hello_davinci.o.tmpÎļþµÄ´íÎó¡£ËµÃ÷ȨÏÞ²»¹»£¬¿É¸ü¸Ähello_davinci.c MakefileÎļþËùÔÚĿ¼µÄÊôÐÔ£¬»òÕßÊÇsudoµ½¸ùÓû§¡£
3£¬hello_davinci.cÎļþÖе÷ÓõÄÍ·ÎļþµÄ×÷Óãº
&n
Ïà¹ØÎĵµ£º
LinuxÆô¶¯Ê±£¬µÚÒ»¸ö±ØÐë¹ÒÔصÄÊǸùÎļþϵͳ£»Èôϵͳ²»ÄÜ´ÓÖ¸¶¨É豸ÉϹÒÔظùÎļþϵͳ£¬Ôòϵͳ»á³ö´í¶øÍ˳öÆô¶¯¡£Ö®ºó¿ÉÒÔ×Ô¶¯»òÊÖ¶¯¹ÒÔØÆäËûµÄÎļþϵͳ¡£Òò´Ë£¬Ò»¸öϵͳÖпÉÒÔͬʱ´æÔÚ²»Í¬µÄÎļþϵͳ¡£²»Í¬µÄÎļþϵͳÀàÐÍÓв»Í¬µÄÌص㣬Òò¶ø¸ù¾Ý´æ´¢É豸µÄÓ²¼þÌØÐÔ¡¢ÏµÍ³ÐèÇóµÈÓв»Í¬ ......
1 ²é¿´µ±Ç°°²×°sambaûÓУ¬
ÃüÁrpm -qa | grep samba
ÓÐ3¸öÎļþÈ磺samba¡¢common¡¢clientÔò±íÃ÷³É¹¦°²×°ÁË
·ñÔò£ºÓÃÃüÁîrpm -ivh samba*.rpm°²×°sambaÈí¼þ°ü¡£
2 °²×°Íêºó¶àÊý¶¼±£´æÔÚ/etc/sambaĿ¼Ï£¬Ä¿Â¼ÏÂÓÐÒ»¸ösmb.confµÄÎļþ£¬
ËüÊÇsamba·þÎñµÄºËÐÄÎļþ£¬ËùÓÐÅäÖö¼ÔÚÕâÀïÐ޸ġ£
ÆäÖаüÀ¨smbdºÍnmbdÁ½¸ö³ ......
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <cstring>
using namespace std;
void peek_interfaces(int ......
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include<linux/config.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/errno.h>
#include<linux/sche ......
-------------------------------------------------------------------------------------------------------
//By:yuyongbao
//QQ:673360056
LINUX Äں˽ṹÌå
struct attribute
{
const char * name;
struct module &nb ......