Linux, 工作, 生活, 家人

Hardware, Linux, Programming, Software

Linux 是不是應該有 Binary Driver Layer ?

最近在吵的是, The Japan OSS Promotion Forum 提出了 GKAI(General Kernel API Interface).
而跟著這個 GKAI 提出來的, 就是 Go Taniguchi, Turbolinux, Inc. Kenichi Hori, NEC Corporation. 提的 New Device Driver Structure. 這個 Structure 最大的改變就是在 Linux 上加上 Binary Driver Layer . 以便可以像是 Windows 一樣, 載入 Binary Driver ..

想當然爾, 搞 Linux kernel 的人一定不爽了, Greg Kroah就跳出來寫了一篇 OSDL and a binary kernel driver layer .

先來弄清楚兩方的訴求
GKAI

  • 在 Kernel Core 和 Device Driver 中間再加上一層 API, 而這個 API 是固定的
  • 不需要更換 Kernel 就能使用最新的 Hardware Driver
  • 每一個 Linux Distributions 都可以用同一個 Driver
  • Hardware Vendor 不需要開放原始碼
  • 減少 Programmer 的 Maintain 時程
  • Kernel developer 的意見(至少是Greg Kroah 的)

  • Binary Driver: different kernel 配上不同的 GCC 有不同的 structure, alignment 不同, 甚至支援的 architecture 也不一樣.
  • Stable Kernel Source Interface
  • 有時 Kernel Develop 會修改架構以期會有更好的效率, 而 GKAI 不可能做到.
  • Security Issue. GKAI 要是碰上了 Security 要大修還不是一樣?
  • Kernel Interface clean , 以便保持效率和精簡.
  • Kernel API 本來就是會出問題, 會有 Bug. 甚至要改名, 要修.. blah blah.
  • GKAI是 Close Source , 而且這一點也不有趣.
  • Binary Code 沒有人要幫你修, 抓 Bug, Tuning . 有問題也改不動
  • 如果站在 Linux Kernel Developer 的角度去看這件事情, 的確一點也不好玩. 而且是 Close Source. 更不要講這是違反 GPL 的.

    不過站在一個正在產業界辛苦修改 Linux Kernel 的小咖的角度, 我是傾向支持 GKAI 的出現的. 別的不說, 光是最近在處理的 IT821x 的 Device Driver 就有 n 個版本. IDE API 幾乎 2.4.18 以後, 版版都有修, 就算是 Linux kernel 2.6.x , 每一版的 IT821x 的 Driver 長得都不一樣. 讓人想回 Porting 也很難.

    之前也發生過, 某家的 SCSI Driver . Kernel 一升級, 因為 API 大變, 所以這個 Driver 就 isolated 了. 甚至連動都不能動.

    另外就是商業保護, 其實 OpenSource 也不是很難, 站在我們的角度, 95% 的 Source Code 一定會 Release 出去, 但是一定會有 5% 的 Code 會收起來, 畢竟在商言商, 這個世界是很殘酷的. Source Code Released. 別人就知道怎麼做. 馬上就組個 Team . 幹掉你了.

    小弟我曾經寫過 ITE 887x 的 Serial/Parallel Driver . 當時 Parallel 的 Maintainer 就欣然接受了我的 patch , 讓我以後就不用辛苦的多出幾版 patch .
    不過 Serial 的 maintainer 完完全全不理我. 每隔一段時間, 又多一份 patch .
    出一份 Patch 代表要重測一次, 這一點也不好玩.

    有人講的也有道理, 如果 Linux 接受了 Binary Device Driver . 大家都將 Source 留一手起來, 說不定 Linux Device Driver 不會進步這麼快, 尤其是沒有像是 MSDN 這麼豐富的線上資料庫的時候. Tracing Source Code 就成為許許多多 Linux Device Driver Programmer 最快入手的方法.

    結果是一定不會用 GKAI 的, 不過我還是希望有 GKAI 的出現, 畢竟末端 Linux Device Driver Enginner 的血淚, 不是 Kernel Developer 的大大們可以體會的呀 :~~~~

    Ref.
    The Linux Kernel Driver Interface
    OSDL and a binary kernel driver layer
    Slashdot Should Linux Have a Binary Kernel Driver Layer?
    [os_drivers] Yet Another Generic Kernel API
    A Proposal of New Device Driver Structure(OpenOffice 2.0 Presentation Format)
    Generic Kernel API Interface (GKAI)(OpenOffice.org 1.0 Presentation Format)
    Jserv’s Linux 的 Binary-form Driver

    2 留言

    1. checko

      這個跟現在很多driver module用.o 的方式release,讓使用者載入有甚麼不同?

    2. 文章作者的留言

      richliu

      用 .o 或是 .ko 的方式, 常常只能符合某一版的 kernel .
      有時用 force 也可以 load 進去, 但是若像是 2.6.9-2.6.14 之間
      每一版的 IDE Interface 實作都有變, 那就不一定能 Loading 進去.

      如果是 object file , 那用 .o 的方式 Release ,
      那 2.4.19 compile 出來的就不能放在 2.4.20 用.

    回覆留言對象 取消回覆