下载udev-126.tar.xz
下载的网址为: https://mirrors.edge.kernel.org/pub/linux/utils/kernel/hotplug/
解压文件并且编译
#tar -xvf udev-126.tar.xz # cd udev-126 # 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 | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 | aarch64 \ ###添加“aarch64”防止configure时出错
| bfin \
| c4x | clipper \
#./configure --prefix=/tmp/udev/udev-126/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 248 logging_init("udevd-event"); 249 setpriority(EINPROGRESS, 0, UDEV_PRIORITY); ................. 1110 /* set scheduling priority for the daemon */ 1111 setpriority(EINPROGRESS, 0, 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 399 root 0:02 /usr/sbin/udevd 986 root 0:00 grep udev
查到进程已经启动,写一些udev规则验证一下
# udevd --debug [1090] init_udevd_socket: bind failed: Address already in use another udev daemon already running [1090] 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'
努力成为一名优秀的工程师