下载udev-126.tar.xz
下载的网址为: https://mirrors.edge.kernel.org/pub/linux/utils/kernel/hotplug/
解压文件并且编译
#tar -xvf udev-.tar.xz
# cd udev-
# mkdir build
# vim config.sub
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | \
| a29k \
| alpha | alphaev[-] | alphaev56 | alphaev6[] | alphapca5[] \
| alpha64 | alpha64ev[-] | alpha64ev56 | alpha64ev6[] | alpha64pca5[] \
| am33_2. \
| arc | arm | arm[bl]e | arme[lb] | armv[] | armv[][lb] | avr | avr32 | aarch64 \ ###添加“aarch64”防止configure时出错
| bfin \
| c4x | clipper \
#./configure --prefix=/tmp/udev/udev-/build --target=aarch64-linux-gnu --host=aarch64-linux-gnu --build=x86_64-linux-gnu CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar
# make & make install
make编译时报错:
解决方法:
# vim udevd.c
logging_init("udevd-event");
setpriority(EINPROGRESS, , UDEV_PRIORITY);
.................
/* set scheduling priority for the daemon */
setpriority(EINPROGRESS, , UDEVD_PRIORITY); 将 setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY)
改为 setpriority(EINPROGRESS, 0, UDEVD_PRIORITY);
重新编译
编译完成后将 /tmp/udev/udev-126/build/ 目录下的所有文件移植到ARM板,启动udev进程
# /usr/sbin/udevd
# ps -elf |grep udev
root : /usr/sbin/udevd
root : grep udev
查到进程已经启动,写一些udev规则验证一下
# udevd --debug
[] init_udevd_socket: bind failed: Address already in use
another udev daemon already running
[] main: another udev daemon already running
# udevadm test /sys/class/net/eth0
This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run. parse_file: reading '/etc/udev/rules.d/11-add-usb.rules' as rules file
udevtest: run: '/bin/bash /mnt/system/udev/usb.sh'