Linux OS Porting on Create XScale-PXA270 Linux kernel porting.
-
date post
19-Dec-2015 -
Category
Documents
-
view
242 -
download
6
Transcript of Linux OS Porting on Create XScale-PXA270 Linux kernel porting.
Linux OS Porting on Create XScale-PXA270
Linux kernel porting
2
Outline
History and EvolutionOperating system ConceptsLinux versus other Unix-like kernelsDifferences with User ApplicationLinux versionsSteps of portingReference
3
History of Linux
First time, the Linux kernel is published at 1991/10/5 “Free minix-like kernel sources for 386-AT”
Linus Torvalds studied MINIX OS first, and learned about hardware knowledge of Intel 80386 process hacking the kernel, trying to port some GNU so
ftware (gcc, bash, ..) on MINIX-386
4
History of Linux (cont’)
Linus named his operating system “FREAX” and upload it to the server ‘ftp.funet.fi’
Ari Lemke, the server administrator, doesn’t like this name and changed the directory name to “Linux” for the homophonic of the inventor, Linus
5
Evolution of Linux
Linux is a member of the large family of UNIX-like operating system Unix is simple and well-designed Unix consider all the things as ‘files’ in system Kernel and system utilities are written by C
language which is portable very short time to create process easy and stableness inter-process
communication
6
Evolution of Linux (cont’)
The kernel aims to be compliant with the IEEE POSIX (Portable Operating System Interface for Computing Systems) a standard to describe API of operating system to promise the applications could porting to
many operating systems without changing the source
based on practice and experience of Unix
7
Evolution of Linux (cont’)
Linux isn’t a commercial operating system its source code under GNU General Public
License which is open and available to anyone to study
basic software on Linux is produce from GNU projects
Internet brings Linux to the world hackers from different countries devote their
life to progress Linux on Internet
8
Operating system Concepts
An operating system can roughly explain to some components of system ‘system’ contains operating system and any
applications working on the operating system
These components include kernel, device drivers, boot loader, command shell or other user interfaces, and some basic file and system utility tools
9
Operating system Concepts (cont’)
Here talks only ‘kernel’, the deepest of an operating system
A kernel needs to provide root services for other parts in system
Kernel also have to manage hardware and allocate system resources
Sometimes a kernel can be explained as ‘supervisor of OS’ or ‘core’
10
Operating system Concepts (cont’)
Some special elements of kernel are: interrupt handlers, used to services interrupt
requests scheduler, let many processes to share CPU
slices memory manage system, handle process
address space system utilities like network services or inter-
process communication protocol
11
Operating system Concepts (cont’)
In modern system, which has protected memory management units, a kernel program will have higher system state kernel programs have un-limited hardware
access rights and work in a protected memory space named kernel-space
user programs could only access some parts of system resources and could not control hardware directly
user programs are working in user-space
12
Operating system Concepts (cont’)
If a user program has to access some kind of hardware, it use system call to ask kernel handle the request action
Almost all the architectures that Linux supported provide the concept of interrupts when hardware want to communicate with
system, it will send a interrupt to let kernel stop and handle it’s request
kernel will use interrupt numbers to choose a specific interrupt handler
13
Operating system Concepts (cont’)
In fact, we can induce that CPU are doing one of three things: execute specific process in kernel space handle interrupt request in interrupt context
which independent with other process in kernel space
execute user program process in user space
14
Operating system Concepts (cont’)
Here shows the sketch map of transitions between user and kernel mode (space)
15
Linux versus other Unix-like kernels
Linux support kernel modules to load and unload dynamically
Linux support symmetrical multiprocessor, which most traditional Unix variants do not support this mechanism
Linux kernel is preemptiveKernel do not separate thread and process,
each procedures are the same just some procedures may share resources
16
Linux versus other Unix-like kernels (cont’)
Linux is fully customizable in all its components
Linux kernel can be very small and compact you can fit both a kernel image and full root
filesystem, including all fundamental system programs, on just one 1.4 MB floppy disk
Linux runs on low-end, cheap hardware platforms
17
Differences with User Application
Kernel program do not link C library major reason is execution speed and size but also some in common use functions are
implement in kernel source code
Kernel developer use GNU C and ISO C99 to compose kernel the use of inline function and inline assembly
is feasible
18
Differences with User Application (cont’)
There is no memory protection mechanism destroy memory data by kernel occurs ‘oops’ kernel memory could not be paged
Uneasy to use floating point numbers in kernel you have to access the floating point registers
and handle your operation by hand
Small and static stack in kernel in 32 bit architecture only 8KB in size
19
Differences with User Application (cont’)
Race conditions in kernel: use concurrence control to prevent it care if SMP to access the same resources care if interrupt will access the same resources
with the executing process care if preemptive condition comes true classic ways to prevent these situations are
the use of spinlocks and semaphores
20
Linux versions
Linux distinguish stable kernels from development kernels through a simple numbering scheme each version is characterized by three
numbers, separated by periods first two numbers identify the version third number identifies the release new release of a stable version come out
mostly to fix bugs reported by users
21
Linux versions (cont’)
If the second number is even, it denotes a stable kernel; otherwise it denotes a development kernel development versions may differ quite
significantly from one another kernel developers experiment with different
solutions which occasionally lead to drastic kernel changes
22
Steps of portingSystem requirements:
Linux host: used to compile Linux kernel image, root filesystem,
device driver, user applications, and so on ARM cross-compiler 4.0.2 is needed
Windows host: download and exam your project on Creator Domingo for Linux is needed
Target: Microtime Creator mother board, Creator-XScale-P
XA270 CPU board
23
Steps of porting (cont’)
To build a Linux kernel for running on Creator-XSCALE-PXA270, you need: source code of Linux kernel (mt-linux-
2.6.15.3.tar.gz ) patch (linux-2.6.15.3-creator-pxa270.patch) cross compiler (arm-linux-toolchain-bin-
4.0.2.tar.gz )
Then install the cross compiler into your Linux host system
24
Steps of porting (cont’)
After install the cross compiler into your system, don’t forget to update your PATH environment variable
When the cross compiler is ready, extract your kernel source and patch it by: cp linux-2.6.15.3-creator-pxa270.patch
/pxa270/pro/devkit/lsp/create-pxa270 patch –p0 < linux-2.6.15.3-creator-
pxa270.patch
25
Steps of porting (cont’)
Enter the Linux kernel directory, and type “make menuconfig” to configure your kernel
26
Steps of porting (cont’)
Here we use a default configuration file for the Creator XScale-PXA270 board
Choose “Load an Alternate Configuration File” and type “Enter” to select one
The default configuration file is located in “pxa270/linux/arch/arm/configs” and named “creator_pxa270_defconfig”
27
Steps of porting (cont’)
After configured the kernel, it’s time to make your kernel image by typing: make dep make clean make zImage
The kernel image could be find at “pxa270/linux/arch/arm/boot/”
To verify the kernel image, you need to copy this image to a Windows host
28
Steps of porting (cont’)
Before download and verify your Linux kernel, check the connections between the Creator and your host PC:
29
Steps of porting (cont’)
To verify your Linux kernel on PXA270, you need “Domingo for Linux” on Windows system
Check you must have your kernel image in the Windows system
Execute the Domingo on your Windows, and select “No project” to enter a hardware setting page
30
Steps of porting (cont’)
31
Steps of porting (cont’)
Press the “Config PCM…” to configure the peripheral of XScale PXA270
Choose “Import” to select default one:
32
Steps of porting (cont’)
After setting the hardware configuration, you can download your Linux kernel on PXA270 board to see if it work correctly
33
Steps of porting (cont’)
Load your kernel into memory addressed 0xa0008000
34
Steps of porting (cont’)
35
Steps of porting (cont’)
Change the PC register value to A0008000, which the kernel image’s address in RAM
Before click RUN in Domingo, set up your Hyper terminal for receiving Linux kernel debug message and be the shell interface of it
36
Steps of porting (cont’)
37
Steps of porting (cont’)
38
Reference
Web site references:鳥哥的私房菜 Debian 無痛起步 Linux kernel Archives Embedded Linux Training Linux kernel wiki The Linux kernel Kernel trap …
39
Reference (cont’)
Book references: Understanding the Linux Kernel, 2/e, O’Reilly Linux 核心開發指南 , 2.6版 , 維科 Linux Kernel 完全剖析 , 博碩文化 …