Sixth reading notes

Source: Internet
Author: User

2.1 General steps for writing basic Linux drivers:

1) Build Linux-powered skeleton (load and unload Linux drivers);

2) registration and cancellation of equipment documents;

3) Specify the information related to the drive;

4) Specify the callback function;

5) write business logic;

6) Writing makefile files;

7) compiling Linux drivers;

8) Install and uninstall Linux drivers.

For a Linux driver, you can start early development and testing on Ubuntu Linux. The hardware can also be simulated with software on Ubuntu Linux. When the basic development is complete, it is necessary to test the actual hardware on the Development Board or the engineering prototype. It will eventually need to be tested on the final sale of the phone.

2.2 To add the Word_count directory to the Linux kernel source tree

1) Create a new Kconfig file, create a kconfig file in the Word_count directory, and enter the following:

Config Word_count

TriState "Word_count Driver"

Default Y

Help

This is a word count driver. It can get a word count from/dev/wordcount

2) Modify the Makefile file

3) Modify the kconfig of the upper directory

SOURCE "Drivers/char/word_count/kconfig"

4) Modify the makefile file of the upper directory

obj-$ (conpig_word_count/

After modifying the Linux kernel settings and recompiling the kernel, Linux drivers that were previously compiled with the Linux kernel may not be installed due to a malformed format, so after recompiling the Linux kernel, the Linux driver module needs to be recompiled.

2.3 Linux Driver testing methods

1) Testing Linux drivers with Ubuntu Linux

2) test Linux drivers on the Android emulator via the original (Native) C program

3) Testing Linux drivers with the Android NDK

4) Use Java code to directly manipulate device files to test Linux drivers

5) test the Linux driver with the board:

Test Linux drivers on the board using an executable program

Used on the Development Board. Android NDK Test Linux Driver

Test Linux drivers on the development Board using Java code

6) Compile the driver into the Linux kernel for testing

1th step: Put the source file file into the Linux kernel source code

2nd Step: Modify the Kconfig file

3rd Step: Modify the Makefile file

4th step: Set the. config file

5th step: Compiling the Linux kernel

Sixth reading notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.