Beruflich Dokumente
Kultur Dokumente
Babak Kia
Adjunct Professor
Boston University
2
College of Engineering
Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design
5 6
1
Linux Distribution The Linux Kernel
z Without distros, a person interested in Linux z The most important element of Embedded Linux
would have install everything manually which is its core, called the Linux Kernel
basically required a great expertise of the Unix z The Linux Kernel is maintained and distributed by
Operating System Linus Trovalds, who initially wrote the Kernel
z Distros therefore making the process of installing when he was a student at the University of
Linux easier, they usually provide both binaries Helsinki
and source, and are segmented into packages, z Unlike proprietary Operating Systems, its source
each package providing one component of the code is available for anyone to freely use,
system such as font, web browser, etc. distribute, or modify
z Some popular Package Management Systems are: z The latest released version of the Linux Kernel is
• RPM – The RPM package manager version 2.4, though development of the Linux
• deb – The Debian package Kernel is of course ongoing and newer versions
• tgz, or tar.gz – Archived tar and gzipped file, used to become available on a regular basis
distribute simple hand made packages
7 8
11 12
2
Other Licensing Models The Copyleft
z GPL is not the only licensing model available z The right to redistribute GPL-based code is granted
only if the licensee includes the source code in the
z Some licenses such as BSD permit distribution of
redistribution (including all modifications!)
a modified BSD-based code as proprietary
z The redistributed copies themselves are required to
software
include and be licensed under GPL in a mechanism
z The difference between GPL and BSD licenses is known as copyleft
legal mechanism known as copyleft, invented by z Copyleft actually derives its legal impact from the fact
Richard Stallman (initiator of GNU project and that the program is copyrighted!
founder of Free Software Foundation) z Under a copyright, a licensee does not have the right to
z Copyleft requires that derivative works of a GPL- modify or redistribute the code unless under the terms
licensed application also be covered by the GLP outlined in copyleft
license z Therefore copyleft uses copyright law to accomplish an
almost opposite effect – granting modification and
redistribution rights
13 14
15 16
CVS CVS
z The Concurrent Versions System z The way CVS works is as follows:
implements a version control system to • Any number of clients (developers) can check-
out a full copy of a given project
keep track of all the work and changes in
• One or more developers can work on the same
a set of files copy of the code and then check-in their
z This enables developers from across the modifications
globe to collaborate on a project and as • The CVS server automatically attempts to
merge the different changes
such as become a popular component of
• If it is unsuccessful, for example in the case
the open-source development community where two developers are trying to modify the
same line of code, it rejects the second
developer from updating the code, and directs
the two developers to merge the code
manually
17 18
3
Developing a Linux System Starting up Linux
z There are three basic setup mechanisms which z From system power up to the time the
developers use to develop code for Linux system is up and running, there are three
• The Permanent Link Setup is where the host and the
target are permanently connected together via an
distinct steps the must be completed
Ethernet cable for example. In this case a root file • Bootloader is the first piece of code which
system can be NFS-mounted which prevents the runs on the hardware and it is closely related
need for constantly copying programs back and to the type of platform on which it runs. There
forth are many different types of bootloaders for
• The Removable Storage Setup is a situation where Linux
the code is created on the host, copied onto a • Kernel Startup Code is the second stage of the
removable storage device such as Compact Flash
and transferred to the target
boot process and it too differs greatly
depending on the target platform
• The Stand-alone Setup is a situation where the
toolchain is contained on the target, as could be the • Init is the final process which further initializes
case for creating embedded Linux on PC-based the system
platforms
19 20
21 22
23 24
4
Classes of Devices Classes of Devices
z Unix differentiates its resources into z Block Devices
three classes of devices • Another class of devices is the block device, which
are closely tied to resource such as a Compact
z Character Device Flash card where the resource can only be
• One of the simplest classes of devices is the accessed in multiples of blocks
character device • Unix enables an application to read and write blocks
• It can be accessed as a stream of bytes and like a character device, and therefore the difference
implements functions such as open, close, between a character device and a block device is
read and write transparent to the user
• A file is an example of a character device, as is z Network Interfaces
a serial port (dev/ttyS0), with the minor
• Finally, network resources are managed through
difference that while you can only access a
interfaces, which are generally hardware resources
character device resource sequentially, you
in charge of transmitting and receiving data
can move back and forth within a file
25 26
>gcc –c test.c
>instmod test.o
Hello, initializing module…
>
27 28
29 30
5
Memory Management Process Management
z Linux employs three memory management z Linux uses 5 states to manage processes
schemes • TASK_RUNNING: Process is either executing, or is
• Logical Address, where each address contains a waiting to run
segment and an offset
• TASK_INTERRUPTABLE: The process is
• Linear Address, a single 32-bit unsigned integer to suspended until a certain condition is met
address memory from 0 to 4 GB
• TASK_UNINTERRUPTABLE: Task is suspended
• Physical Address, the actual addressing scheme on
the system bus (the physical address provided to a until a condition is met and is uninterruptable until
flash chip for instance) the condition is met
z The kernel translates a logical address into a • TASK_STOPPED: Process execution has been
linear address through segmentation, and further terminated
translates it into a physical address through • TASK_ZOMBIE: The process has been terminated
paging but the parent may still need information pertaining
z Linux prefers paging over segmentation to it and therefore the OS can’t discard the process
31 32
6
Interprocess Communication
z Another of the kernel’s tasks is to handle
interprocess communication (IPC)
z Signals and pipes are two mechanisms that Linux
uses to perform IPCs
z A signal is a mechanism, like interrupts and
exceptions to notify processes of events.
However, unlike the two, a signal is also available
in the user space
z For example, the kill() signal can be sent to a
process at any time to terminate it
37
Portions of this power point presentation may have been taken from relevant users and technical manuals. Original content Copyright © 2005 – Babak Kia