8,367
edits
Changes
→Compile device driver
<br>
Copy the OrangePi_misc.c to the */lichee/linux-3.4/driver/misc directory:<br>
<div style="padding-left:200px;">[[文件:Orange-pi-pc2-img83.png|800px]]</div>
<br>
Enter to */lichee/linux-3.4/drivers/misc/<br>
<div style="padding-left:200px;">[[文件:Orange-pi-pc2-img84.png|800px]]</div>
<br>
Modify Makefile on currently file, shown as following:
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img53.png|800px]]</div>
<br>
There is Kconfig on the same sibling folders with Makefile. Each Kconfig respectively describes the the source directory file related kernel configuration menu. In the kernel configuration making menuconfig, it read from the Kconfig config menu and the user configuration saved to the config. In the kernel compile, the main Makefile by calling this.Config could know the user's configuration of the kernel.<br>
Kconfig is corresponding to the kernel configuration menu. Add a new driver to the kernel source code, you can modify the Kconfig to increase the configuration menu for your drive, so you can choose whether the menuconfig driver was compiled or not.
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img54.png|800px]]</div>
<br>
Back to the source code directory:<br>
<div style="padding-left:200px;">[[文件:Orange-pi-pc2-img85.png|800px]]</div>
<br>
$ ./build.sh<br>
After compiled the kernel, there will be an orangepi_misc.ko file generated on the directory of lichee/linux-3.4/output/lib/modules/3.4.41<br>
<div style="padding-left:200px;">[[文件:Orange-pi-pc2-img86.png|800px]]</div>
<br>
There is a .ko module which generated after compiled of OrangePi_misc.c on */lichee/linux-3.4/output/lib/modules/3.4.39/
<div style="padding-left:200px;">[[文件:Orange-pi-pc2-img87.png|800px]]</div>
<br>
Insert U disk (please note the SD card should have been written image) if the SD card system is mounted to the directory / dev / SDB, SD card will have two sub mount points, respectively are / dev / sdb1 and /dev/sdb2. Two partition of SD card will automatically mount to the PC /media/ directory, the first partition is the boot partition and the second partition is the rootfs partition.
<div style="padding-left:200px;">[[文件:Orange-pi-i96-img55.png|800px]]</div>
<br>
Copy the OrangePi_misc.ko file to /media/*/lib/modules/3.4.39.