Linux 初學者, 對這邊核心程式的編譯方式一定會被搞瘋掉
有時間再寫一篇 udevadm 移殖到Eclipse中 Debug的流程
The options used usually look like:
# mkdir udev
# cd udev
# git clone git://git.kernel.org/pub/scm/linux/hotplug/udev.git git
# cd git# apt-get install gtk-doc-tools
# ./autogen.sh --without-selinux --disable-extras --disable-introspection
# ./configure CFLAGS='-g -O1' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --with-selinux --enable-gtk-doc --with-rootprefix= --with-rootlibdir=/lib --bindir=/sbin --libexecdir=/lib --with-systemdsystemunitdir=/lib/systemd/system
checking for BLKID... no
configure: error: Package requirements (blkid >= 2.20) were not met:
No package 'blkid' found
No blkid, need install libblkid-dev
# apt-get install libblkid-dev
# ./configure CFLAGS='-g -O1' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --with-selinux --enable-gtk-doc --with-rootprefix= --with-rootlibdir=/lib --bindir=/sbin --libexecdir=/lib --with-systemdsystemunitdir=/lib/systemd/system
checking for KMOD... no configure: error: Package requirements (libkmod >= 5) were not met: No package 'libkmod' found
No 'libkmod', Need install libkmod-dev# apt-get install libkmod-dev
# apt-get install libselinux-dev
# apt-get install libglib2.0-dev
# apt-get install libgirepository1.0-dev
# apt-get install gperf
# ./configure CFLAGS='-g -O1' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --with-selinux --enable-gtk-doc --with-rootprefix= --with-rootlibdir=/lib --bindir=/sbin --libexecdir=/lib --with-systemdsystemunitdir=/lib/systemd/system
configure 完成, 會在目錄下發現一個 makefile 檔案!
可以開始進行 gcc make 動作
# make
編譯出現錯誤, 原來這個 mq_getattr 很久以前的功能,可以直接作廢.
# gedit /root/udev/git/src/sd-daemon.c
comment it out line 394 & 395
// if (mq_getattr(fd, &attr) < 0)
// return -errno;
重新作執行一次 gcc make 動作# make
# ./udevadm --version
182
請參考 Ubuntu udevadm用法
# ./udevadm info -q all -n /dev/sda | grep DEVPATH
可以使用 udevadm監控Hot Plug的狀態
沒有留言:
張貼留言