{"id":266943,"date":"2023-03-13T06:07:34","date_gmt":"2023-03-12T22:07:34","guid":{"rendered":"https:\/\/lrxjmw.cn\/zfsbqdccqsbh.html"},"modified":"2023-03-13T06:07:34","modified_gmt":"2023-03-12T22:07:34","slug":"zfsbqdccqsbh","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zfsbqdccqsbh.html","title":{"rendered":"\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u5b58\u50a8\u5668\u8bbe\u5907\u53f7\u7684\u64cd\u4f5c\u51fd\u6570\u7528\u4e8eLinux"},"content":{"rendered":"

\u4e00\u3001\u9a71\u52a8\u5206\u7c7b<\/p>\n

Linux<\/a>\u4e2d\u5305\u542b\u4e09\u5927\u7c7b\u9a71\u52a8\uff1a\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u3001\u5757\u8bbe\u5907\u9a71\u52a8\u548c\u7f51\u8def\u8bbe\u5907\u9a71\u52a8\u3002\u5176\u4e2d\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u662f\u6700\u5927\u7684\u4e00\u7c7b\u9a71\u52a8\uff0c\u7531\u4e8e\u5b57\u7b26\u8bbe\u5907\u6700\u591a\uff0c\u4eceled\u5230I2C\u3001SPI\u3001\u97f3\u9891\u7b49\u90fd\u5c5e\u4e8e\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u3002\u5757\u8bbe\u5907\u9a71\u52a8\u548c\u7f51\u8def\u8bbe\u5907\u9a71\u52a8\u90fd\u8981\u6bd4\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u590d\u6742\u3002\u7531\u4e8e\u5176\u6bd4\u8f83\u590d\u6742\uff0c\u6240\u4ee5\u534a\u5bfc\u4f53\u5382\u5546\u90fd\u65e9\u5df2\u5e2e\u6211\u4eec\u5199\u597d\u4e86\uff0c\u5927\u90e8\u4efd\u60c5\u51b5\u4e0b\u90fd\u662f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7684\u3002\u6240\u8c13\u7684\u5757\u8bbe\u5907\u9a71\u52a8\u5c31\u662f\u50a8\u5b58\u5668\u8bbe\u5907\u7684\u9a71\u52a8\uff0c\u4f8b\u5982EMMC\u3001NAND\u3001SD\u5361\u548cU\u76d8\u7b49\u50a8\u5b58\u8bbe\u5907<\/p>\n

\u4e8c\u3001\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u5f00\u53d1<\/p>\n

\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u662fLinux\u9a71\u52a8\u4e2d\u6700\u57fa\u672c\u7684\u4e00\u7c7b\u8bbe\u5907\u9a71\u52a8\uff0c\u5b57\u7b26\u8bbe\u5907\u5c31\u662f\u4e00\u4e2a\u4e00\u4e2a\u5b57\u8282\uff0c\u6839\u636e\u5b57\u8282\u6d41\u8fdb\u884c\u8bfb\u5199\u64cd\u4f5c\u7684\u8bbe\u5907\uff0c\u8bfb\u5199\u6570\u636e\u662f\u5206\u5148\u540e\u6b21\u5e8f\u7684\u3002\u6211\u4eec\u5148\u6765\u4e86\u89e3Linux\u4e0b\u7684\u5e94\u7528\u7a0b\u5e8f\u662f\u600e\u6837\u8c03\u7528\u9a71\u52a8\u7a0b\u5e8f\u7684\uff0c\u5982\u53f3\u56fe\uff1a<\/p>\n

\u5e94\u7528\u7a0b\u5e8f\u8fd0\u884c\u5728\u7528\u6237\u7a7a\u95f4\uff0c\u800cLinux\u9a71\u52a8\u5c5e\u4e8e\u5185\u6838\u7684\u4e00\u90e8\u4efd\uff0c\u56e0\u800c\u9a71\u52a8\u8fd0\u884c\u4e8e\u5185\u6838\u7a7a\u95f4\u3002open\u3001close\u3001write\u548cread\u7b49\u8fd9\u79cd\u51fd\u6570\u662f\u7531C\u5e93\u63d0\u4f9b\u7684\uff0c\u5728LInux\u7cfb\u7edf<\/a>\u4e2d\uff0c\u7cfb\u7edf\u8c03\u7528\u4f5c\u4e3aC\u5e93\u7684\u4e00\u90e8\u4efd\u3002<\/p>\n

\u4e09\u3001Linux\u8bbe\u5907\u53f71\u3001\u8bbe\u5907\u597d\u7684\u7ec4\u6210<\/p>\n

\u4e3a\u4e86\u4fbf\u6377\u7ba1\u7406\uff0cLinux\u4e2d\u6bcf\u4f4d\u8bbe\u5907\u90fd\u6709\u4e00\u4e2a\u8bbe\u5907\u53f7red hat linux\u4e0b\u8f7d\uff0c\u8bbe\u5907\u53f7\u7531\u4e3b\u8bbe\u5907\u53f7\u548c\u6b21\u8bbe\u5907\u53f7\u4e24\u90e8\u4efd\u7ec4\u6210\uff0c\u4e3b\u8bbe\u5907\u53f7\u8868\u793a\u67d0\u4e00\u4e2a\u5177\u4f53\u7684\u9a71\u52a8\uff0c\u6b21\u8bbe\u5907\u53f7\u8868\u793a\u4f7f\u7528\u8fd9\u4e2a\u9a71\u52a8\u7684\u5404\u4e2a\u8bbe\u5907\u3002Linux\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u4e3adev_t\u7684\u6570\u636e\u7c7b\u578b\u8868\u793a\u8bbe\u5907\u53f7\uff0cdev_t\u5b9a\u4e49\u5728include\/linux\/types.h\u4e0a\u9762\u3002dev_t\u4f3c\u4e4e\u662funsignedint\u7c7b\u578b\uff0c\u662f\u4e00\u4e2a32\u4f4d\u7684\u6570\u636e\u7c7b\u578b\u3002\u5176\u4e2d\u9ad812\u4f4d\u662f\u4e3b\u8bbe\u5907\u53f7\uff0c\u4f4e20\u4f4d\u662f\u6b21\u8bbe\u5907\u53f7\uff0c\u56e0\u800cLinux\u7cfb\u7edf\u4e2d\u4e3b\u8bbe\u5907\u53f7\u8303\u56f4\u662f0~4095<\/p>\n

\u8bbe\u5907\u53f7\u7684\u64cd\u4f5c\u51fd\u6570<\/p>\n

MAJOR\u7528\u4e8e\u4ecedev_t\u4e2d\u83b7\u53d6\u4e3b\u8bbe\u5907\u53f7\uff0c\u5c06dev_t\u53f3\u79fb20\u4f4d\u5373\u53ef<\/p>\n

MINOR\u7528\u4e8e\u4ecedev_t\u4e2d\u83b7\u53d6\u6b21\u8bbe\u5907\u53f7\uff0c\u53d6dev_t\u7684\u4f4e20\u4f4d\u5373\u53ef<\/p>\n

MKDEV\u7528\u4e8e\u5c06\u7ed9\u5b9a\u7684\u4e3b\u8bbe\u5907\u53f7\u548c\u6b21\u8bbe\u5907\u53f7\u7684\u503c\u7ec4\u5408\u6210dev_t\u7c7b\u578b\u7684\u8bbe\u5907\u53f72\u3001\u8bbe\u5907\u53f7\u7684\u5206\u914d<\/p>\n

\u9759\u6001\u8bbe\u5907\u53f7\uff1a\u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\u987b\u8981\u7ed9\u8bbe\u5907\u6307\u5b9a\u4e00\u4e2a\u8bbe\u5907\u53f7\uff0c\u8fd9\u4e2a\u8bbe\u5907\u53f7\u53ef\u4ee5\u662f\u9a71\u52a8\u5f00\u53d1\u8005\u9759\u6001\u6307\u5b9a\u7684\u8bbe\u5907\u53f7\uff0c\u7136\u800c\u8981\u6ce8\u610f\u8be5\u8bbe\u5907\u53f7\u6ca1\u6709\u88ab\u5185\u6838\u5f00\u53d1\u8005\u5206\u914d\u6389\u3002\u4f7f\u7528cat\/proc\/devices\u547d\u4ee4<\/a>\u5373\u53ef\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e2d\u65e9\u5df2\u4f7f\u7528\u7684\u8bbe\u5907\u53f7<\/p>\n

\u4f7f\u7528register_chrdev\u51fd\u6570\u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\u7684\u65f6\u4faf\u53ea\u987b\u8981\u7ed9\u5b9a\u4e00\u4e2a\u4e3b\u8bbe\u5907\u53f7\u5373\u53ef<\/p>\n

\n

\/* \u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8 *\/\nretvalue = register_chrdev(CHRDEVBASE_MAJOR, CHRDEVBASE_NAME, &chrdevbase_fops);<\/code><\/pre>\n<\/p>\n

\u8fd9\u662f\u8001\u7248\u672c\u5b57\u7b26\u8bbe\u5907\u6ce8\u518c\u51fd\u6570\uff0c\u51760~1048575\uff082^20-1\uff09\u8fd9\u4e2a\u533a\u95f4\u7684\u6b21\u8bbe\u5907\u53f7\u5168\u90e8\u8bbe\u7f6e\u4e3a0<\/p>\n

\u52a8\u6001\u5206\u914d\u8bbe\u5907\u53f7\uff1a\u4f7f\u7528\u8bbe\u5907\u53f7\u7684\u65f6\u4faf\u5411linux\u5185\u6838\u7533\u8bf7linux\u8bbe\u5907\u9a71\u52a8\u5f00\u53d1\u8be6\u89e3 \u7b2c\u4e09\u7248<\/strong>\uff0c\u987b\u8981\u51e0\u4e2a\u5c31\u7533\u8bf7\u51e0\u4e2a\uff0c\u7531linux\u5185\u6838\u5206\u914d\u8bbe\u5907\u53ef\u4ee5\u4f7f\u7528\u7684\u8bbe\u5907\u53f7\u3002\u5728\u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\u4e4b\u524d\u5148\u7533\u8bf7\u4e00\u4e2a\u8bbe\u5907\u53f7\uff0c\u7cfb\u7edf\u4f1a\u624b\u52a8\u7ed9\u4f60\u4e00\u4e2a\u6ca1\u6709\u88ab\u4f7f\u7528\u7684\u8bbe\u5907\u53f7\uff0c\u8fd9\u6837\u5c31\u9632\u6b62\u4e86\u51b2\u7a81\uff0c\u5378\u8f7d\u9a71\u52a8\u7684\u65f6\u4faf\u91ca\u653e\u6389\u8fd9\u4e2a\u8bbe\u5907\u53f7\u5373\u53ef<\/p>\n

\n

int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count, const char *name)<\/code><\/pre>\n<\/p>\n

dev\uff1a\u4fdd\u5b58\u7533\u8bf7\u5230\u7684\u8bbe\u5907\u53f7<\/p>\n

baseminor\uff1a\u6b21\u8bbe\u5907\u53f7\u8d77\u59cb\u5730\u5740\uff0calloc_chrdev_region\u53ef\u4ee5\u7533\u8bf7\u4e00\u6bb5\u8fde\u7eed\u7684\u591a\u4e2a\u8bbe\u5907\u53f7\uff0c\u8fd9\u79cd\u8bbe\u5907\u597d\u7684\u4e3b\u8bbe\u5907\u53f7\u4e00\u6837\uff0c\u800c\u4e14\u6b21\u8bbe\u5907\u53f7\u4e0d\u540c\uff0c\u6b21\u8bbe\u5907\u53f7\u4ee5baseminor\u4e3a\u8d77\u59cb\u5730\u5740\u5f00\u59cb\u9012\u589e\u3002\u901a\u5e38baseminor\u4e3a0\uff0c\u4e5f\u5c31\u662f\u6b21\u8bbe\u5907\u53f7\u4ece0\u5f00\u59cb<\/p>\n

count\uff1a\u8981\u7533\u8bf7\u7684\u8bbe\u5907\u53f7\u6570\u76ee<\/p>\n

name\uff1a\u8bbe\u522b\u540d\u5b50<\/p>\n

\u5018\u82e5\u7ed9\u5b9a\u4e86\u8bbe\u5907\u7684\u4e3b\u8bbe\u5907\u53f7\u548c\u6b21\u8bbe\u5907\u53f7\u5c31\u4f7f\u7528\u5982\u4e0b\u6240\u793a\u51fd\u6570\u6765\u6ce8\u518c\u8bbe\u5907\u53f7<\/p>\n

intregister_chrdev_region(dev_tfrom,unsignedcount,constchar*name)<\/p>\n

\u53c2\u6570from\u662f\u8981\u7533\u8bf7\u7684\u8d77\u59cb\u8bbe\u5907\u53f7\uff0c\u4e5f\u5c31\u662f\u7ed9\u5b9a\u7684\u8bbe\u5907\u53f7<\/p>\n

\u53c2\u6570count\u662f\u8981\u7533\u8bf7\u7684\u6570\u76ee\uff0c\u901a\u5e38\u90fd\u662f\u4e00\u4e2a<\/p>\n

\u53c2\u6570name\u662f\u8bbe\u5907\u540d\u5b50<\/p>\n

\u901a\u5e38\u91c7\u7528\u52a8\u6001\u5206\u914d\u8bbe\u5907\u53f7\uff0c\u6a21\u677f\u5982\u4e0b<\/p>\n

\n

\/* \u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8 *\/\n\/* 1\u3001\u521b\u5efa\u8bbe\u5907\u53f7 *\/\nif (newchrled.major) \n{        \n    \/*  \u5b9a\u4e49\u4e86\u8bbe\u5907\u53f7 *\/\n    newchrled.devid = MKDEV(newchrled.major, 0);\n    register_chrdev_region(newchrled.devid, NEWCHRLED_CNT, NEWCHRLED_NAME);\n} \nelse \n{        \n    \/* \u6ca1\u6709\u5b9a\u4e49\u8bbe\u5907\u53f7 *\/\n    alloc_chrdev_region(&newchrled.devid, 0, NEWCHRLED_CNT, NEWCHRLED_NAME);    \/* \u7533\u8bf7\u8bbe\u5907\u53f7 *\/\n    newchrled.major = MAJOR(newchrled.devid);    \/* \u83b7\u53d6\u5206\u914d\u53f7\u7684\u4e3b\u8bbe\u5907\u53f7 *\/\n    newchrled.minor = MINOR(newchrled.devid);    \/* \u83b7\u53d6\u5206\u914d\u53f7\u7684\u6b21\u8bbe\u5907\u53f7 *\/\n}\nprintk(\"newcheled major=%d,minor=%drn\",newchrled.major, newchrled.minor);    <\/code><\/pre>\n<\/p>\n

\u6ce8\u9500\u8bbe\u5907\u53f7<\/p>\n

\n

void unregister_chrdev_region(dev_t from, unsigned count)<\/code><\/pre>\n<\/p>\n

\u56db\u3001\u6a21\u5757\u6ce8\u518c\u4e0e\u5378\u8f7d<\/p>\n

Linux\u9a71\u52a8\u6709\u4e24\u79cd\u8fd0\u884c\u65b9\u6cd5\uff0c\u7b2c\u4e00\u79cd\u662f\u5c06\u9a71\u52a8\u7f16\u8bd1\u8fdbLinux\u5185\u6838\u4e2d\uff0c\u5f53Linux\u5185\u6838\u542f\u52a8\u7684\u65f6\u4faf\u624d\u4f1a\u624b\u52a8\u8fd0\u884c\u9a71\u52a8\u7a0b\u5e8f\u3002\u7b2c\u4e8c\u79cd\u662f\u5c06\u9a71\u52a8\u7f16\u64b0\u6210\u6a21\u5757(Linux\u4e0b\u6a21\u5757\u6269\u5145\u540d\u4e3ako)\uff0c\u5728Linux\u5185\u6838\u542f\u52a8\u4e4b\u540e\u4f7f\u7528\u76f8\u5e94\u547d\u4ee4\u52a0\u8f7d\u9a71\u52a8\u6a21\u5757<\/p>\n

linux\u670d\u52a1\u7aef\u5f00\u53d1\u5168\u9762\u8be6\u89e3_linux qt gui\u5f00\u53d1\u8be6\u89e3_linux\u8bbe\u5907\u9a71\u52a8\u5f00\u53d1\u8be6\u89e3 \u7b2c\u4e09\u7248<\/p>\n

\u6a21\u5757\u6709\u52a0\u8f7d\u548c\u5378\u8f7d\u4e24\u79cd\u64cd\u4f5carm linux\uff0c\u6a21\u5757\u7684\u52a0\u8f7d\u548c\u5378\u8f7d\u6ce8\u518c\u51fd\u6570\u5982\u4e0b<\/p>\n

\n

module_init(xxx_init); \/\/\u6ce8\u518c\u6a21\u5757\u52a0\u8f7d\u51fd\u6570\nmodule_exit(xxx_exit); \/\/\u6ce8\u518c\u6a21\u5757\u5378\u8f7d\u51fd\u6570<\/code><\/pre>\n<\/p>\n

module_init\u51fd\u6570\u6765\u5411Linux\u5185\u6838\u6ce8\u518c\u4e00\u4e2a\u6a21\u5757\u52a0\u8f7d\u51fd\u6570\uff0c\u53c2\u6570xxx_init\u5c31\u662f\u987b\u8981\u6ce8\u518c\u7684\u5177\u4f53\u51fd\u6570\uff0c\u5f53\u4f7f\u7528insmod\u547d\u4ee4\u52a0\u8f7d\u9a71\u52a8\u7684\u65f6\u4faf\uff0cxxx_init\u8fd9\u4e2a\u51fd\u6570\u624d\u4f1a\u88ab\u8c03\u7528<\/p>\n

module_exit\u51fd\u6570\u62ff\u6765\u5411Linux\u5185\u6838\u6ce8\u518c\u4e00\u4e2a\u6a21\u5757\u5378\u8f7d\u51fd\u6570\uff0c\u53c2\u6570xxx_exit\u5c31\u662f\u987b\u8981\u6ce8\u518c\u7684\u51fd\u6570\uff0c\u5f53\u4f7f\u7528rmmod\u547d\u4ee4\u5378\u8f7d\u9a71\u52a8\u7684\u65f6\u4fafxxx_exit\u624d\u4f1a\u88ab\u8c03\u7528<\/p>\n

\u4e94\u3001\u5b57\u7b26\u8bbe\u5907\u6ce8\u518c\u4e0e\u6ce8\u9500<\/p>\n

\u5f53\u9a71\u52a8\u6a21\u5757\u52a0\u8f7d\u6210\u529f\u987b\u8981\u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\uff0c\u5378\u8f7d\u9a71\u52a8\u6a21\u5757\u7684\u65f6\u4faf\u4e5f\u987b\u8981\u6ce8\u9500\u6389\u5b57\u7b26\u8bbe\u5907<\/p>\n

\n

static inline int register_chrdev(unsigned int major, const char *name,const struct file_operations *fops)\nstatic inline void unregister_chrdev(unsigned int major, const char *name)<\/code><\/pre>\n<\/p>\n

register_chrdev\u51fd\u6570\u7528\u4e8e\u6ce8\u518c\u5b57\u7b26\u8bbe\u5907\uff0cunregister_chrdev\u6ce8\u9500\u6389\u5b57\u7b26\u8bbe\u5907<\/p>\n

\u901a\u5e38\u5b57\u7b26\u8bbe\u5907\u7684\u6ce8\u518c\u5728\u9a71\u52a8\u6a21\u5757\u7684\u5165\u53e3\u51fd\u6570xxx_init\u4e2d\u8fdb\u884c\uff0c\u5b57\u7b26\u8bbe\u5907\u7684\u6ce8\u9500\u5728\u9a71\u52a8\u6a21\u5757\u7684\u51fa\u53e3\u51fd\u6570xxx_exit\u8fdb\u884c<\/p>\n

\u516d\u3001LICENSE\u548c\u4f5c\u8005\u4fe1\u606f<\/p>\n

\u5728\u9a71\u52a8\u4e2d\u52a0\u5982LICENSE\u548c\u4f5c\u8005\u4fe1\u606f\uff0c\u5176\u4e2dLICENSE\u662f\u5fc5\u987b\u6dfb\u52a0\u7684\uff0c\u5426\u5219\u7684\u8bdd\u7f16\u8bd1\u4f1a\u62a5\u9519\uff0c\u4f5c\u8005\u4fe1\u606f\u53ef\u4ee5\u4e0d\u6dfb\u52a0<\/p>\n

\n

MODULE_LICENSE(\"GPL\") \/\/\u6dfb\u52a0\u6a21\u5757 LICENSE \u4fe1\u606f ,LICENSE \u91c7\u7528 GPL \u534f\u8bae\nMODULE_AUTHOR(\"mingfei\") \/\/\u6dfb\u52a0\u6a21\u5757\u4f5c\u8005\u4fe1\u606f<\/code><\/pre>\n<\/p>\n

\u4e03\u3001\u6d4b\u8bd5\u6307\u4ee41\u3001\u52a0\u8f7d\u9a71\u52a8\u6a21\u5757<\/p>\n

\u9a71\u52a8\u6a21\u5757\u901a\u5e38\u6302\u8f7d\u5728lib\/modules\/4.1.15\u76ee\u5f55\u4e0b\uff0c\u6240\u4ee5\u987b\u8981\u7f16\u64b0\u7684\u9a71\u52a8\u6a21\u5757\u548c\u6d4b\u8bd5\u8f6f\u4ef6\u590d\u5236\u5230\u6839\u6587\u4ef6\u7cfb\u7edfrootfs\/lib\/modules\/4.1.15\u76ee\u5f55\u4e0b\uff0c\u901a\u8fc7tftfp\u548cnfs\u542f\u52a8\u540e\uff0c\u5728\u5f00\u53d1\u677f\u7684lib\/modules\/4.1.15\u76ee\u5f55\u4e0b\u5b58\u5728\u9a71\u52a8\u6a21\u5757\u548c\u6d4b\u8bd5\u8f6f\u4ef6<\/p>\n

\u9a71\u52a8\u7f16\u8bd1\u5b8c\u6210\u4e4b\u540e\u6269\u5145\u540d\u662f.kolinux\u8bbe\u5907\u9a71\u52a8\u5f00\u53d1\u8be6\u89e3 \u7b2c\u4e09\u7248<\/strong>\uff0c\u6709\u4e24\u79cd\u547d\u4ee4\u53ef\u4ee5\u52a0\u8f7d\u6a21\u5757\uff1ainsmod\u548cmodprobe<\/p>\n

\u52a0\u8f7d\u9a71\u52a8\u6a21\u5757<\/p>\n

insmodxxx.ko<\/p>\n

modprobexxx.ko<\/p>\n

insmod\u4e0d\u80fd\u89e3\u51b3\u6a21\u5757\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u4f8b\u5982drv.ko\u4f9d\u8d56first.ko\u8fd9\u4e2a\u6a21\u5757\uff0c\u5c31\u5fc5\u987b\u5148\u4f7f\u7528insmod\u547d\u4ee4\u52a0\u8f7dfirst.ko\u8fd9\u4e2a\u6a21\u5757\uff0c\u4e4b\u540e\u518d\u52a0\u8f7ddrv.ko\u8fd9\u4e2a\u6a21\u5757<\/p>\n

\u7136\u800cmodprobe\u5c31\u4e0d\u4f1a\u5b58\u5728\u8fd9\u6837\u7684\u95ee\u9898\uff0cmodprobe\u4f1a\u5256\u6790\u6a21\u5757\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u4e4b\u540e\u4f1a\u5c06\u6240\u6709\u7684\u4f9d\u8d56\u6a21\u5757\u90fd\u52a0\u8f7d\u5230\u5185\u6838\u4e2d<\/p>\n

\u82e5modprobe\u63d0\u793a\u672a\u80fd\u6253\u5f00modules.dep\uff0c\u9a71\u52a8\u6302\u8f7d\u5931\u8d25\uff0c\u8f93\u5165depmod\u5373\u53ef\u624b\u52a8\u751f\u6210modules.dep<\/p>\n

2\u3001\u521b\u5efa\u8bbe\u5907\u8282\u70b9\u6587\u4ef6<\/p>\n

\u9a71\u52a8\u52a0\u8f7d\u6210\u529f\u987b\u8981\u5728\/dev\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u4e0e\u4e4b\u5bf9\u5e94\u8bbe\u5907\u8282\u70b9\u6587\u4ef6\uff0c\u5e94\u7528\u7a0b\u5e8f\u5c31\u662f\u901a\u8fc7\u64cd\u4f5c\u8bbe\u5907\u8282\u70b9\u6587\u4ef6\u6765\u5b8c\u6210\u5bf9\u5177\u4f53\u8bbe\u5907\u7684\u64cd\u4f5c<\/p>\n

\u521b\u5efa\/dev\/chrdev\u8bbe\u5907\u8282\u70b9\u6587\u4ef6<\/p>\n

mknod\/dev\/chrdevc2000<\/p>\n

mknod:\u521b\u5efa\u8282\u70b9\u547d\u4ee4<\/p>\n

\/dev\/chrdev\uff1a\u8981\u521b\u5efa\u7684\u8282\u70b9\u6587\u4ef6<\/p>\n

c\uff1a\u5b57\u7b26\u8bbe\u5907<\/p>\n

2000\uff1a\u8bbe\u5907\u7684\u4e3b\u8bbe\u5907\u53f7\u548c\u6b21\u8bbe\u5907\u53f7<\/p>\n

\u521b\u5efa\u5b8c\u6210\u4e4b\u540e\u624d\u4f1a\u5b58\u5728\/dev\/chrdev\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528ls\/dev\/chrdev-l\u547d\u4ee4\u67e5\u770b<\/p>\n

3\u3001\u8bbe\u5907\u6d4b\u8bd5<\/p>\n

\u8fd0\u884c\u6d4b\u8bd5\u7a0b\u5e8f<\/p>\n

.\/xxx(\u7a0b\u5e8f)\u53c2\u65701\u53c2\u65702...(\u53c2\u6570\u4f20\u7ed9\u5e94\u7528\u5c42\u7684main\u51fd\u6570)<\/p>\n

.\/chrdevbaseApp\/dev\/chrdevbase1\/\/\u8bf8\u5982\u6d4b\u8bd5\u5bf9chrdevbase\u8bbe\u5907\u7684\u5199\u64cd\u4f5c4\u3001\u5378\u8f7d\u9a71\u52a8\u6a21\u5757rmmodxxx.ko<\/p>\n

\u5378\u8f7d\u540e\u53ef\u4ee5\u4f7f\u7528lsmod\u67e5\u770b\u5378\u8f7d\u6a21\u5757\u662f\u5426\u6210\u529f<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e8c\u3001\u5b57\u7b26\u8bbe\u5907\u9a71\u52a8\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u8fd0\u884c\u5728\u7528\u6237\u7a7a\u95f4\uff0c\u800cLinux\u9a71\u52a8\u5c5e\u4e8e\u5185\u6838\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u9a71\u52a8\u8fd0\u884c\u4e8e\u5185\u6838\u7a7a\u95f4\u300215\u76ee\u5f55\u4e0b\uff0c\u6240\u4ee5\u9700\u8981\u7f16\u5199\u7684\u9a71\u52a8\u6a21\u5757\u548c\u6d4b\u8bd5\u8f6f\u4ef6\u590d\u5236\u5230\u6839\u6587\u4ef6\u7cfb\u7edfrootfs\/lib\/modules\/4.15\u76ee\u5f55\u4e0b\u5b58\u5728\u9a71\u52a8\u6a21\u5757\u548c\u6d4b\u8bd5\u8f6f\u4ef6\u9a71\u52a8\u52a0\u8f7d\u6210\u529f\u9700\u8981\u5728\/dev\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u4e0e\u4e4b\u5bf9\u5e94\u8bbe\u5907\u8282\u70b9\u6587\u4ef6\uff0c\u5e94\u7528\u7a0b\u5e8f\u5c31\u662f\u901a\u8fc7\u64cd\u4f5c\u8bbe\u5907\u8282\u70b9\u6587\u4ef6\u6765\u5b8c\u6210\u5bf9\u5177\u4f53\u8bbe\u5907\u7684\u64cd\u4f5c<\/p>\n","protected":false},"author":1,"featured_media":266945,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-266943","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/266943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=266943"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/266943\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/266945"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=266943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=266943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=266943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}