Subversion Repositories HelenOS-doc

Rev

Rev 124 | Rev 150 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 124 Rev 149
1
\chapter{Boot Loading Process}
1
\chapter{Boot Loading Process}
2
 
2
 
3
The startup of HelenOS happens in several steps.
3
The startup of HelenOS happens in several steps.
4
Depending on the platform these steps can be either
4
Depending on the platform these steps can be either
5
described as \textit{piggybacker loading}:
5
described as \textit{piggybacker loading}:
6
 
6
 
7
\begin{enumerate}
7
\begin{enumerate}
8
 \item Platform boot loader loads the piggybacker image
8
 \item Platform boot loader loads the piggybacker image
9
       and jumps to its entry point.
9
       and jumps to its entry point.
10
 \item The piggybacker unwraps the kernel image and
10
 \item The piggybacker unwraps the kernel image and
11
       the images of the initial user space tasks, creates
11
       the images of the initial user space tasks, creates
12
       a boot information structure and jumps to the
12
       a boot information structure and jumps to the
13
       entry point of the kernel.
13
       entry point of the kernel.
14
 \item The kernel initializes and runs the initial tasks
14
 \item The kernel initializes and runs the initial tasks
15
       according the boot information structure from the
15
       according the boot information structure from the
16
       piggybacker.
16
       piggybacker.
17
\end{enumerate}
17
\end{enumerate}
18
 
18
 
19
If the platform supports a more sophisticated native boot loader,
19
If the platform supports a more sophisticated native boot loader,
20
a \textit{multiboot loading} contains following steps:
20
a \textit{multiboot loading} contains following steps:
21
 
21
 
22
\begin{enumerate}
22
\begin{enumerate}
23
 \item Platform boot loader loads the kernel image and initial
23
 \item Platform boot loader loads the kernel image and initial
24
       user space tasks, creates a boot information structure
24
       user space tasks, creates a boot information structure
25
       and jumps to the entry point of the kernel.
25
       and jumps to the entry point of the kernel.
26
 \item The kernel initializes and runs the initial tasks
26
 \item The kernel initializes and runs the initial tasks
27
       according the boot information structure from the
27
       according the boot information structure from the
28
       boot loader.
28
       boot loader.
29
\end{enumerate}
29
\end{enumerate}
30
 
30
 
31
A third kind of boot loading occurs on platforms with no support
31
A third kind of boot loading occurs on platforms with no support
32
of boot loader. It is called \textit{image loading} and is
32
of boot loader. It is called \textit{image loading} and is
33
used mostly on simulated architectures.
33
used mostly on simulated architectures.
34
 
34
 
35
\begin{enumerate}
35
\begin{enumerate}
36
 \item The kernel and initial user space images are placed
36
 \item The kernel and initial user space images are placed
37
       on well-known physical memory locations (usually
37
       on well-known physical memory locations (usually
38
       by a simulator configuration file). The execution
38
       by a simulator configuration file). The execution
39
       starts directly on the kernel entry point.
39
       starts directly on the kernel entry point.
40
 \item The kernel initializes and runs a previously hardwired
40
 \item The kernel initializes and runs a previously hardwired
41
       number of initial user space tasks.
41
       number of initial user space tasks.
42
\end{enumerate}
42
\end{enumerate}
43
 
43
 
44
The following sections describe the particual features of the
44
The following sections describe the particual features of the
45
boot loading process on the supported platforms.
45
boot loading process on the supported platforms. Sample
-
 
46
configuration files for all simulators are in the directory
-
 
47
{\em kernel/contrib/conf}.
46
 
48
 
47
\section{IA-32 and AMD64}
49
\section{IA-32 and AMD64}
48
 
50
 
49
On both platforms HelenOS depends on a boot loader which
51
On both platforms HelenOS depends on a boot loader which
50
supports the Multiboot Specification (i.e. GRUB). The kernel
52
supports the Multiboot Specification (i.e. GRUB). The kernel
51
image (usually called \texttt{image.bin}) is loaded by the
53
image (usually called \texttt{image.bin}) is loaded by the
52
boot loader just above the 1st megabyte of the physical
54
boot loader just above the 1st megabyte of the physical
53
memory (the exact location is 1081344 bytes).
-
 
54
55
memory (the exact location is 1081344 bytes). Modules loaded by
-
 
56
GRUB are automatically detected by the kernel and after initialization
-
 
57
they are started as userspace tasks. The GRUB loading is the
-
 
58
easiest in terms of using userspace tasks.
-
 
59
 
-
 
60
An example GRUB configuration file {\em menu.lst}:
-
 
61
\begin{verbatim}
-
 
62
title=HelenOS
-
 
63
root (cd)
-
 
64
kernel /boot/kernel.bin
-
 
65
module /boot/ns
-
 
66
module /boot/init
-
 
67
module /boot/pci
-
 
68
module /boot/fb
-
 
69
module /boot/kbd
-
 
70
module /boot/console
-
 
71
module /boot/tetris
-
 
72
module /boot/ipcc
-
 
73
module /boot/klog
-
 
74
\end{verbatim}
-
 
75
 
-
 
76
\section{32-bit MIPS}
-
 
77
The MIPS port is fully supported in the {\em msim} and {\em gxemul} simulators.
-
 
78
These simulators allow specifying a memory contents of the simulated
-
 
79
computer. Unfortunately, the autodetection of loaded modules does
-
 
80
not work. In order to change number of loaded modules, the file
-
 
81
kernel/arch/mips32/src/mips32.c must be modified.
-
 
82
 
-
 
83
Sample msim configuration file:
-
 
84
\begin{verbatim}
-
 
85
 add dcpu mips1
-
 
86
 
-
 
87
add rwm mainmem         0x0                     8M              load    "/dev/zero"
-
 
88
add rom startmem        0x1fc00000      1024k   load    "image.boot"
-
 
89
add rwm ns              0x01000000      1M      load    "../uspace/ns/ns"
-
 
90
add rwm kbd             0x01100000      1M      load    "../uspace/fb/fb"
-
 
91
add rwm fb              0x01200000      1M      load    "../uspace/kbd/kbd"
-
 
92
add rwm console         0x01300000      1M      load    "../uspace/console/console"
-
 
93
add rwm init            0x01400000      1M      load    "../uspace/init/init"
-
 
94
add rwm tetris          0x01500000      1M      load    "../uspace/tetris/tetris"
-
 
95
\end{verbatim}
-
 
96
 
-
 
97
Sample gxemul command line arguments
-
 
98
\begin{verbatim}
-
 
99
gxemul -E testmips -X 0x81800000:../uspace/ns/ns 0x81900000:../uspace/kbd/kbd 0x81a00000:../uspace/fb/fb 0x81b00000:../uspace/init/init 0x81c00000:../uspace/console/console 0x81d00000:../uspace/tetris/tetris kernel.bin
-
 
100
\end{verbatim}
-
 
101
 
-
 
102
The kernel can boot on the SGI Indy (and probably other SGI computers
-
 
103
with 32-bit ARC firmware). It uses ARC for output and input. When
-
 
104
the kernel is compiled to be loaded on the SGI Indy, an ECOFF image
-
 
105
is created which can be later loaded directly with ARC boot loader
-
 
106
e.g. using BOOTP protocol.
-
 
107
 
-
 
108
\section{IA64}
-
 
109
The IA64 port is supported on the ski simulator. The situation is very similar
-
 
110
to the MIPS loader - the loaded modules must be loaded on correct addresses in
-
 
111
the ski configuration file and specified in the file
-
 
112
kernel/arch/ia64/src/ia64.c.
-
 
113
 
-
 
114
Sample IA64 configuration file:
-
 
115
\begin{verbatim}
-
 
116
load kernel.bin
-
 
117
romload ../uspace/ns/ns 0x400000
-
 
118
romload ../uspace/init/init 0x800000
-
 
119
romload ../uspace/console/console 0xc00000
-
 
120
romload ../uspace/fb/fb 0x1000000
-
 
121
romload ../uspace/kbd/kbd 0x1400000
-
 
122
romload ../uspace/tetris/tetris 0x1800000
-
 
123
romload ../uspace/klog/klog 0x1c00000
-
 
124
romload ../uspace/ipcc/ipcc 0x2000000
-
 
125
\end{verbatim}
-
 
126
 
-
 
127
\section{Power PC}
-
 
128
The PowerPC boot image contains complete kernel with user tasks.
-
 
129
The loader build system automatically creates such image using information
-
 
130
residing in boot/arch/ppc32/loader/Makefile.inc. The variable COMPONENTS
-
 
131
specifies, which tasks will be loaded into the image.
-
 
132