Android and linux use device drivers to access hardware devices. device node files are logical files of device drivers. Applications Use device node files to access device drivers, in linux, mknod is used to create device node files. Android has its own method. Android uses the Init process to create a device node file. There are two scenarios: static node file and dynamic node file to deal with the hot swapping device that has been defined after cold plugging and system running. For cold plugging devices, the init process obtains the drivers waiting for the cold plugging process in advance, and defines the device node file (in android_source_code/system/core/init/devices. c). The device node name is listed in struct perms_devices. Access permission, user ID, and group ID. To add a new user-defined device, you must add information about the weight of the device. Init first calls the device_init () function, creates a socket to receive uevent, and then calls do_coldboot () through cold_boot () perform cold Plugging for the driver registered under/sys during kernel startup. do_coldboot starts uevent, receives uevent information in handler_device_fd (), and writes it to uevent struct, call handle_device_event () to create a node file. First, create all subdirectories and then call make_device () to create a node file. Init uses event processing loops for hot-swappable dynamic devices. It uses poll () to listen to uevents from the driver and then calls handle_device_fd () to create a device node.