Linux Kernel Source Code Heavily Commented Kernel Version 0 12 2019th Edition Zhao Jiong Instant Download
Linux Kernel Source Code Heavily Commented Kernel Version 0 12 2019th Edition Zhao Jiong Instant Download
https://textbookfull.com/product/linux-kernel-source-code-
heavily-commented-kernel-version-0-12-2019th-edition-zhao-jiong/
https://textbookfull.com/product/linux-kernel-programming-second-
edition-kaiwan-n-billimoria/
https://textbookfull.com/product/multivariate-kernel-smoothing-
and-its-applications-1st-edition-jose-e-chacon/
https://textbookfull.com/product/an-introduction-to-the-theory-
of-reproducing-kernel-hilbert-spaces-1st-edition-vern-i-paulsen/
https://textbookfull.com/product/an-introduction-to-the-theory-
of-reproducing-kernel-hilbert-spaces-1st-edition-vern-i-
paulsen-2/
https://textbookfull.com/product/neuroimaging-software-and-
communication-the-social-code-of-source-code-edison-bicudo/
https://textbookfull.com/product/android-s-architecture-
components-version-0-10-mark-l-murphy/
https://textbookfull.com/product/source-code-analytics-with-
roslyn-and-javascript-data-visualization-mukherjee/
www.oldlinux.org [email protected]
A Heavily Commented Linux Kernel
Source Code
Kernel Version 0.12
(Chinese Revision 5)
Zhao Jiong
[email protected]
WWW.OLDLINUX.ORG
2019-01-24
Abstract
This book provides detailed and comprehensive comments and explanations on all source code of the early Linux kernel
(V0.12), aiming to enable readers to gain a comprehensive and profound understanding of the working mechanism of Linux in a
shortest possible time and to lay a solid foundation for further study of modern Linux systems. Although the version of the analysis is
very low, the kernel has been able to compile and run, and it already includes the essence of the working principle of Linux.
The book first briefly introduced the development history of the Linux kernel, explained the main differences between the
various kernel versions and improvements, and gave the reasons for choosing the 0.12 kernel source code as the study object. Then it
gives the basic knowledge needed to read the source code, outlines the hardware structure of the PC running the Linux system, the
assembly language used by the kernel, the extends of C language, and focuses on the 80X86 processor in protected mode. Then we
introduced the kernel code overview, given the kernel source directory tree structure, and according to the organizational structure of
all kernel, programs and files are described in detail. In order to deepen the reader's understanding of the working principle of the
kernel, the last chapter gives a number of related operational debugging tests. All relevant information in the book can be
downloaded from the website www.oldlinux.org.
This book suits as the assistant and practical teaching material of university computer major student study operating system
course, also suitable for self-study reference book of Linux lovers as learning kernel operating principle, also can be used as the
reference book that the general technical personnel develops the embedded system.
Copyright statement
The author retains all rights to modify and formally publish this book. Feedback from readers can be sent to me via e-mail:
[email protected] or [email protected], or you can write directly to: School of Mechanical and Energy Engineering,
Institute of Mechanical and Electronic Engineering, Tongji University, Address: Room B409, Machinery Building, 4800 Cao'an Road,
Shanghai, China: 201804
In teaching me to grow up
You have spent your hard life
Your son
Zhao Jiong
“RTFSC – Read The F**king Source Code :)!”
Table of Contents
- I -
Table of Contents
- II -
Table of Contents
17.5 USING BOCHS TO DEBUG THE KERNEL ..... 1065 REFERENCES........................................................ 1101
17.6 CREATING A DISK IMAGE FILE .................. 1073
APPENDIX .............................................................. 1103
17.7 MAKING A ROOT FILE SYSTEM ................. 1076
17.8 COMPILE KERNEL ON LINUX 0.12 SYSTEM 1084 A1 ASCII CODE TABLE .................................. 1103
17.9 COMPILE KERNEL UNDER REDHAT SYSTEM 1085 A2 COMMON C0, C1 CONTROL CHARACTERS 1104
17.10 INTEGRATED BOOT DISK AND ROOT FS .... 1089 A3 ESCAPE AND CONTROL SEQUENCES .......... 1106
17.11 DEBUGGING KERNEL CODE WITH GDB AND A4 THE FIRST SET OF KEYBOARD SCAN CODE1109
BOCHS 1094
17.12 SUMMARY ................................................. 1100
- III -
Preface
Preface
Under the general trend of intelligent manufacturing and networking direct control of objects, the Linux
operating system has become the most important basic platform for operation control in today's embedded
systems. This book is a primer on the basic workings of the Linux operating system kernel.
The main goal of this book is to use a minimal amount of space or within a limited space to dissect the
complete Linux kernel source code in order to obtain a full understanding of the basic functions and actual
implementation of the operating system. To achieve a complete and profound understanding of the Linux kernel,
a true understanding and introduction of the basic operating principles of the Linux operating system.
This book's readership is positioned to know the general use of Linux systems or has a certain
programming basis, but it lacks the basic knowledge to read the current new kernel code and is eager to
understand the working principle and actual code of the UNIX operating system kernel as soon as possible.
At the time of writing this book, there are books on the market that describe the Linux kernel that try to use
the newer Linux kernel version (such as version 2.6.24 used by Fedora 8) to describe the kernel working
mechanism. However, since the size of kernel source code is already very large (for example, 2.2.20 version has
2.68 million lines!), these books can only selectively explain and describe the Linux kernel source code, and
many system implementation details are ignore. Therefore, it is difficult to have a clear and complete
description of the Linux kernel.
The book “Linux Kernel Source Code Analysis” written by Scott Maxwell is basically oriented to the
advanced level readers of Linux. It needs a more comprehensive basic knowledge to fully understand. And may
be due to space limitations, the book does not comment on all the Linux kernel code, omitted a lot of kernel
implementation details, such as the various header files used in the kernel (*.h), the tool to generate the kernel
code image file The role of the program, each make file, and its implementation are not covered. Therefore,
reading the book is difficult for readers who are at entry level.
The book "Leon's UNIX source code analysis" written by John Lions is a good book for learning UNIX
source code of the operating system kernel, but because it uses the UNIX version V6, some of the code in the
system call is With the assembler language of the long-deprecated PDP-11 series machine, it is difficult to
conduct experiments when reading and understanding the source code related to the hardware part.
Andrew S. Tanenbaum's book "Operating Systems: Design and Implementation" is a good primer on
operating system kernel implementation, but the MINIX system described in this book is a message-based
kernel implementation mechanism, and Linux There are differences in the implementation of the kernel.
Therefore, after learning this book, it is not very easy to start working on the newer Linux kernel source code.
When using these books for learning, there will be a feeling of "blind people feel like elephants". It is not
- 1 -
Preface
easy to understand the overall concept of the specific implementation of the Linux kernel system, especially
when the Linux system beginners use those books to learn the principle of the kernel, the overall operating
structure of the kernel. It cannot be clearly formed in the mind. This has profound experience in my many years
of experience in the Linux kernel learning. In October 1991, Linux founder Linus Torvalds mentioned the same
problem in an article written during the development of Linux version 0.03. In this article titled "LINUX--a free
unix-386 kernel", he said: "The development of Linux is for the use, learning and entertainment of those
operating system enthusiasts and computer science students." Today's popular Linux systems have become
larger and more complex, so they are no longer suitable as a starting point for beginners learning the operating
system.
In order to fill this vacancy, this book uses a minimal amount of space or within a limited space to conduct
a complete dissection of the complete Linux kernel source code in order to obtain a full understanding of the
basic functions and actual implementation of the operating system. To achieve a complete and profound
understanding of the Linux kernel, a true understanding and introduction of the basic operating principles of the
Linux operating system.
At present, there have been many kernel versions developed specifically for embedded systems based on
Linux's early kernels, such as DJJ's x86 operating system, Uclinux, etc. Many people in the world also realize
the benefits of learning through the early Linux kernel source code. At present, people in China are already
organizing human annotations to publish books similar to this article. Therefore, by reading the source code of
the Linux kernel version earlier, it is indeed an effective way to learn the Linux system, and it is also very
helpful for the research and application of the Linux embedded system.
In commenting on early kernel source code, the author found that early kernel source code was almost a
condensed version of the newer kernels in use today. It already includes almost all the basic functional
principles of the current version. As Leland L. Beck, author of "System Software: An Introduction to System
Programming," introduced system programs and operating system design, he introduced an extremely
simplified Simple Instruction Computer (SIC) system to illustrate the design and implementation of all system
programs. The principle, which not only avoids the complexity of the actual computer system, but also a
thorough description of the problem. Here, select the early kernel version of Linux as a learning object, and its
guiding ideology is the same as that of Leland. This is one of the best choices for beginners of Linux kernel
learning. The basic working principle of the Linux kernel can be deeply understood in the shortest possible
time.
For those who are already familiar with the working principle of the kernel, it is necessary to read the
kernel source code in order to allow the actual operation mechanism of the system in the actual work to produce
no feeling of castle in the air.
Of course, using the early kernel as a learning object also has its disadvantages. The selected Linux early
kernel version does not include support for virtual file system VFS, support for network systems, support for
only a.out executable files, and description of complex subsystems in some other existing kernels. However,
since this book is an introductory textbook that is used as a working mechanism for the Linux kernel, this is one
of the advantages of choosing an earlier kernel version. By studying this book, you can lay a solid foundation
for further studying these advanced contents.
- 2 -
Preface
Just as the founder of the Linux system stated in a newsgroup submission, to understand the true operating
mechanism of a software system, be sure to read its source code (RTFSC – Read The F**king Source Code).
The system itself is a complete whole, with many seemingly unimportant details. However, ignoring these
details will make it difficult to understand the entire system and fail to truly understand the implementation
method and means of an actual system.
Although some classic books on operating system principles (such as Mr. MJBach's "UNIX Operating
System Design") can be used to theoretically guide the working principle of the UNIX-like operating system,
the actual composition of the operating system is The understanding of the realization of internal relations is
still not very clear. As Andrew S. Tanenbaum said, "many operating system textbooks are theoretical and light
practice." "Most books and courses consume a lot of time and space for scheduling algorithms and completely
ignore I/O. In fact, the former is usually less than one page of code. The latter often has to account for one-third
of the total code of the entire system.” A large number of important details in the kernel are not mentioned.
Therefore, it does not allow readers to understand the true beauty of a real operating system. Only after reading
the complete kernel source code in detail will there be a sense of openness to the system and a deep
understanding of the entire system's operational process. When you choose the newest or newer kernel source
code to learn later, you will not encounter major problems and basically will be able to understand the new code
content smoothly.
So, how can we choose to meet the above requirements without being confused by too much content and
choose a suitable version of the Linux kernel to learn and improve the efficiency of learning? After comparing
and selecting a large number of kernel versions, the author finally chose the 0.12 kernel that is similar to the
current basic functions of the Linux kernel and is very short, as the best version for getting started. The
following figure shows the statistics for some major Linux kernel version lines.
- 3 -
Preface
The current Linux kernel source code amount is in the number of millions of lines, the 2.6.0 version of the
kernel code line is about 5.92 million lines, and the 4.18.X version of the kernel code is extremely large, and it
has exceeded 25 million lines! So it is almost impossible to fully annotate and elaborate on these kernels. The
0.12 version of the kernel does not exceed 20,000 lines of code, so it can be explained and commented clearly
in a book. Small but complete. In order to have an inductive understanding of the system under study and to use
experiments to deepen the understanding of the principle, the author has also specifically rebuilt the Linux 0.12
system that is based on this kernel. Since it contains the GNU gcc compilation environment, using this system
can also do some simple development work.
In addition, the use of this version can avoid the use of existing newer kernel versions that have become
more and more complicated to study the various subsystems (such as virtual file system VFS, ext2, or ext3 file
systems, network subsystems, new complex Memory management mechanisms, etc.)
When reading this book, readers must have some basic C language knowledge and Intel CPU assembly
language knowledge. The best reference for C language is still the book "The C Programming Language"
written by Mr. Brain W. Kernighan and Mr. Dennis M. Ritchie. Assembler language data can refer to any
assembly language textbook that explains Intel CPU. Also need some embedded assembly language information.
The authoritative information about embedded assembly is contained in the GNU gcc compiler manual. We can
also search for some valuable essays about embedded assembly from the Internet. The book also contains some
basic syntax descriptions for inline assembly (Section 5.5).
In addition, I hope readers have the following basic knowledge or related reference books. One is
knowledge or information about 80x86 processor architecture and programming. For example, the 80x86
programming manual (INTEL 80386 Programmer's Reference Manual) can be downloaded from the Internet;
the second is about 80x86 hardware architecture and interface programming knowledge or information. There is
a lot of information in this regard; the third should also have the simple skills of using the Linux system at the
- 4 -
Preface
beginning.
Since Linux kernel implementation was first developed according to the basic principles of the "UNIX
operating system design" book, many variables or function names in the source code come from the book.
Therefore, if you read this book properly, it will be easier to understand the kernel source code.
When Linus first developed the Linux operating system, he referred to the MINIX operating system. For
example, the original Linux kernel version completely copied the MINIX 1.0 file system. Therefore, when
reading this book, A.S. Tanenbaum's book "Operating System: Design and Implementation" also has great
reference value.
On the surface, the book notes the contents of Linux's early kernel version as if the Linux operating system
has just been released. Tanenbaum thinks that it is outdated (Linux is obsolete). However, by studying the
content of this book, you will find that because of the small amount of early kernel source code and lean, using
this book to learn the Linux kernel will have a very high learning efficiency, can do more with less, and get
started quickly. And lay a solid foundation for continuing to further select the source code of the new kernel part.
After completing this book, you will have a very complete and practical concept of how the system works. This
complete concept makes it easy to further select and learn any part of the new kernel source code without
having to Read the complete source code in the new kernel with a large amount of code.
The Ext3 file system currently used on Linux systems was developed after kernel 1.x. Its function is
detailed and its performance is also very complete and stable. It is the default standard file system on the current
Linux operating system. However, as part of the introductory learning of the full working principle of the Linux
operating system, in principle, the more streamlined the better. In order to achieve a complete understanding of
an operating system, and without being overwhelmed by the complex and excessive details of the various
subsystems, the principle of choosing the kernel version for learning is as simple as possible, as long as the
system code can explain the actual working principle. The Linux kernel version 0.12 contained only the
simplest MINIX 1.0 file system at the time, which is enough to understand the actual composition and working
principle of a file system in an operating system. This is one of the main reasons to choose the early Linux
kernel version for learning.
After reading this book in its entirety, I believe you will send this kind of sigh: "For the Linux kernel
system, I'm finally getting started!" At this point, you should have enough confidence to further study the
working principle and process of each part of the latest Linux kernel.
- 5 -
1.1 The birth and development of Linux
1 Overview
This chapter first reviews the process of the birth, development, and growth of the Linux operating system.
This can be used to understand why the book chose an earlier version of the Linux system as a learning object.
It then explains in detail the advantages and disadvantages of choosing an early version of the Linux kernel for
learning and how to begin further learning. Finally, we briefly introduced the contents of each chapter.
Linux is a clone system of the UNIX operating system. It was born on October 5, 1991 (this is the time for
the first official announcement). Since then, with the aid of the Internet, through the joint efforts of computer
enthusiasts all over the world, it has now become the most widely used type of UNIX operating system in the
world, and the number of users is still growing rapidly.
The birth, development, and growth of the Linux operating system depend on the following five pillars: the
UNIX operating system, the MINIX operating system, the GNU project, the POSIX standard, and the Internet
network. Based on these five basic clues, we follow the development history of Linux, its brewing process and
its initial development. First of all, I will introduce the four basic elements, and then follow Linux founder
Linus Torvalds to learn computer knowledge from her own interest in computers, start brewing her own
operating system, release to the initial release of the Linux kernel version 0.01, and how difficult it will be. Step
by step, with the help of hackers all over the world, the development of the more mature version 1.0 was finally
introduced. It also describes the history of Linux's early development in detail.
Of course, the current Linux kernel version has been developed to version 4.18.x. The kernel used in most
Linux systems is a stable 4.4.x-4.16.x kernel (where the second digit is an odd number, it means that it is being
developed and cannot guarantee system stability). For the general history of Linux development, many articles
and books have been introduced and will not be repeated here.
- 7 -
1.1 The birth and development of Linux
Although AST was born in New York, it was a Dutch expatriate (his grandfather came to the United States
in 1914). He studied at a high school in New York, a university at M.I.T, and a doctorate at the Berkeley campus
of the University of California. Due to his postdoctoral studies, he came to his hometown of the Netherlands.
Since then, it has been with the hometown. Later, I started teaching and graduate school at Vrije University.
Amsterdam, the capital city of the Netherlands, is a year-round rainy city, but for the AST, this is best, because
in this environment he can often stay at home to play with his computer.
MINIX was created in 1987 and is mainly used by students to learn operating system principles. By 1991
the version was 1.5. There are currently two major versions in use: Version 1.5 and Version 2.0. At that time, the
operating system was free at university, but other uses were not. Of course, the current MINIX system is free
and can be downloaded from many FTP sites.
For the Linux system, he later expressed his compliments to the developer Linus. However, he believes
that the development of Linux is largely due to the fact that in order to keep MINIX small, he will be able to
complete the learning within one semester, thus failing to accept the expansion requirements of MINIX from
many people around the world. So under this premise inspired Linus to write a Linux system. Of course, Linus
also just caught this good time.
As an operating system, MINIX is not an excellent one, but it also provides system source code written in
C and assembly language. This is the first time that aspiring programmers or hackers have been able to read the
operating system's source code. At the time, this source code was a secret that software vendors had been
carefully guarding.
- 8 -
1.1 The birth and development of Linux
In the early 1990s, the formulation of the POSIX standard was in the final stage of voting, which was
between 1991 and 1993. At this point, when Linux was just starting out, this UNIX standard provided extremely
important information for Linux, enabling Linux to be developed under the guidance of standards and
compatible with most UNIX operating systems. In the original Linux kernel source code (versions 0.1, 0.11, and
0.12) the Linux system was ready for compatibility with the POSIX standard. Several symbolic constants for
POSXI standard requirements have been defined in the /include/unistd.h file of the Linux version 0.01 kernel,
and Linus wrote in the comment: "OK, this may be a joke, but I'm working on it. It does."
On July 3, 1991, Linus mentioned on the post posted on comp.os.minix that it is collecting POSIX data. It
revealed that he is working on the development of an operating system, and at the beginning of development, he
had thought of the problem of compatibility with POSIX.
- 9 -
1.1 The birth and development of Linux
GNU C compiler has emerged, but the free GNU operating system has not yet been developed. Even the
MINIX operating system used in teaching has begun to have copyright, and it is necessary to purchase it to get
the source code. Although the GNU operating system HURD has been under development, it did not appear to
have been completed within a few years.
To better learn computer knowledge (perhaps just for interest), Linus purchased a 386-compatible
computer using Christmas lucky money and loans, and mailed a MINIX system software from the United States.
While waiting for the MINIX software, Linus learned the hardware knowledge of Intel 80386 seriously. In order
to be able to connect to the school's mainframe through a Modem dial-up, he uses assembly language and uses
the multitasking features of the 80386 CPU to create a terminal emulation program. Later, in order to copy his
own software on an old computer to a new computer, he also compiled drivers for floppy disk drives, keyboards,
and other hardware devices.
Through programming practice and recognizing the many limitations of the MINIX system during the
learning process (MINIX is good, but it is only a simple operating system for teaching purposes, rather than a
powerful and practical operating system), Linus already has something similar. The code for the operating
system device driver, so he began to have the idea of a new operating system. At this point, the GNU Project has
developed many tools and software, among which the most anticipated GNU C compiler has appeared.
Although GNU's free operating system HURD is under development. But Linus has waited for no hurry.
From April 1991, he began to develop his own operating system by modifying the terminal emulation
program and hardware drivers. At the beginning, his purpose was simple, just to learn the programming
techniques of the Intel 386 architecture protection mode operation. However, the development of Linux has
completely changed its original intention. According to Linus's news release on the comp.os.minix newsgroup,
we can see that he has gradually evolved from learning the MINIX system stage to developing his own Linux
system.
Linus delivered the message to comp.os.minix for the first time on March 29, 1991. The title of the posted
post is "gcc on minix-386 doesn't optimize". It is about the gcc compiler running optimized on the MINIX-386
system (MINIX-386 is an improvement from Bruce Evans using Intel 386 features 32 Bit MINIX system).
From this it can be seen that Linus had already begun to study the MINIX system in depth in early 1991, and
during this time there has been an improvement of the MINIX operating system. After further learning about the
MINIX system, this idea gradually evolved into the idea of redesigning a new operating system based on the
Intel 80386 architecture.
When he answered someone's question on MINIX, the first sentence said was "Read the F**ing Source
Code :-)"). He thinks the answer lies in the source program. This also shows that for the learning system
software, we not only need to understand the basic working principles of the system, but also need to combine
the actual system to learn how to implement the actual system. After all, theory is a theory, in which many
branches are omitted. Although these branch problems do not have much theoretical content, they are a
necessary part of the system, just like a feather in a sparrow.
From April 1991, Linus spent almost all of his time researching the MINIX-386 system (Hacking the
kernel) and trying to port GNU software to the system (GNU gcc, bash, gdb, etc.). And announced on
comp.os.minix on April 13 that he had successfully ported bash to MINIX, and he could not afford to leave the
shell software.
The first Linux-related news was released on comp.os.minix on July 3, 1991. (Of course, there was no such
name as Linux at that time. Linus thought that the name might be FREAK , FREAX. The English meaning is
grotesque, monsters, whimsical, etc.). It revealed that he is developing Linux system and he has already thought
of the problem of compatibility with POSIX.
- 10 -
1.1 The birth and development of Linux
In another announcement by Linus (comp.os.minix, August 25, 1991), he asked all MINIX users "What do
you most want to see in the MINIX system?" ("What would you like to see?" In minix?”), in which he revealed
for the first time that a (free) 386(486) operating system is being developed, and that he is only interested in it.
The code will not be large and will not be as professional as GNU. I hope you will give us some feedback on
what features the MINIX system likes and dislikes, and explain that due to practical and other reasons, the
newly developed system is just like MINIX (and uses MINIX's file system). And it has successfully ported bash
(version 1.08) and gcc (version 1.40) to the new system and it will be practical in months.
Finally, Linus stated that the operating system he developed does not use a single line of MINIX source
code; because of the task switching feature of the 386, the operating system is not portable (no portability) and
only AT hard disks are used. Linus did not consider the issue of Linux portability. But at present, Linux can run
on almost any kind of hardware architecture.
On October 5th, 1991, Linus published a message on the comp.os.minix newsgroup, officially announcing
the birth of the Linux kernel system (Free minix-like kernel sources for 386-AT). This news can be called the
birth declaration of Linux, and has been widely circulated. Therefore, October 5 was a special day for the Linux
community, and many later Linux versions had chosen this date. So RedHat chose this day to release its new
system is not accidental.
- 11 -
1.1 The birth and development of Linux
serial communications.
The more stable version mainly increases the software simulation program of the
0.12 1992.1.15 math coprocessor. Added job control, virtual console, file symbolic links, and virtual
memory swapping capabilities.
Virtual file system support was added in this version, but it still contains only one
MINIX file system. Added login functionality. Improves the performance of floppy
0.95.x
1992.3.8 disk drivers and file systems. Changed hard disk naming and numbering. The
(ie 0.13)
original naming method is the same as that of the MINIX system. At this time, it is
the same as the current Linux system. Support CDROM.
Began to add UNIX Socket support. Added ext file system alpha tester. SCSI drivers
are officially added to the kernel. Floppy disk type is automatically recognized.
Improved serial driver, cache, memory management performance, support for
0.96.x 1992.5.12
dynamic link libraries, and the ability to run X-Windows programs. The keyboard
driver written in the original assembly language has been rewritten with C.
Compared with the 0.95 kernel code, there are great changes.
Added support for new SCSI drivers; dynamic caching; msdos and ext file system
0.97.x 1992.8.1 support; bus mouse drivers. The kernel is mapped to the beginning of the linear
address 3GB.
Improve support for TCP/IP (0.8.1) networks and correct extfs errors. Rewritten
memory management section (mm), each process has 4GB of logical address space
0.98.x 1992.9.28 (the kernel occupies 1GB). Starting from 0.98.4, each process can open 256 files at
the same time (originally 32), and the process's kernel stack uses a single memory
page independently.
Re-design the process of the use of memory allocation, each process has 4G linear
0.99.x 1992.12.13
space. Constantly improving the network code. NFS support.
1.0 1994.3.14 The first official version.
The existing 0.10 version of the kernel code is a version of Ted Ts'o that was preserved at the time, Linus's
own has also been lost. This version is a great improvement over the previous versions. On this version of the
kernel system, GNU gcc has been used to compile the kernel, and has begun to support the operation of
mounting/unmounting file systems. From this kernel version, Linus added copyright information for each file:
"(C) 1991 Linus Torvalds". Some other changes in this version include: the original boot program boot/boot.s
split into two programs boot/bootsect.s and boot/setup.s; 1 supports up to 16MB of physical memory; 2 drivers
and memory management procedures Created their own subdirectories separately; 3 Added floppy driver; 4
Supported file read-ahead operations; 5 Supported dev/port and dev/null devices; 6 Rewritten kernel/signal.c
code, added sigaction() Support etc.
Relative to the 0.10 version of the kernel, Linux 0.11 version of the changes are relatively small. However,
this version is also the first stable version, and other people are beginning to participate in kernel development.
The main additions in this version are: 1 load requirements for the execution program; 2 execute the /etc/rc
initial file at startup; 3 build the math coprocessor simulation program frame program structure; 4Ted Ts'o adds
a script program The processing code; 5 Galen Hunt added support for multiple display cards; 6John T Kohl
modified the kernel/console.c program to enable the console to support tweet and KILL characters; 7 provides
support for multilingual keyboards.
Linux 0.12 is a more satisfactory kernel version of Linus and a more stable kernel. During the Christmas
- 12 -
1.1 The birth and development of Linux
season in 1991, he compiled the virtual memory management code so that "large" software like gcc could be
used on machines with only 2MB of memory. This version makes Linus feel that releasing the 1.0 kernel
version is not something that is out of sight, so he immediately upgraded the next version (0.13 version) to
version 0.95. Another implication of Linus's ability to do this is to make everyone not feel that they are still far
from version 1.0. However, due to the hasty release of the 0.95 version, which also contains more errors, so
when the 0.95 version was just released, there were more Linux enthusiasts encountered problems in use. At
that time, Linus felt like he had encountered a catastrophe. However, he has accepted this lesson since then.
Every time a new kernel version is released later, he will undergo more careful testing and let a few good
friends try it out before officially publishing it. The main changes in the 0.12 version of the kernel are: 1Ted
Ts'o adds support for terminal signal processing; 2 can change the screen ranks used when starting up; 3 corrects
a race condition caused by a file IO; 4 adds support for shared libraries Support, saving memory usage; 5
symbolic link handling; 6 deletion of directory system calls; 7 Peter MacDonald implements virtual terminal
support, making Linux even superior to certain commercial versions of UNIX at the time; Function support,
which was modified by Peter MacDonald based on patches provided by some people for MINIX, but MINIX
did not adopt these patches; 9 re-executable system calls; 10Linus compiled math coprocessor simulation code.
Version 0.95 was the first Linux kernel version to use the GNU GPL copyright. There are actually three
sub-versions of this version. Due to some problems encountered when the first 0.95 release was released on
March 8, 1992, another 0.95a version was immediately released in less than 10 days (March 17). And in a
month later (April 9th), 0.95c+ was released again. The biggest improvement in this version is the introduction
of the virtual file system VFS structure. Although only the MINIX file system was supported at the time, the
program structure has been extensively adjusted to support multiple file systems. The code for the MINIX file
system is put into a separate MINIX subdirectory. Some of the other changes in the 0.95 kernel include: 1
Added login interface; 2 Ross Biro added debugging code (ptrace); 3 Floppy disk drive track buffering; 4
Non-blocking pipeline file operations; 5 System restart (Ctrl-Alt-Del); Swapon() system call to select swap
devices in real time; 6 support for recursive symbolic links; 7 support for 4 serial ports; 8 support for hard disk
partitions; 9 support for more types of keyboards; 10James Wiegand compiles initial parallel port drivers, etc. .
In addition, starting with the 0.95 release, many of the kernel's improvements (providing patches) were
dominated by others, and Linus's main task began to become the maintenance of the kernel and decide whether
to adopt a patch. Until now, the latest kernel version is version 4.16.16 released in June 2018. Its use of gz
compressed source code package also has about 152MB! The latest version of each major stable release is
shown in Table 1–2. Table 1-2
- 13 -
1.1 The birth and development of Linux
FREAK. Its English meaning is grotesque, monster, whimsical. When he uploaded the new operating system to
the ftp.funet.fi server, administrator Ari Lemke disliked the name very much. He believes that since it is Linus's
operating system, take its homonym Linux as the operating system's directory, so the name of Linux began to
pass down.
In Linus's autobiography "Just for Fun," Linus explains:
“Honest: I didn't want to ever release it under the name Linux because it was too egotistical . What was the
name I reserved for any eventual release ? Freax. (Get it? Freaks with the requisite X.) In fact, some of the early
make files-the files that describe how to compile the sources-included the word "Freax" for about half a year.
But it really didn't matter. At that point I didn't need a name for it because I wasn't releasing it to anybody.”
“And Ari Lemke, who insured that it made its way to the ftp site, hated the name Freax. He preferred the
other working name I was using-Linux-and named my posting: pub/OS/Linux. I admit that I didn't put up much
of a fight. But it was his doing . So I can honestly say I wasn't egotistical, or half-honestly say I wasn't
egotistical . But I thought, okay, that's a good name, and I can always blame somebody else for it, which I'm
doing now.”
Another famous person in the Linux community is Alan Cox. He originally worked at Swansea University
College in Wales. At first, he particularly likes to play computer games, especially MUD (Multi-User Dungeon
or Dimension). In the posts of games.mud news group in the early 90s you can find a lot of posts he posted. He
even wrote a history of MUD development (rec.games.mud news group, March 9, 1992, A history of MUD). As
MUD games are closely related to the internet, he slowly became fascinated with computer networks. In order
to play the game and improve the speed of the computer running the game and the network transmission speed,
he needs to choose a most satisfactory operating platform. So he began to contact various types of operating
systems. Because of the lack of money, he could not afford even the MINIX system. When Linux 0.1x and
386BSD were released, he took a long time to purchase a 386SX computer. Since the 386BSD requires math
- 14 -
1.2 Content review
coprocessor support and the computer with the Intel 386SX CPU does not have a math coprocessor, he installed
the Linux system. So he started to learn Linux with free source code and started to have interest in Linux
systems, especially with regard to networking. In the discussion of Linux single-user mode of operation, he
even praised Linux for being beautifully implemented.
After the release of Linux 0.95, he began writing patches (modification programs) for the Linux system
(remembering that his two earliest patches were not adopted by Linus) and became the earliest users of TCP/IP
network code on Linux systems. one. Later, he gradually joined the Linux development team and became one of
the main responsible for maintaining the Linux kernel source code. It can also be said to be the most important
figure in the Linux community after relaying Linus. Later Microsoft invited him to join, but he simply refused.
Since 2001, he is responsible for maintaining the Linux kernel 2.4.x code. Linus is mainly responsible for the
development of the latest development version of the kernel (odd version, such as 2.5.x version).
Michael K. Johnson, author of The Linux Kernel Hackers' Guide, was also one of the first people to
contact the Linux operating system (from version 0.97). He is also one of the initiators of the well-known Linux
Document Project (LDP). He once worked for Linux Journal and now works for RedHat.
The Linux system is not the only backbone that can develop into what it is today. There are many computer
experts who have made great contributions to Linux. We will not list them here. The specific list of major
contributors can be found in the CREDITS file in the Linux kernel, which lists in alphabetical order the list of
more than 400 people who contributed significantly to Linux, including their email address and mailing address,
home page, and major contributions. Deeds and other information.
Through the above explanation, we can sum up the above five pillars of Linux as follows:
UNIX Operating System -- UNIX was born in Bell Labs in 1969. Linux is a UNIX clone system. The
importance of UNIX goes without saying.
The MINIX operating system -- The MINIX operating system is also a UNIX clone system. It was
developed in 1987 by the famous computer professor Andrew S. Tanenbaum. Due to the emergence of
the MINIX system and the availability of source code (which can only be used free of charge in
universities), the whirlwind of learning the UNIX system was spurred by universities around the
world. Linux first started development in 1991 with reference to the MINIX system.
The GNU Project -- The development of the Linux operating system, and most of the software used
on Linux is basically from the GNU program. Linux is only a kernel of the operating system. Without
the GNU software environment (such as the bash shell), Linux will be difficult to move.
POSIX Standard -- This standard has played an important role in the development of the Linux
operating system after the formal development. It is the beacon of Linux's progress.
Internet - If you don't have an Internet network and don't have the unselfish dedication of countless
computer hackers all over the world, then Linux can only grow to a level of 0.13 (0.95).
This book will mainly describe and comment on the early Linux kernel version 0.12. The Linux-0.12
version was released on January 15, 1992. Include the following files when publishing:
- 15 -
1.2 Content review
as86.tar.Z - Bruce Evans' binary execution file. 16-bit assembler and loader;
INSTALL-0.11 - Updated installation information file.
bootimage-0.12.Z and rootimage-0.12.Z are compressed floppy image files. Bootimage is the boot image
file, which mainly includes disk boot sector code, operating system loader, and kernel execution code. When the
PC starts, the program in the ROM BIOS reads the boot sector code and data from the default boot drive into
memory, and the boot sector code reads the operating system loader and kernel execution code into memory and
then controls It is up to the operating system loader to further prepare the kernel for initialization, and the final
loader will give control to the kernel code. Kernel code needs file system support to function properly.
Rootimage is the root file system used to provide the most basic support to the kernel, including the operating
system at least some configuration files and command execution procedures. For UNIX-based file system used
in Linux system, it mainly includes some specified directories, configuration files, device drivers, development
programs, and all other user data or text files. The combination of these two disks is equivalent to a bootable
DOS operating system disk.
as86.tar.Z is a 16-bit assembler linker package. linux-0.12.tar.Z is the compressed Linux 0.12 kernel source
code. INSTALL-0.11 is a simple installation documentation for the Linux 0.11 system. It also applies to Linux
systems that use the 0.12 kernel.
At present, in addition to the original rootimage-0.12.Z file, the other four files can be found. However, the
author has used the resources on the Internet to re-create a fully usable rootimage-0.12 root file system for
Linux 0.12. The gcc 1.40 compiler that can be used in the 0.12 environment is recompiled and the available
experimental development environment is configured. Currently, these files can be downloaded from the
oldlinux.org website. The specific download directory location is:
http://oldlinux.org/Linux.old/images/ This directory contains the kernel image file bootimage and the
root file system image file rootimage that have been created.
http://oldlinux.org/Linux.old/kernels/ This directory contains the kernel source code programs,
including the Linux 0.12 kernel source code program described in this book.
http://oldlinux.org/Linux.old/bochs/ This directory contains Linux systems that have been set up to
run under the computer simulation system bochs.
http://oldlinux.org/Linux.old/Linux-0.12/ This directory contains some of the other tools that can be
used in the Linux 0.12 system and some of the original installation instructions.
This book mainly analyzes all the source code programs in linux-0.12 kernel in detail, and makes detailed
comments on each source program file, including comments on Makefile files. The analysis process is mainly
carried out according to the computer startup process. Therefore, the consistency of the analysis until the end of
the initialization kernel starts calling the shell program. The rest of the programs are for their own analysis,
there is no coherence, so you can read according to their own needs. However, some application examples are
provided during the analysis.
In the process of analyzing all programs, if the author thinks it is difficult to understand the statement, it
will give a detailed description of the relevant knowledge. For example, when an input/output operation to the
interrupt controller is encountered, a detailed description of the Intel Interrupt Controller (8259A) chip will be
given and the used commands and methods will be listed. This will help deepen the understanding of the code,
but also better understand the use of the hardware used, the author believes that this method of interpretation
than a separate chapter to the overall introduction of hardware or other knowledge is much more efficient.
Taking the Linux 0.12 kernel to "dissect" is to increase the efficiency of our understanding of Linux's
- 16 -
1.2 Content review
operating mechanism. Linux-0.12 version of the entire kernel source code is only about 463K bytes, including
the content is basically the essence of Linux. The latest kernel version 2.6.XX is very large, 200 megabytes.
Even if you spend a lifetime learning to read it may not be able to read all. Maybe you have to ask, "Since you
want to start with Jane, why not analyze the smaller version of the Linux kernel source code for version 0.01?
It's only about 240K bytes." The main reason is because the 0.01 version of the kernel code has too many
shortcomings, not even Including drivers for floppy disks also does not relate well to the use of math
coprocessors and instructions for login procedures. And the structure of the bootstrapping boot program is not
the same as the current version, and the 0.12 boot boot program structure is basically the same as now. Another
reason is that you can find the earlier version 1.22 of the already compiled and compiled kernel image file
(bootimage-0.12), which can be used for boot demonstrations. If you add a simple root file system image
(rootimage-0.12), it will be able to run normally.
There are also deficiencies in learning with Linux 0.12. For example, the kernel version does not include
some very important code related to special process waiting queues, TCP/IP networks, etc. The allocation and
use of memory is also different from the current kernel. Fortunately, the network code in Linux is basically
self-contained, and the relationship with the kernel mechanism is not very large, so you can analyze the code
after you understand the basic principles of Linux work.
This book describes all the code in the Linux kernel. In order to maintain the integrity of the structure, the
description of the code is based on the structure of the source code in the kernel. Basically, the contents of each
source code is a chapter. The order of the source files introduced can be found in the previous file list index. The
directory structure of the entire Linux kernel source code is shown in Listing 1-1. All directory structures are
based on Linux as the current directory.
The content of this book can be divided into five parts. Chapters 1 to 4 are basics. The operating system is
closely related to the hardware environment being run. If you want to thoroughly understand the entire
operation of the operating system, then you need to understand its hardware operating environment, especially
the processor multi-task operating mechanism. This part introduces in more detail the hardware composition of
the microcomputer, the programming language used to compile the Linux kernel program, and the programming
principle under Intel 80X86 protection mode; the second part includes chapters 5 through 7, describing the
kernel boot boot and 32-bit operation. The preparation phase of the method should be fully read as a beginner to
learn the kernel; the third part from Chapter 8 to Chapter 13 is the main part of the kernel code. The contents of
Chapter 8 can be used as the main clue to read the subsequent chapters of this section. Chapters 14 to 16 are the
- 17 -
1.2 Content review
contents of the fourth section and can serve as reference for reading the third part of the source code. The last
part includes only Chapter 17, which describes how to use the PC simulation software system Bochs to conduct
various experimental activities on the Linux 0.12 kernel.
The second chapter is based on the hardware block diagram of the traditional microcomputer system. It
mainly introduces the components of the IBM PC/AT386 microcomputer running on the Linux kernel. Describe
the functions and relationships of each major section. At the same time, it is also compared with the block
diagram of the latest microcomputer. This will provide enough relevant information for readers who have not
learned the principles of computer composition.
Chapter 3 introduces the programming language, object file format, and compilation environment used in
the Linux 0.12 kernel. The main goal is to provide the assembly language and GNU C language extension
knowledge needed to read the Linux 0.12 kernel source code. This chapter first introduced the syntax and usage
of as86 and GNU as assembler in more detail, and then explained the common C language extensions such as
inline assembly, statement expressions, register variables, and inline functions in the GNU C language. The
mutual calling mechanism between C and assembly functions is described in detail. Finally, the use of the
Makefile is briefly described.
Chapter 4 describes the architecture of the 80X86 CPU and some basic knowledge of protected mode
programming. It lays a solid foundation for preparing to read the Linux kernel source code based on the 80X86
CPU. These include: 80X86 basics, protected mode memory management, interrupt and exception handling,
task management, and a simple multitasking kernel example.
Chapter 5 outlines the Linux operating system architecture, the organization of the kernel source code files,
and the general functionality of each file. It also introduces the use of Linux for physical memory allocation,
several stacks of the kernel, and how they are used, and the use of virtual linear addresses. Finally, it begins to
comment the first file seen in the Linux/ directory in the kernel package, which is the contents of the overall
Makefile of the kernel code. This file is the compilation management configuration file for all kernel source
programs and is used by the build management tool software make.
Chapter 6 will explain in detail the three assembly language programs in the boot/ directory, including the
bootdisk.ss of the disk boot program, the setup.s assembler that takes the parameters in the BIOS, and the 32-bit
run start code program head.s. The three assembler programs complete the bootloading of the kernel from the
block device into memory and detect system configuration parameters, completing all the work before entering
the 32-bit protected mode. Prepare for the kernel system to perform further initialization work.
Chapter 7 mainly introduces the initialization program main.c of the kernel system in the init/ directory. It
is a key point for the kernel to complete all initialization work and enter normal operation. After completing all
the initialization of the system, a process for the shell is created. In the introduction of the program will need to
see the other programs it calls, so the reading of the subsequent chapters can be performed in the order called
here. Since memory management program functions are widely used in the kernel, this chapter should be read
first. When you can really understand all the programs up to the main.c program, you should already have a
certain understanding of the Linux kernel. It can be said that half of them are already started, but you also need
to file systems, system calls, each Drivers, etc. for a deeper reading.
Chapter 8 mainly introduces all programs in the kernel/ directory. The most important part of the process is
the process scheduler(), sleep_on(), and program related system calls. At this point you should already know
some of the important programs. From the beginning of this chapter, we will encounter many assembly
language statements embedded in C language programs. The basic syntax for embedded assembly statements is
described in Chapter 3.
Chapter 9 explains the block device program in the kernel/blk_drv/ directory. This chapter mainly contains
- 18 -
1.2 Content review
drivers for block devices such as hard disks and floppy disks. It is mainly used to deal with file systems and
high-speed buffers, and contains more hardware-related content. Therefore, you need to refer to some hardware
information when reading this chapter. It's best to first look at the sections of the file system.
Chapter 10 Annotates the character device drivers in the kernel/chr_drv/ directory. This chapter mainly
deals with serial line drivers, keyboard drivers, and monitor drivers. These drivers constitute the serial terminal
and console terminal devices supported by the 0.12 kernel. Therefore, this chapter also contains more
hardware-related content. Need to refer to related hardware books when reading.
Chapter 11 introduces the math coprocessor simulation program in the kernel/math/ directory. Due to the
version of the kernel annotated in this book, coprocessors have not really started to be supported yet, so the
content of this chapter is relatively small and relatively simple. Just have a general understanding.
The 12th chapter introduces the file system program in the fs/ directory of the kernel source code. When
reading this chapter, we recommend that you pause for a while to read about the MINIX file system in Andrew
S. Tanenbaum's book “Operating System Design and Implementation”. Chapters, because the original Linux
system only supports MINIX file system, Linux 0.12 version is no exception.
Chapter 13 explains the memory management program in the mm/ directory. To thoroughly understand this
aspect, we need to have a sufficient understanding of the protection mode operation mode of the Intel 80X86
microprocessor. Therefore, when reading this chapter of the program, you can refer to the overview of the
operation mode of the 80X86 protection mode included in the appropriate place in this chapter. In addition to
the description, you should also refer to Chapter 4 at the same time. Since this chapter explains the use of
examples in the source code as objects, you can better understand how memory management works.
Existing Linux kernel analysis books generally lack the description of the kernel header file, so for a
beginner, there are many obstacles to reading the kernel program. Chapter 14 of this book details all the header
files in the include/ directory. Basically, each definition, each constant, or data structure is commented in detail.
In order to facilitate reference during reading, this book also summarizes some important data structures and
variables that are frequently used in the appendix, but these contents can actually be found in the header files of
this chapter. Although the contents of this chapter are mainly used for reading the procedures in other chapters,
if you want to thoroughly understand the kernel's operating mechanism, you still need to understand many of
the details in these header files.
Chapter 15 describes all the files in the Linux 0.12 kernel source code lib/ directory. These library function
files mainly provide interface functions to the system programs such as the compilation system, which will help
the future understanding of the system software. Because of this lower version, there is not much here, so we
can read it quickly. This is one of the reasons why we chose the 0.12 version.
Chapter 16 introduces the build.c program in the tools/ directory. This program is not included in the
compiled and generated kernel image file. It is only used to connect the disk boot block in the kernel with other
major kernel modules into a complete kernel image file.
Chapter 17 introduces the experimental environment for learning the kernel source code and the methods
for hands-on experimentation. It mainly introduces the method of using and compiling Linux kernel under
Bochs simulation system and the method of making disk image files. It also explains how to modify the syntax
of the Linux 0.12 source code so that it can successfully compile the correct kernel under the RedHat 9 system.
The last is the appendix and index. The appendix gives some constant definitions and basic data structure
definitions in the Linux kernel, as well as a concise description of the protection mode operating mechanism.
For ease of reference, the information on PC hardware used in the kernel is also listed separately in the
appendix of this book. In the reference literature, we only provided books, articles, and other information that
- 19 -
1.3 Summary
we can refer to when reading the source code. We did not provide all kinds of complicated and messy literature
lists. For example, when referring to a file in the LDP (Linux Document Project) of the Linux Documentation
Project, we will explicitly list which HOWTO article we need to refer to, and not just the LDP's website
address.
When Linus first developed the Linux operating system kernel, he mainly referred to three books. One is
"UNIX Operating System Design" by M. J. Bach, which describes the working principle and data structure of
the UNIX System V kernel. Linus uses the algorithms for many of the functions in the book. The names of
many important functions in the Linux kernel source code are taken from the book. Therefore, when reading
this book, this is an essential reference book on the working principle of the kernel. The other is “Programming
the 80386” edited by John H. Crawford et al. and is a good book explaining the 80x86 protected mode
programming method. There is also a first edition of the book "MINIX Operating System Design and
Implementation" by Andrew S. Tanenbaum. Linus mainly uses the MINIX file system version 1.0 described in
this book, and also supports only this file system in the early Linux kernel, so when reading this chapter about
the file system, the working principle of the file system It is fully available from Tanenbaum's book.
In the explanation of each program, we first briefly explain the main purpose and purpose of the program,
input and output parameters and the relationship with other programs, and then list the complete code of the
program and make detailed comments on the code, the original The program code or text is not altered or
deleted in any way, because C language is a kind of English language. The original small amount of English
comments in the program also provides a lot of useful information for constant symbols, variable names, and so
on. Behind the code is a more in-depth anatomy of the program and a description of some of the language or
hardware related knowledge that appears in the code. If you look back through the program after reading this
information, you will have a deeper understanding.
The introduction of some basic concept knowledge needed to read this book is scattered in the
corresponding parts of the various chapters. This is mainly for the convenience of finding, and when you
combine the source code reading, you can have a deeper understanding of some basic concepts.
The last thing to note is that when you have fully understood everything explained in this book, it does not
mean that you have become a Linux expert. You just embarked on the journey of Linux, with some initial
knowledge of becoming a Linux kernel master. At this point you should read more source code, preferably
incrementally from version 1.0 up to the latest odd-numbered version under development. The latest Linux
kernel at the time of revision of this book is version 4.16.16. When you can quickly understand the latest
versions of these developments and even come up with their own suggestions and patches, I'm willing to take a
plunge.
1.3 Summary
This chapter first elaborated on the indispensable pillars of the birth and development of Linux: UNIX's
initial open source version provided the basic principles and algorithms for Linux implementation, and Richard
Stallman's GNU program provided a variety of free and practical utilities for Linux systems. The emergence of
tools and POSIX standards provides Linux with reference guides for implementing standards-compliant systems.
AST's MINIX operating system has served as an indispensable reference for the birth of Linux, and the Internet
is a necessary environment for Linux to grow and grow. Finally, the chapter outlines the basic content of the
book.
- 20 -
1.3 Summary
2 Microcomputer structure
Any system can be seen as a model consisting of four basic parts, as shown in Figure 2-1. The input part is
used to receive information or data entering the system; after being processed by the processing center, the output
part is sent out. The energy section provides the energy supply for the operation of the entire system, including the
input and output part of the energy required for operation.
The composition of the computer system is no exception, it is also mainly composed of these four parts.
Internally, however, the channels or interfaces between the processing center and the input/output portion of the
computer system can be used in common, and therefore (b) in Figure 2-1 should more appropriately abstractly
represent a computer system. Of course, for computers or many complex systems, each of them can be regarded
as a complete subsystem independently and can also be described using this model, and a complete computer
system is composed of these subsystems.
Energy Energy
(a) (b)
Computer systems can be divided into hardware and software, but they are interdependent. The hardware part
is the visible part of the computer system and is the platform for software operation and storage. Software is a
stream of instructions that control hardware operations and actions. Just as information and thoughts stored in the
human brain control the thoughts and actions of the human body, software can be seen as information and
thinking in the "brain" of the computer. The theme described in this book is the operating mechanism of a
computer system. It mainly explains the hardware composition principle of the processing center and the
input/output part of the system and the realization of software control. On the hardware side, we outline the
hardware system of an IBM PC microcomputer based on the Intel 80X86 CPU (Central Processing Unit) and its
compatibles. The CPU chip of the computer can be regarded directly as the processing center of the system. The
bus interface is connected with other parts; for the software running on it, we specifically describe the
implementation of the Linux operating system kernel.
It can be seen that the operating system is closely related to the hardware environment being run. If you want
to thoroughly understand the entire operating system, you need to understand its operating hardware environment.
This chapter is based on the hardware block diagram of the traditional microcomputer system and introduces the
functions of each major part of the microcomputer. These contents have basically established the hardware basis
for reading the Linux 0.12 kernel. For ease of illustration, the term PC/AT will be used to refer to IBM PCs with
80386 or greater CPUs and their compatible microcomputers, while PCs are used generically to refer to all
microcomputers, including IBM PC/XTs and their compatible microcomputers.
21
Other documents randomly have
different content
the French guards, forced the prison of St. Lazare, released all the
prisoners, and took a great store of corn, which they carried to the
corn market. Here they got some arms, and the French guards
began to form and train them. The committee determined to raise
forty-eight thousand Bourgeoise, or rather to restrain their numbers
to forty-eight thousand. On the 14th, they sent one of their
members (Monsieur de Corny, whom we knew in America) to the
Hotel des Invalides, to ask arms for their Garde Bourgeoise. He was
followed by, or he found there, a great mob. The Governor of the
Invalides came out, and represented the impossibility of his
delivering arms, without the orders of those from whom he received
them. De Corny advised the people then to retire, and retired
himself; and the people took possession of the arms. It was
remarkable, that not only the Invalides themselves made no
opposition, but that a body of five thousand foreign troops,
encamped within four hundred yards, never stirred. Monsieur de
Corny and five others were then sent to ask arms of Monsieur de
Launai, Governor of the Bastile. They found a great collection of
people already before the place, and they immediately planted a flag
of truce, which was answered by a like flag hoisted on the parapet.
The deputation prevailed on the people to fall back a little, advanced
themselves to make their demand of the Governor, and in that
instant a discharge from the Bastile killed four people of those
nearest to the deputies. The deputies retired; the people rushed
against the place, and almost in an instant were in possession of a
fortification, defended by one hundred men, of infinite strength,
which in other times had stood several regular sieges, and had never
been taken. How they got in, has, as yet, been impossible to
discover. Those who pretend to have been of the party tell so many
different stories, as to destroy the credit of them all. They took all
the arms, discharged the prisoners, and such of the garrison as were
not killed in the first moment of fury, carried the Governor and
Lieutenant Governor to the Gréve, (the place of public execution,)
cut off their heads, and sent them through the city in triumph to the
Palais Royal. About the same instant, a treacherous correspondence
having been discovered in Monsieur de Flesselles, Prevost des
Marchands, they seized him in the Hotel de Ville, where he was in
the exercise of his office, and cut off his head. These events, carried
imperfectly to Versailles, were the subject of two successive
deputations from the States to the King, to both of which he gave
dry and hard answers; for it has transpired, that it had been
proposed and agitated in Council, to seize on the principal members
of the States General, to march the whole army down upon Paris,
and to suppress its tumults by the sword. But at night, the Duke de
Liancourt forced his way into the King's bed chamber, and obliged
him to hear a full and animated detail of the disasters of the day in
Paris. He went to bed deeply impressed. The decapitation of de
Launai worked powerfully through the night on the whole
aristocratical party, insomuch, that in the morning, those of the
greatest influence on the Count d'Artois, represented to him the
absolute necessity that the King should give up everything to the
States. This according well enough with the dispositions of the King,
he went about eleven o'clock, accompanied only by his brothers, to
the States General, and there read to them a speech, in which he
asked their interposition to re-establish order. Though this be
couched in terms of some caution, yet the manner in which it was
delivered, made it evident that it was meant as a surrender at
discretion. He returned to the chateau a foot, accompanied by the
States. They sent off a deputation, the Marquis de La Fayette at
their head, to quiet Paris. He had, the same morning, been named
Commandant-in-Chief of the Milice Bourgeoise, and Monsieur Bailly,
former President of the States General, was called for as Prevost des
Marchands. The demolition of the Bastile was now ordered, and
begun. A body of the Swiss guards of the regiment of Ventimille, and
the city horse guards, joined the people. The alarm at Versailles
increased instead of abating. They believed that the aristocrats of
Paris were under pillage and carnage, that one hundred and fifty
thousand men were in arms, coming to Versailles to massacre the
royal family, the court, the ministers, and all connected with them,
their practices and principles. The aristocrats of the Nobles and
Clergy in the States General, vied with each other in declaring how
sincerely they were converted to the justice of voting by persons,
and how determined to go with the nation all its lengths. The foreign
troops were ordered off instantly. Every minister resigned. The King
confirmed Bailly as Prevost des Marchands, wrote to Mr. Neckar to
recall him, sent his letter open to the States General, to be
forwarded by them, and invited them to go with him to Paris the
next day, to satisfy the city of his dispositions; and that night and
the next morning, the Count d'Artois and Monsieur de Montisson (a
deputy connected with him) Madame de Polignac, Madame de
Guiche, and the Count de Vaudreuil, favorites of the Queen, the
Abbé de Vermont, her confessor, the Prince of Condé and Duke de
Bourbon, all fled; we know not whither. The King came to Paris,
leaving the Queen in consternation for his return. Omitting the less
important figures of the procession, I will only observe, that the
King's carriage was in the centre, on each side of it the States
General, in two ranks, a foot, and at their head the Marquis de La
Fayette, as Commander-in-Chief, on horseback, and Bourgeoise
guards before and behind. About sixty thousand citizens of all forms
and colors, armed with the muskets of the Bastile and Invalides, as
far as they would go, the rest with pistols, swords, pikes, pruning
hooks, scythes, &c., lined all the streets through which the
procession passed, and, with the crowds of people in the streets,
doors and windows, saluted them everywhere with cries of "vive la
nation;" but not a single "vive le roy" was heard. The King stopped
at the Hotel de Ville. There Monsieur Bailly presented and put into
his hat the popular cockade, and addressed him. The King being
unprepared and unable to answer, Bailly went to him, gathered from
him some scraps of sentences, and made out an answer, which he
delivered to the audience as from the King. On their return, the
popular cries were "vive le roy et la nation." He was conducted by a
Garde Bourgeoise to his palace at Versailles, and thus concluded
such an amende honorable, as no sovereign ever made, and no
people ever received. Letters written with his own hand to the
Marquis de La Fayette, remove the scruples of his position.
Tranquillity is now restored to the capital: the shops are again
opened; the people resuming their labors, and if the want of bread
does not disturb our peace, we may hope a continuance of it. The
demolition of the Bastile is going on, and the Milice Bourgeoise
organizing and training. The ancient police of the city is abolished by
the authority of the people, the introduction of the King's troops will
probably be proscribed, and a watch or city guards substituted,
which shall depend on the city alone. But we cannot suppose this
paroxysm confined to Paris alone. The whole country must pass
successively through it, and happy if they get through it as soon and
as well as Paris has done.
I went yesterday to Versailles, to satisfy myself what had passed
there; for nothing can be believed but what one sees, or has from
an eye witness. They believe there still, that three thousand people
have fallen victims to the tumults of Paris. Mr. Short and myself have
been every day among them, in order to be sure what was passing.
We cannot find, with certainty, that anybody has been killed but the
three before mentioned, and those who fell in the assault or defence
of the Bastile. How many of the garrison were killed, nobody
pretends to have ever heard. Of the assailants, accounts vary from
six to six hundred. The most general belief is, that there fell about
thirty. There have been many reports of instantaneous executions by
the mob, on such of their body as they caught in acts of theft or
robbery. Some of these may perhaps be true. There was a severity
of honesty observed, of which no example has been known. Bags of
money offered on various occasions through fear or guilt, have been
uniformly refused by the mobs. The churches are now occupied in
singing "De profundis" and "Requiems" "for the repose of the souls
of the brave and valiant citizens who have sealed with their blood
the liberty of the nation." Monsieur de Montmorin is this day
replaced in the department of foreign affairs, and Monsieur de St.
Priest is named to the home department. The gazettes of France and
Leyden accompany this. I send, also, a paper (called the Point du
Jour), which will give you some idea of the proceedings of the
National Assembly. It is but an indifferent thing; however, it is the
best.
I have the honor to be, with great esteem and respect, Sir, your
most obedient, and most humble servant.
P. S. July 21. Mr. Neckar had left Brussels for Frankfort, before the
courier got there. We expect, however, to hear of him in a day or
two. Monsieur le Comte de La Luzerne has resumed the department
of the marine this day. Either this is an office of friendship effected
by Monsieur de Montmorin, (for though they had taken different
sides, their friendship continued,) or he comes in as a stop-gap, till
somebody else can be found. Though very unequal to his office, all
agree that he is an honest man. The Count d'Artois was at
Valenciennes. The Prince of Condé and Duke de Bourbon had passed
that place.
FOOTNOTE
TO M. L'ABBÉ ARNOLD.
Dear Sir,—My last to you was of the 18th of June. Within a day or
two after, yours of May the 9th came to hand. In the rest of Europe
nothing remarkable has happened; but in France such events as will
be forever memorable in history. To begin where my last left them,
the King took on himself to decide the great question of voting by
persons or orders, by a declaration made at a seance royale on the
23d of June. In the same declaration he inserted many other things,
some good, some bad. The Tiers, undismayed, resolved the whole
was a mere nullity, and proceeded as if nothing had happened. The
majority of the clergy joined them, and a small part of the nobles.
The uneasiness produced by the King's declaration occasioned the
people to collect about the palace in the evening of the same day.
The King and Queen were alarmed and sent for Mr. Neckar. He was
conducted to and from the palace amidst the acclamations of the
people. The French guards were observed to be mixed in great
numbers with the people and to participate of their passions. This
made so decisive an impression, that the King on the 27th wrote to
the clergy and nobles, who had not yet joined the Tiers,
recommending to them to go and join them. They did so, and it was
imagined all was now settled. It was soon observed, however, that
troops, and those the foreign troops, were marching towards Paris
from different quarters. The States addressed the King to forbid their
approach. He declared it was only to preserve the tranquillity of Paris
and Versailles, and I believe he thought so. The command of those
troops was given to the Marshal Broglio, and it was observed that
the Baron de Breteuil was going daily to Versailles. On the 11th,
there being now thirty thousand foreign troops in and between Paris
and Versailles, Mr. Neckar was dismissed and ordered to retire
privately. The next day the whole ministry was changed except
Villedeuil and Barentin. Breteuil, Broglio and Vauguyon were the
principal persons named in the new. A body of cavalry were
advanced into Paris to awe them. The people attacked and routed
them, killing one of the cavalry and losing a French guard. The corps
of French guards gathered stronger, followed the cavalry, attacked
them in the street, (the rue basse des ramparts,) and killed four. (I
did not know this fact with certainty when I wrote to Mr. Jay, it is
therefore not in my letter. I since have it from an eye-witness.) The
insurrection became now universal. The next day (the 13th) the
people forced a prison and took some arms. On the 14th a
committee was framed by the city, with powers corresponding to our
committees of safety. They resolve to raise a city militia of forty-
eight thousand men. The people attack the invalids and get a great
store of arms. They then attack and carry the Bastile, cut off the
Governor's and Lieutenant-Governor's heads, and that also of the
Prevost des Marchand's, discovered in a treacherous
correspondence. While these things were doing here, the council is
said to have been agitating at Versailles a proposition to arrest a
number of the members of the States, to march all the foreign
troops against Paris, and suppress the tumult by the sword. But the
decapitations being once known there, and that there were fifty or
sixty thousand men in arms, the King went to the States, referred
everything to them, and ordered away the troops. The City
Committee named the Marquis de La Fayette commander-in-chief.
They went on organizing their militia, the tumult continued, and a
noise spread about Versailles that they were coming to massacre the
court, the ministry, &c. Every minister hereupon resigned and fled,
the Count d'Artois, Prince of Condé, Duke de Bourbon, the family of
Polignacs, the Count de Vaudreuil, Abbé Vermont, confessor of the
Queen, and key-stone of all the intrigues, all fled out of the
kingdom. The King agreed to recall Mr. Neckar, reappointed
Montmorin and St. Priest, friends of Neckar, and came with the
States General to Paris to satisfy the city of his dispositions. All the
streets through which he passed were lined with Bourgeoise, armed
with guns, pistols, pikes, pruning-hooks, scythes, and whatever they
could lay hold of, about sixty thousand. The States General on foot
on each side of his coach, the Marquis de La Fayette at their head,
on horseback. He returned to Versailles in the same order, to the
great joy of the remaining courtiers, who feared he would have been
detained in Paris. The tumults in the city had pretty well subsided,
but to-day they have been revived by a new incident. Foulon, one of
the fugitive ministers, was taken in the country, (it is said by his own
tenants,) and brought to Paris. Every possible effort of persuasion
was exerted in vain to save him. He was forced from the hands of
the Gardes Bourgeoises by the mob, was hung, and after severing
his head, the body was dragged by the enraged populace through
the principal streets of Paris. The Intendant of Paris (de Chauvigny),
accused of having been in the plots with the late ministry, and who
had fled, was taken at Compiegne, and a party of two hundred
militia horse are now gone for him. If they bring him to Paris it will
be impossible to save him. Monsieur de La Luzerne was reappointed
minister of marine yesterday. Your last letter says nothing of my
leave of absence. The season is so far advanced towards the
Equinox, that if it comes to hand I shall not leave Europe till that be
over. Indeed this scene is too interesting to be left at present. But if
the permission does not come in time for my passage in the fall, the
necessity of my going is so imperious, that I shall be in a most
distressing dilemma.
I am, with sincere esteem and respect, dear Sir, your affectionate
friend and servant.
TO JOHN JAY.
TO JOHN JAY.
Sir,—I have written you lately, on the 24th of June, with a postscript
of the 25th; on the 29th of the same month; the 19th of July, with a
postscript of the 21st; and again on the 23d. Yesterday I received
yours of the 9th of March, by the way of Holland.
Mr. Neckar has accepted his appointment, and will arrive to-day from
Switzerland, where he had taken refuge. No other ministers have
been named since my last. It is thought that Mr. Neckar will choose
his own associates. The tranquillity of Paris has not been disturbed
since the death of Foulon and Bertier mentioned in my last. Their
militia is in a course of organization. It is impossible to know the
exact state of the supplies of bread. We suppose them low and
precarious, because, some days, we are allowed to buy but half or
three-fourths of the daily allowance of our families. Yet as the wheat
harvest must begin within ten days or a fortnight, we are in hopes
there will be subsistence found till that time. This is the only source
from which I should fear a renewal of the late disorders; for I take
for granted, the fugitives from the wrath of their country are all safe
in foreign countries. Among these, are numbered seven Princes of
the house of Bourbon, and six ministers; the seventh (the Marshal
de Broglio), being shut up in the fortified town of Metz, strongly
garrisoned with foreign soldiers. I observed to you, in a preceding
letter, that the storm which had begun in Paris, on the change of the
ministry, would have to pass over the whole country, and
consequently would, for a short time, occasion us terrible details
from the different parts of it. Among these, you will find a horrid one
retailed from Vesoul, in French Compté. The atrociousness of the
fact would dispose us rather to doubt the truth of the evidence on
which it rests, however regular that appears. There is no question,
that a number of people were blown up; but there are reasons for
suspecting that it was by accident and not design. It is said the
owner of the chateau sold powder by the pound, which was kept in
the cellar of the house blown up; and it is possible, some one of the
guests may have taken this occasion to supply himself, and been too
careless in approaching the mass. Many idle stories have also been
propagated and believed here, against the English, as that they have
instigated the late tumults with money, that they had taken or were
preparing to take Cherbourg, Brest, &c.; and even reasonable men
have believed, or pretended to believe, all these. The British
ambassador has thought it necessary to disavow them in a public
letter, which you will find in one of the papers accompanying this.
I have lately had an opportunity of knowing with certainty, the
present state of the King of England. His recovery was slow; he
passed through a stage of profound melancholy; but this has at
length dissipated, and he is at present perfectly re-established. He
talks now as much as ever, on the same trifling subjects, and has
recovered even his habitual inquisitiveness into the small news of
the families about him. His health is also good, though he is not as
fleshy as he used to be. I have multiplied my letters to you lately,
because the scene has been truly interesting; so much so, that had I
received my permission to pay my projected visit to my own country,
I should have thought, and should still think it my duty to defer it
awhile. I presume it cannot now be long, before I receive your
definitive answer to my request. I send herewith the public papers,
as usual; and have the honor to be, with the most perfect esteem
and respect, Sir, your most obedient, and most humble servant.
TO MR. CARMICHAEL.
Dear Sir,—Since your last of March the 27th, I have only written that
of May the 8th. The cause of this long silence, on both parts, has
been the expectation I communicated to you of embarking for
America. In fact, I have expected permission for this, every hour
since the month of March, and therefore always thought that by
putting off writing to you a few days, my letter, while it should
communicate the occurrences of the day, might be a letter of adieu.
Should my permission now arrive, I should put off my departure till
after the equinox. They write me that my not receiving it, has
proceeded from the ceasing of the old government in October last,
and the organization of the higher departments in the new, which
had not yet taken place when my last letters came away. Bills had
been brought in for establishing departments of Foreign Affairs,
Finance, and War. The last would certainly be given to General Knox.
Mr. Jay would probably have his choice of the first and second; and
it is supposed Hamilton would have that which Mr. Jay declined.
Some thought Mr. Jay would prefer and obtain the head of the law
department, for which Wilson would be a competitor. In such a case;
some have supposed C. Thompson would ask the Foreign Affairs.
The Senate and Representatives differed about the title of the
President. The former wanted to style him "His Highness, George
Washington, President of the United States, and Protector of their
liberties." The latter insisted and prevailed, to give no title but that
of office, to wit, "George Washington, President of the United
States." I hope the terms of Excellency, Honor, Worship, Esquire,
forever disappear from among us, from that moment: I wish that of
Mr. would follow them. In the impost bill, the Representatives had,
by almost an unanimous concurrence, made a difference between
nations in treaty with us, and those not in treaty. The Senate had
struck out this difference and lowered all the duties. Quære,
whether the Representatives would yield? Congress were to proceed
about the 1st of June to propose amendments to the new
Constitution. The principal would be, the annexing a declaration of
rights to satisfy the mind of all, on the subject of their liberties. They
waited the arrival of Brown, delegate from Kentucky, to take up the
receiving that district as a fourteenth State. The only objections
apprehended, were from the partisans of Vermont, who might insist
on both coming in together. This would produce a delay, though
probably not a long one.
To detail to you the events of this country, would require a volume.
It would be useless too; because those given in the Leyden gazette,
though not universally true, have so few and such unimportant
errors mixed with them, that you may have a general faith in them. I
will rather give you, therefore, what that paper cannot give, the
views of the prevailing power, as far as they can be collected from
conversation and writings. They will distribute the powers of
government into three parts, legislative, judiciary, and executive. The
legislative will certainly have no hereditary branch, and probably not
even a select one (like our Senate). If they divide it into two
chambers at all, it will be by breaking the representative body into
two equal halves by lot. But very many are for a single House, and
particularly the Turgotists. The imperfection of their legislative body,
I think, will be, that not a member of it will be chosen by the people
directly. Their representation will be an equal one, in which every
man will elect and be elected as a citizen, not as of a distinct order.
Quære, whether they will elect placemen and pensioners? Their
legislature will meet periodically, and set at their own will, with a
power in the executive to call them extraordinarily, in case of
emergencies. There is a considerable division of sentiment whether
the executive shall have a negative on the laws. I think they will
determine to give such a negative, either absolute or qualified. In
the judiciary, the parliaments will be suppressed, less numerous
judiciary bodies instituted, and trial by jury established in criminal, if
not in civil cases. The executive power will be left entire in the hands
of the King. They will establish the responsibility of ministers, gifts
and appropriations of money by the National Assembly alone;
consequently, a civil list, freedom of the press, freedom of religion,
freedom of commerce and industry, freedom of person against
arbitrary arrests, and modifications, if not a total prohibition of
military agency in civil cases. I do not see how they can prohibit
altogether the aid of the military in cases of riot, and yet I doubt
whether they can descend from the sublimity of ancient military
pride, to let a Marechal of France with his troops, be commanded by
a Magistrate. They cannot conceive, that General Washington, at the
head of his army, during the late war, could have been commanded
by a common Constable to go as his posse comitatus, to suppress a
mob, and that Count Rochambeau, when he was arrested at the
head of his army by a sheriff, must have gone to jail if he had not
given bail to appear in court. Though they have gone astonishing
lengths, they are not yet thus far. It is probable, therefore, that not
knowing how to use the military as a civil weapon, they will do too
much or too little with it.
I have said that things will be so and so. Understand by this, that
these are only my conjectures, the plan of the constitution not being
proposed yet, much less agreed to. Tranquillity is pretty well
established in the capital; though the appearance of any of the
refugees here would endanger it. The Baron de Besenval is kept
away; so is M. de la Vauguyon. The latter was so short a time a
member of the obnoxious administration, that probably he might not
be touched were he here. Seven Princes of the house of Bourbon,
and seven ministers, fled into foreign countries, is a wonderful event
indeed.
I have the honor to be, with great respect and attachment, dear Sir,
your most obedient, and most humble servant.
TO JOHN JAY.
TO JAMES MADISON.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com