linux driver 課程
httpss://technote.thispage.me/index.php/2016/12/20/ubuntu-16-04-kernel-compile-on-default-setting/
$ sudo su
# apt-get update
# apt-get source linux-image-$(uname -r)
# cd linux-lts-xenial-4.4.0/
# cp /boot/config-4.4.0-31-generic .config
# ls -al
# apt-get install kernel-package
# make menuconfig
# make-kpkg -j2 –initrd –append-to-version=–test-kernel kernel_image
$ sudo apt-get install ssh
Linux API 文件
httpsss://www.kernel.org/doc/htmldocs/kernel-api/index.html
常見的編譯錯誤:
- error: implicit declaration of function ‘kfree
添加#include <linux/slab.h> - error: implicit declaration of function ‘create_proc_read_entry’
加上#include <linux/proc_fs.h> (沒用) - error: ‘struct tty_driver’ has no member named ‘write’
請看 httpsss://ithelp.ithome.com.tw/articles/10161491 - unrecognized ELF data encoding 101:
- CFLAGS it to use ccflags-y Stop
ccflags-y - implicit declaration of function ‘mdelay’
#include <linux/delay.h>