2019年7月19日 星期五

Yocto修改內核源碼筆記

怕忘記 留個筆記
先下載poky linux
git clone -b thud git://git.yoctoproject.org/poky poky_thud
cd poky_thud
進入標準開發環境
source oe-init-build-env
接下來就是重點,進入編輯模式
bitbake -c devshell virtual/kernel
做你想做的事 例如apply預先寫好patch
git apply xxx.patch
設定defconfig
bitbake -c menuconfig
如果想用本身定defconfig可以在
cat /boot/config-*
找到 但只在普通linux distro找到 至於poky linux的路徑...我忘了:P(以後再補上)
compile kernel和distro
bitbake virtual/kernel
bitbake core-image-full-cmdline
然後當然 compile完要run他
runqemu qemux86
補充: toaster project 貌似不能改kernel源碼,他用的kernel不是預設的virtual/kernel



最後記下我的小實驗:
patch:
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h
index a5eed2ade53d..33f0c3ed8a7d 100644
--- a/drivers/input/serio/i8042-io.h
+++ b/drivers/input/serio/i8042-io.h
@@ -46,14 +46,19 @@ extern int of_i8042_aux_irq;
 #define I8042_STATUS_REG 0x64
 #define I8042_DATA_REG  0x60
 
+
 static inline int i8042_read_data(void)
 {
- return inb(I8042_DATA_REG);
+ int inb_data = inb(I8042_DATA_REG);
+ printk(KERN_INFO "i8042_read_data: %d", inb_data);
+ return inb_data;
 }
 
 static inline int i8042_read_status(void)
 {
- return inb(I8042_STATUS_REG);
+ int inb_status = inb(I8042_STATUS_REG);
+ printk(KERN_INFO "i8042_read_status: %d", inb_status);
+ return inb_status;
 }
 
 static inline void i8042_write_data(int val)
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index c11556563ef0..0f2717629600 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -49,12 +49,16 @@ static int i8042_data_reg = 0x60;
 
 static inline int i8042_read_data(void)
 {
- return inb(I8042_DATA_REG);
+ int inb_data = inb(I8042_DATA_REG);
+ printk(KERN_INFO "i8042_read_data: %d", inb_data);
+ return inb_data;
 }
 
 static inline int i8042_read_status(void)
 {
- return inb(I8042_STATUS_REG);
+ int inb_status = inb(I8042_STATUS_REG);
+ printk(KERN_INFO "i8042_read_status: %d", inb_status);
+ return inb_status;
 }
 
 static inline void i8042_write_data(int val)

result:

沒有留言:

張貼留言