Linux device drivers one pdf

Linux Device Drivers 2nd Edition

PDF-файл из архива «Linux Device Drivers 2nd Edition», который расположен в категории » «. Всё это находится в предмете «основы автоматизированного проектирования (оап)» из 3 семестр, которые можно найти в файловом архиве МГТУ им. Н.Э.Баумана. Не смотря на прямую связь этого архива с МГТУ им. Н.Э.Баумана, его также можно найти и в других разделах. Архив можно найти в разделе «книги и методические указания», в предмете «основы автоматизированного производства (оап)» в общих файлах.

Просмотр PDF-файла онлайн

Текст из PDF

http://openlib.org.uaPREFACEThis is, on the surface, a book about writing device drivers for the Linux system.That is a worthy goal, of course; the flow of new hardware products is not likelyto slow down anytime soon, and somebody is going to have to make all thosenew gadgets work with Linux. But this book is also about how the Linux kernelworks and how to adapt its workings to your needs or interests. Linux is an opensystem; with this book, we hope, it will be more open and accessible to a largercommunity of developers.Much has changed with Linux since the first edition of this book came out. Linuxnow runs on many more processors and supports a much wider variety of hardware. Many of the internal programming interfaces have changed significantly.Thus, the second edition. This book covers the 2.4 kernel, with all of the new features that it provides, while still giving a look backward to earlier releases forthose who need to support them.We hope you’ll enjoy reading this book as much as we have enjoyed writing it.Alessandro’s IntroductionAs an electronic engineer and a do-it-yourself kind of person, I have alwaysenjoyed using the computer to control external hardware. Ever since the days ofmy father’s Apple IIe, I have been looking for another platform where I could connect my custom circuitry and write my own driver software. Unfortunately, the PCof the 1980s wasn’t powerful enough, at either the software or the hardware level:the internal design of the PC is much worse than that of the Apple II, and theavailable documentation has long been unsatisfying. But then Linux appeared, andI decided to give it a try by buying an expensive 386 motherboard and no proprietary software at all.xi22 June 2001 16:32http://openlib.org.uaPrefaceAt the time, I was using Unix systems at the university and was greatly excited bythe smart operating system, in particular when supplemented by the even smarterutilities that the GNU project donates to the user base. Running the Linux kernelon my own PC motherboard has always been an interesting experience, and Icould even write my own device drivers and play with the soldering iron onceagain. I continue to tell people, “When I grow up, I wanna be a hacker,” andGNU/Linux is the perfect platform for such dreams. That said, I don’t know if Iwill ever grow up.As Linux matures, more and more people get interested in writing drivers for custom circuitry and for commercial devices. As Linus Torvalds noted, “We’re back tothe times when men were men and wrote their own device drivers.”Back in 1996, I was hacking with my own toy device drivers that let me play withsome loaned, donated, or even home-built hardware. I already had contributed afew pages to the Ker nel Hacker’s Guide, by Michael Johnson, and began writingkernel-related articles for Linux Journal, the magazine Michael founded anddirected. Michael put me in touch with Andy Oram at O’Reilly; he expressed aninterest in having me write a whole book about device drivers, and I accepted thistask, which kept me pretty busy for quite a lot of time.In 1999 it was clear I couldn’t find the energy to update the book by myself: myfamily had grown and I had enough programming work to keep busy producingexclusively GPL’d software. Besides, the kernel had grown bigger and supportedmore diverse platforms than it used to, and the API had turned more broad andmore mature. That’s when Jonathan offered to help: he had just the right skills andenthusiasm to start the update and to force me to stay on track with the schedule — which slipped quite a lot anyway. He’s been an invaluable mate in the process, which he pushed forward with good skills and dedication, definitely morethan I could put in. I really enjoyed working with him, both on a technical andpersonal level.Jon’s IntroductionI first started actively playing with Linux early in 1994, when I convinced myemployer to buy me a laptop from a company called, then, Fintronic Systems.Having been a Unix user since the beginning of the 1980s, and having playedaround in the source since about then, I was immediately hooked. Even in 1994,Linux was a highly capable system, and the first truly free system that I had everbeen able to work with. I lost almost all my interest in working with proprietarysystems at that point.I didn’t ever really plan to get into writing about Linux, though. Instead, when Istarted talking with O’Reilly about helping with the second edition of this book, Ihad recently quit my job of 18 years to start a Linux consulting company. As a wayxii22 June 2001 16:32http://openlib.org.uaPrefaceof attracting attention to ourselves, we launched a Linux news site, Linux WeeklyNews (http://lwn.net), which, among other things, covered kernel development. AsLinux exploded in popularity, the web site did too, and the consulting businesswas eventually forgotten.But my first interest has always been systems programming. In the early days, thatinterest took the form of “fixing” the original BSD Unix paging code (which has tohave been a horrible hack job) or making recalcitrant tape drives work on aVAX/VMS system (where source was available, if you didn’t mind the fact that itwas in assembly and Bliss, and came on microfiche only). As time passed, I got tohack drivers on systems with names like Alliant, Ardent, and Sun, before movinginto tasks such as deploying Linux as a real-time radar data collection system or, inthe process of writing this book, fixing the I/O request queue locking in the Linuxfloppy driver.So I welcomed the opportunity to work on this book for several reasons. As muchas anything, it was a chance to get deeply into the code and to help others with asimilar goal. Linux has always been intended to be fun as well as useful, and playing around with the kernel is one of the most fun parts of all—at least, for thosewith a certain warped sense of fun. Working with Alessandro has been a joy, and Imust thank him for trusting me to hack on his excellent text, being patient withme as I came up to speed and as I broke things, and for that jet-lagged bicycletour of Pavia. Writing this book has been a great time.Audience of This BookOn the technical side, this text should offer a hands-on approach to understandingthe kernel internals and some of the design choices made by the Linux developers. Although the main, official target of the book is teaching how to write devicedrivers, the material should give an interesting overview of the kernel implementation as well.Although real hackers can find all the necessary information in the official kernelsources, usually a written text can be helpful in developing programming skills.The text you are approaching is the result of hours of patient grepping throughthe kernel sources, and we hope the final result is worth the effort it took.This book should be an interesting source of information both for people whowant to experiment with their computer and for technical programmers who facethe need to deal with the inner levels of a Linux box. Note that “a Linux box” is awider concept than “a PC running Linux,” as many platforms are supported by ouroperating system, and kernel programming is by no means bound to a specificplatform. We hope this book will be useful as a starting point for people whowant to become kernel hackers but don’t know where to start.xiii22 June 2001 16:32http://openlib.org.uaPrefaceThe Linux enthusiast should find in this book enough food for her mind to startplaying with the code base and should be able to join the group of developersthat is continuously working on new capabilities and performance enhancements.This book does not cover the Linux kernel in its entirety, of course, but Linuxdevice driver authors need to know how to work with many of the kernel’s subsystems. It thus makes a good introduction to kernel programming in general.Linux is still a work in progress, and there’s always a place for new programmersto jump into the game.If, on the other hand, you are just trying to write a device driver for your owndevice, and you don’t want to muck with the kernel internals, the text should bemodularized enough to fit your needs as well. If you don’t want to go deep intothe details, you can just skip the most technical sections and stick to the standardAPI used by device drivers to seamlessly integrate with the rest of the kernel.The main target of this book is writing kernel modules for version 2.4 of the Linuxkernel. A module is object code that can be loaded at runtime to add new functionality to a running kernel. Wherever possible, however, our sample code alsoruns on versions 2.2 and 2.0 of the kernel, and we point out where things havechanged along the way.Organization of the MaterialThe book introduces its topics in ascending order of complexity and is dividedinto two parts. The first part (Chapters 1 to 10) begins with the proper setup ofkernel modules and goes on to describe the various aspects of programming thatyou’ll need in order to write a full-featured driver for a char-oriented device. Everychapter covers a distinct problem and includes a “symbol table” at the end, whichcan be used as a reference during actual development.Throughout the first part of the book, the organization of the material movesroughly from the software-oriented concepts to the hardware-related ones. Thisorganization is meant to allow you to test the software on your own computer asfar as possible without the need to plug external hardware into the machine. Everychapter includes source code and points to sample drivers that you can run on anyLinux computer. In Chapter 8 and Chapter 9, however, we’ll ask you to connect aninch of wire to the parallel port in order to test out hardware handling, but thisrequirement should be manageable by everyone.The second half of the book describes block drivers and network interfaces andgoes deeper into more advanced topics. Many driver authors will not need thismaterial, but we encourage you to go on reading anyway. Much of the materialfound there is interesting as a view into how the Linux kernel works, even if youdo not need it for a specific project.xiv22 June 2001 16:32http://openlib.org.uaPrefaceBackground InformationIn order to be able to use this book, you need to be confident with C programming.

Читайте также:  Linux загрузочная флешка uefi windows

Источник

Оцените статью
Adblock
detector