Home >Computer Tutorials >Computer Knowledge >Learn how to develop Android device drivers
With the rapid development of smartphones, especially the explosive development of Android smartphones, Android driver engineer is an increasingly popular position, and it is a position that is very worth looking forward to, because you may be involved in research and development. A mobile phone can change the lives of many people, so let’s advance, Android driver ape, and how to become an excellent Android driver ape. Let me express my opinions. I hope netizens will not make mistakes easily. .
Basic knowledge of Android drivers
First of all, as an Android driver programmer, you must clearly understand what you are going to do, the basic knowledge that you need to use in daily life, and the basic framework of Android. It is still very necessary to understand the basics of programming under Linux. You need to understand, because strictly speaking, Android drivers are based on Linux drivers. I strongly recommend reading Linux Device Driver 3rd Edition. This book talks about the basic knowledge of device drivers under Linux. As an Android driver programmer, you need to be able to read it best. I understand this book, and read it over and over again, because I find that every time I re-read this book, I gain something new. This book is worth reading, and I highly recommend it with five stars; and you also need to know the basics C programming, can read and write some C programs very well, and it would be better if you also know some basic Java, because the code of the Framework layer is closely related to the code of the driver layer. If you know a little bit of Java code, you You will find that you will be more familiar with the entire driver framework, related Linux compilation scripts and Linux compilation systems. Due to some reasons for commercial development, Android's own file architecture system may be changed by some compilation scripts and add new device drivers. , you need to understand the entire driver compilation system, so that writing the driver program will be clearer!
\
Android/Linux related driver framework knowledge
In order to learn more about the technologies that Android driver programmers need to know, I have specifically listed the requirements for Android programmer recruitment by various Android driver programmers. Which company should I choose? Representatives of domestic mobile phones include ZTE, Huawei, and Coolpad. , Lenovo, Xiaomi, Meizu, and VIVO are all very good domestic mobile phone manufacturers, and the Android smartphones they develop are getting better and better. I even went to visit the emerging Android smartphone companies, including the Android driver engineers from the official website of Smartisan Mobile Phones. For recruitment needs, the official website of One Plus One does not even have a link to join us. I don’t know whether the entrepreneurial company is temporarily saturated with talents or for some reason, but there is no recruitment information. After summarizing, it is found that the difference between these companies is not particularly big. In addition to basic Android debugging capabilities, you also need to understand the driver framework of each Android module. For example, the Android driver engineer recruitment of a certain Hammer Technology requires you to try it. Smartphone claims to be making the best mobile phone. The current flagship phones are all a little better, so adding it is quite exciting! \ Android driver engineers of a certain rice company also need Android/Linux related knowledge. ZTE and Lenovo’s Android recruitment requirements are more general. It is probably because of the large companies. \ ZTE’s official website can’t find driver engineer recruitment at the beginning. , my god, it took me so much effort to find the relevant recruitment information! \
Related hardware knowledge and communication knowledge
The Android driver's usual job is to debug various peripheral devices. It is a position that directly deals with the hardware. It requires you to understand the circuit schematic diagram, basic display principles and basic camera imaging principles, etc. This is what you usually do. Basic knowledge that is very relevant to work. To make an Android smartphone, you also need to understand basic communication-related knowledge, radio frequency principles and basic Modem-related knowledge. Only by understanding relevant hardware knowledge and basic knowledge related to communication equipment can you write Only better Android drivers can produce more satisfactory debugging results!
Love driven development and continuous learning
In fact, this point is very important and should be placed first. First of all, you must like this job so that you can do better. Interest is the best teacher. This sentence is truly true. , and the current social situation is that people rush to do whatever they want to make money. As a result, they may be very unhappy in the end, and then they don’t make any money. Nowadays, many of my college classmates have given up what they have learned. There are professional counterpart jobs, some of which are selling insurance, some of which are general workers in factories, some of which are sales, and some of which are for the iron rice bowl. Of course, there are no distinctions between good and bad professions. I say this mainly to advise everyone. Go and stick to your original dream! My dream is to make a mobile terminal that can change people's lives and make the world a little bit different because of me. Children, let's stick to the dream together! In addition, being an Android driver engineer requires continuous learning and maintaining a passion at all times. Only through continuous learning can you better complete daily driver development tasks and maintain a keen sense of development. I think Steve Jobs’s: Stay Hungry, Stay foolish is very well said. It has always been regarded as my motto to inspire me to insist on being a better Android driver engineer. The purpose of writing this blog is to share some of my small opinions. I will still do it in the future. Keep updating my blog, share some documents and blogs related to driver development, and make progress together with the majority of driver apes!
You are still too far away. It is too early to talk about kernel drivers now. This learning cycle is very long.
Kernel driver programming is not a profound knowledge. It is nothing more than making code according to the system’s API and framework. It’s just that these things provide functions closer to the bottom layer, which in some cases are more beneficial to the program structure. It's just more efficient. It doesn't matter whether something is not innovative or not, it's just a matter of copying the gourd.
Where to start, the basic route is Language-》Algorithm-》Framework Mechanism & WINDOWS Program-》System Kernel Implementation, etc.
Some of the contents mentioned below all have a common premise, which is to keep writing code and debugging code, otherwise it will be in vain. I once had an operating system teacher who said, "If you read a book and ask you to do it, if you can't do it, you haven't learned it."
The first stage: Since you have mentioned a direction now, the languages of choice are naturally C and C. Both are required. Now the WINDOWS kernel is hybrid, from this perspective, both are also required. familiar. For related books, those in China can buy Tan Haoqiang’s C and C books, which are relatively short and suitable for getting started, and you can also read books like C PRIMER that explain C from the perspective of C. In order to have a solid foundation in C and C, you can read books such as EFFECTIVE C/MORE EFFECTIVE C/C Language Traps, etc., which all explain some experiences and techniques from the language level. Note that the content here does not involve a Diandian technology is just the most basic language foundation.
In order to facilitate subsequent learning, at this stage you should learn basic computer courses, data structures, computer networks, operating systems, database principles, composition principles, etc., and even some basics of advanced mathematics and discrete mathematics. This depends on your situation, it is very important and has a great impact on further development.
The second stage: WINDOWS program. Be familiar with the implementation mechanism of WINDOWS program, such as message response and event processing. You should understand how the underlying layer is implemented, not just a concept. Relevant ones include WINDOWS SDK, MFC framework, etc. Books include "WINDOWS Programming" (Microsoft's 1,300-page book, although very thick, is nothing more than a classic in this field. Of course, there are many domestic ones, but they are all The writing is relatively simple, and many places are covered in one stroke), "Insider MFC in a Simple Language", "VC Technology Insider", etc. These are books that explain the underlying implementation mechanism of MFC. They are more practical than teaching you how to drag controls. >This is to explain SOCKET. In fact, this aspect is generally covered in WINDOWS program books, but many people still don't understand it. In order to become familiar with it, it is still necessary to read it. Driver, this is just done under a fixed framework of WINDOWS, no big deal.
The third stage: kernel related. Since WINDOWS is not open source, there is no code to look at. The good thing is that a Windows-like system like REACTOS is now open source. You can look at the implementation of the code and become familiar with how the operating system runs. Many of these things involve security-related mechanisms, so you have to figure them out yourself.
In addition, you should also understand how the compiler compiles, how the linker links, how the operating system loads files, how WINDOWS manages memory, and countless other related knowledge. These will not have direct value to your program, but indirectly Infinite value. In the process of learning, you should understand some basic problem-solving methods, design patterns, etc. These things are the real technologies. I guess it will be difficult for you to do some research, but the above is enough.
Nowadays, many people want to learn systematically when they learn, but you must also understand the cost. The progress in the front is very slow, the learning cycle is very long, and it is difficult to persist. To what extent have you learned? Once you have learned how to use it, and if you can do it and explain it, you can continue to study later. Don't use NEW for several years and don't know what NEW has done.
Expand All
1. So what exactly is a driver and what is it used for:
l The driver is an intermediate software layer between the hardware device and the application program
l It enables a specific piece of hardware to respond to a well-defined internal programming interface while completely hiding the working details of the device
l Users complete corresponding operations through a set of standardized calls that are independent of specific devices
l The task of the driver is to map these standardized system calls to the specific operations of the specific device on the actual hardware
l The driver is part of the kernel and can use interrupts, DMA and other operations
l Driver transfers data between user mode and kernel mode
2. Basic framework of Linux driver
3. Device drivers under Linux can generally be divided into the following three categories
1) Character device
a) All devices that can be accessed like byte streams are implemented through character devices
b) They are mapped as nodes in the file system, usually under the /dev/ directory
c) Generally includes the implementation of system calls such as open read write close
2) Block device
d) Usually refers to storage devices such as disks, memory, Flash, etc. that can accommodate file systems.
e) Block devices are also accessed through the file system. The difference from character devices is that the way the kernel manages data is different
f) It allows access as a byte stream like a character device, and can also transfer any number of bytes at one time.
3) Network interface device
g) Usually it refers to a hardware device, but sometimes it may be a software device (such as a loopback interface). They are driven by the network subsystem in the kernel and are responsible for sending and receiving data packets.
h) Their data transfer is often not stream-oriented, so it is difficult to map them to a file system node.
The above is the detailed content of Learn how to develop Android device drivers. For more information, please follow other related articles on the PHP Chinese website!