關於Linux下驅動程式的編譯方法

來源:互聯網
上載者:User

      驅動程式源檔案名稱:/work/driver/test.c

      驅動程式目標檔案名稱:test.ko

      核心源碼目錄:/work/linux2.6.30 這個目錄是板子源碼根目錄

      第一步:在核心源碼下(/work/linux2.6.30)輸入:make oldconfig && make prepare && make scripts

      第二部:編譯方法有兩種

                             (1)在/work/driver/目錄下 #make  -C   /work/linux2.6.30  M=$PWD modules

                             (2)在/work/driver/目錄下寫一個Makefile檔案,然後輸入make命令

obj-m :=test.oKDIR :=/work/linux2.6.30all :        make -C $(KDIR) M=$(shell pwd) modulesclean:        make -C $(KDIR) M=$(shell pwd) clean

     【聲明】由於本人水平有限,如果文章內容描述有誤,歡迎指正。email: embed001@gmail.com  QQ技術交流群:179012822     轉載請標明出處http://blog.csdn.net/embedded_hunter

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.