source: rtems/c/src/lib/libbsp/i386/pc386/HOWTO @ 941f6f3

4.104.114.84.95
Last change on this file since 941f6f3 was 7d78f40, checked in by Joel Sherrill <joel.sherrill@…>, on 05/18/98 at 14:40:59

New file.

  • Property mode set to 100644
File size: 11.3 KB
Line 
1
2+-----------------------------------------------------------------------------+
3| RTEMS 4.0.0 PC386 BSP HOWTO - 1998/04/21                                    |
4+-----------------------------------------------------------------------------+
5| (C) Copyright 1998 -                                                        |
6| - NavIST Group - Real-Time Distributed Systems and Industrial Automation    |
7|                                                                             |
8| http://pandora.ist.utl.pt                                                   |
9|                                                                             |
10| Instituto Superior Tecnico * Lisboa * PORTUGAL                              |
11+-----------------------------------------------------------------------------+
12| Disclaimer:                                                                 |
13|                                                                             |
14| This file is provided "AS IS" without warranty of any kind, either          |
15| expressed or implied.                                                       |
16+-----------------------------------------------------------------------------+
17
18
191. Introduction
20---------------
21
22    This tries to explain how to setup the RTEMS host environment so
23that RTEMS applications can be built for and run in a bare PC 386 or
24above.
25
26    It covers essentially the aspects of loading images, since
27information concerning other issues such as building the development
28tools and the RTEMS distribution can be found in the 'RTEMS 4.0.0
29On-Line Library' under 'Getting Started with RTEMS for C/C++ Users'.
30
31    Please note that everything in the following text using the
32notation '<...>' is just an alias to something and should always be
33substituted by the real thing!
34
35
362. Building the GNU C/C++ Cross Compiler Toolset
37------------------------------------------------
38
39    Obtaining, building and installing the tools for building the
40PC386 BSP of RTEMS is covered in detail in the 'RTEMS 4.0.0 On-Line
41Library' -> 'Getting Started with RTEMS for C/C++ Users' -> 'Building
42the GNU C/C++ Cross Compiler Toolset'.
43
44    When running the 'bit' script you should use the 'i386-elf'
45configuration.
46
47
484. Building RTEMS
49-----------------
50    Obtaining, building and installing the tools for building the
51PC386 BSP is covered in detail in the 'RTEMS 4.0.0 On-Line Library' ->
52'Getting Started with RTEMS for C/C++ Users' -> 'Building RTEMS'.
53
54    When running configure, use the following values for the listed
55options:
56
57      --target=i386-rtems
58
59      --enable-rtemsbsp=pc386
60
61      --prefix=i386-rtems
62
63 
645. RTEMS Tests
65--------------
66
67    If you've completed the last step successfully, you'll find the
68RTEMS sample and test files that can be loaded with GRUB in the
69'<build_point>/pc386/tests' directory, RTEMS sample and test files in
70a format suitable for use with NetBoot in the
71'<build_point>/pc386/BootImgs' directory.
72
73
746. Loading RTEMS PC386 applications
75-----------------------------------
76
776.1. Unarchiving
78----------------
79
80    Files which have been "tarred, gzipped" (i.e. .tar.gz or .tgz
81extension) may be unarchived with a command similar to one of the
82following:
83
84      zcat <file>.tgz | tar xvof -
85
86    OR
87
88      gunzip -c <file>.tgz | tar xvof -
89
90    OR
91
92      tar xzvf <file>.tgz
93
94    NOTE: gunzip -c is equivalent to zcat. On commercial (non-Linux)
95Unices, since the GNU utilities are not the standard 'tar' will be
96gtar (GNU tar) and 'zcat' will be 'gzcat'.
97
98    Given that the necessary utility programs are installed, any of
99the above commands will extract the contents of <file>.tar.gz into the
100current directory. To view the contents of an archive without
101restoring any files, use a command similar to the following:
102
103      zcat <file>.tgz | tar tvf -
104
105
1066.2 Using GRUB to load RTEMS PC386 applications
107-----------------------------------------------
108
109    Using GRUB (GRand Unified Bootloader) is the simplest way to load
110and run your PC386 BSP samples, tests and programs.
111
112    You can get the latest release of GRUB from its homepage:
113
114    - http://www.uruk.org/grub/
115
116or alternatively by ftp from:
117
118    - ftp://ftp.uruk.org/public/grub/
119
120    Once you obtain the .tar.gz archive 'grub-0.4.tar.gz', change to a
121temporary directory (you won't need the grub files after this and can
122just go ahead and delete the whole directory structure that was
123generated) and unarchive 'grub-0.4.tar.gz' following the instructions
124given above in [2. Unarchiving].
125
126    After this is done change the directory to:
127
128      grub-0.4/bin_std
129
130and there you'll find the two files you'll need from this archive:
131'stage1' and 'stage2'.
132
133    You should have two (2) formatted diskettes available. One of
134these will only be used temporarily to create the other one, and we'll
135refer to it as 'RAW GRUB' diskette (you can label it accordingly if
136you wish). The other diskette, which we will refer to as 'GRUB FS'
137should be high-level formatted with one of GRUB's supported file
138systems, which are: DOS FAT, BSD FFS, and Linux ext2fs.
139
140    A DOS FAT diskette can, obviously, be created under DOS with the
141'FORMAT' command. Under Linux, the following commands are available to
142add file systems to low-level formatted diskettes:
143
144    1. To add a DOS FAT file system to a low-level formatted diskette:
145
146      a) If you have mtools installed:
147
148           'mformat a:'.
149
150      b) Assuming that you are formatting the diskette in the first
151         floppy disk drive ('/dev/fd0' under Linux):
152
153           'mkdosfs /dev/fd0' or
154
155           'mkfs.msdos /dev/fd0'.
156
157    2. To add a Linux ext2fs file system to a low-level formatted
158       diskette, assuming that you are formatting the diskette in the
159       first floppy disk drive ('/dev/fd0' under Linux):
160
161         'mke2fs /dev/fd0' or
162
163         'mkfs.ext2 /dev/fd0'.
164
165   Next we will install using 'rawrite' or 'dd' to the 'GRUB RAW'
166diskette.
167
168   NOTE: This will destroy any data currently on the diskette.
169
170   Execute your OS's equivalent of (this should work for recent
171FreeBSD versions and Linux just fine):
172
173     dd if=stage1 of=/dev/fd0 bs=512 count=1
174     dd if=stage2 of=/dev/fd0 bs=512 seek=1
175
176   Under DOS/Windows/NT, courtesy of Eric Hanchrow (erich@microsoft.com):
177
178     * Use the copy /b command to binary concatenate the stage1 and
179       stage2 files together via:
180
181         copy /b stage1 stage2 grub.raw
182
183     * Use rawrite.exe (which is available in many places on the net and
184       in some Linux distributions) to write grub.raw to a diskette.
185
186   Next stage: copy the 'stage1' and 'stage2' files to the 'GRUB FS'
187diskette (if you are using Linux you can mount the diskette in an
188appropriate mount point and then 'cp' the files to it, if it is either
189a DOS FAT or an EXT2FS diskette, or in the case of a DOS FAT diskette
190you can use 'mcopy' from 'mtools'.)
191
192   After this is done boot a PC using the 'GRUB RAW' diskette. After
193this is done, you will get GRUB's command line interface. Exchange
194'GRUB RAW' with the 'GRUB FS' diskette in the drive and issue the
195following command from GRUB's prompt:
196
197     install=(fd0)/stage1 (fd0) (fd0)/stage2 0x8000 (fd0)/grubmenu
198
199   This command will make the 'GRUB FS' diskette bootable. After this
200is done, you won't require the 'GRUB RAW' diskette anymore and you can
201delete the 'stage1' file from the 'GRUB FS' diskette.
202
203   Next copy all the files you wish to load to the diskette. The GRUB
204loadable test and sample files in the RTEMS distribution have '.exe'
205extension and can be found under the build point in the 'pc386/tests'
206directory. You can compress this files with gzip to save space if you
207wish. GRUB loads 'gzipped' files transparently.
208
209   Finally you have to create a GRUB menu configuration file. We will
210call this file 'grubmenu'. You can call it anything as long as you use
211the correct name in the 'install' command where we used 'grubmenu'.
212
213   The 'grubmenu' file, as far as we are interested has the following
214syntax:
215
216     title=  Hello World Test
217     kernel= (fd0)/hello.exe.gz
218
219   You can add as many of this entries as you want to the 'grubmenu'
220file. There should be one for each program you wish to load. The
221'title=' line provides a description for the program that will appear
222after boot in the GRUB menu for the user to choose and the 'kernel='
223line describes where the file can be found by GRUB (you should leave
224the '(fd0)/' part and just substitute the rest if you've copied the
225files to the root directory of the diskette.
226
227   Just boot the PC with the 'GRUB FS' diskette and you will be able
228to choose which program you want to load from GRUB's menu.
229
230   The GRUB documentation is available in HTML format in the 'docs'
231directory of the GRUB tree starting with the 'index.html' file.
232
233
2346.3  Using NetBoot to load RTEMS PC386 applications
235---------------------------------------------------
236
237    To load the '*.bt' files you can
238
239    Alternatively, if you have a PC connected to a network with a
240BOOTP server and a TFTP server (this can very well be you're Linux
241RTEMS host system), you can use Gero Kuhlmann's NetBoot loader, to
242load RTEMS to a diskless PC across a network. You can get it from:
243
244   ftp://sunsite.unc.edu/pub/Linux/system/boot/ethernet/netboot-0.7.3.tar.gz
245
246or in any of Sunsite's mirrors. It is also available from NetBoot's
247homepage:
248
249      http://www.han.de/~gero/netboot
250
251    After unarchiving 'netboot-0.7.3.tar.gz' you should change to the
252base directory of this and run:
253
254      ./configure --disable-mknbi-dos --disable-mknbi-linux --disable-mknbi-mgl
255
256    Afterwards, you should follow the instructions contained in the
257'INSTALL' file also contained in the base directory, on how to setup the
258server(s) and to build a boot ROM for the client PC network card, or a
259boot diskette, and the PC client should be able to load the '*.bt' files
260from the server.
261
262    The important sections to check in the 'INSTALL FILE' are the last two:
263
264    - Setup of the server (only the BOOTP and TFTP parts - ignore NFS).
265      ===================
266
267    - Setup of the client including building the bootrom
268      ==================================================
269
270all the rest can be safely ignored if you don't care to examine it.
271
272 
2737. Technical Information
274------------------------
275
276    NOTE: All the following paths are relative to the base directory
277of the RTEMS distribution.
278
279    As of the writing of this HOWTO, PC386 images can be loaded either
280in low memory 0x10000 (64KB) until 0x97C00 (607K) using NetBoot or in
281high memory from 0x100000 (1024KB) until the top of the available
282memory using either NetBoot or GRUB.
283
284    If you want to change the default loading address from 1024KB to
285something else, just change the value of the variable RELOCADDR in the
286'make/custom/pc386.cfg' file to the new value you want (make sure you
287follow the instructions indicated before the definition of RELOCADDR).
288
289    Remember that GRUB restricts the loading addresses to values above
2900x100000 (1024KB), only NetBoot can load images in low memory.
291
292    After you make any changes to RELOCADDR and if you are using
293NetLoader, you'll have to recompile the
294'c/src/lib/libbsp/i386/pc386/start/start16.s' file. The easiest way to
295achieve this is just to 'make clean' and the 'make all' again. The
296quickest way is to change to
297'<build_point>/c/src/lib/libbsp/i386/pc386/start' and 'make
298RTEMS_BSP=pc386 clean all'.
299
300    When programming interrupt handlers take into account that the PIC
301is reprogrammed and so you should use the interface functions provided
302in '<build_point>/pc386/lib/include/irq.h> to guarantee that everything
303works ok.
Note: See TracBrowser for help on using the repository browser.