1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2012, 2016 Chris Johns <chrisj@rtems.org> |
---|
4 | |
---|
5 | Cross and Canadian Cross Building |
---|
6 | --------------------------------- |
---|
7 | |
---|
8 | Cross building and Canadian Cross building is the process of building on one |
---|
9 | machine an executable that runs on another machine. An example is building a |
---|
10 | set of RTEMS tools on Linux to run on Windows. The RSB supports cross building |
---|
11 | and Canadian cross building. |
---|
12 | |
---|
13 | This sections details how to the RSB to cross and Canadian cross build. |
---|
14 | |
---|
15 | Cross Building |
---|
16 | ^^^^^^^^^^^^^^ |
---|
17 | |
---|
18 | Cross building is where the *build* machine and *host* are different. The |
---|
19 | *build* machine runs the RSB and the *host* machine is where the output from |
---|
20 | the build runs. An example is building a package such as Curl for RTEMS on your |
---|
21 | development machine. |
---|
22 | |
---|
23 | To build the Curl package for RTEMS you enter the RSB command: |
---|
24 | |
---|
25 | .. code-block:: none |
---|
26 | |
---|
27 | $ ../source-builder/sb-set-builder \ |
---|
28 | --log=log_curl_arm.txt \ |
---|
29 | --prefix=$HOME/development/rtems/5 \ <1> |
---|
30 | --host=arm-rtems5 \ <2> |
---|
31 | --with-rtems-bsp=xilinx_zynq_zc706 \ <3> |
---|
32 | 5/ftp/curl |
---|
33 | |
---|
34 | .. topic:: Items: |
---|
35 | |
---|
36 | 1. The tools and the RTEMS BSP are installed under the same prefix. |
---|
37 | |
---|
38 | 2. The ``--host`` command is the RTEMS architecture and version. |
---|
39 | |
---|
40 | 3. The BSP is built and installed in the prefix. The arhcitecture must match |
---|
41 | the ``--host`` architecture. |
---|
42 | |
---|
43 | .. note: Installing Into Different Directories |
---|
44 | |
---|
45 | If you use a prefix that is different to the path the build RTEMS BSP is |
---|
46 | installed under use the ``--with-rtems`` option to specify the top level path |
---|
47 | to the RTEMS BSP. Do not add an extra directories to the path,the RSB knows |
---|
48 | how to search the path. |
---|
49 | |
---|
50 | If the tools have been installed in a different location to the RTEMS BSP and |
---|
51 | the prefix use the ``--with-tools`` option to specift the top level path to |
---|
52 | the installed tools Again do not add an extar directory such as ``bin`` as |
---|
53 | the RSB knows how to search the supplied tools path. |
---|
54 | |
---|
55 | We recommend you install all thrid party packages using the same prefix. |
---|
56 | the RTEM BSP you can use the |
---|
57 | |
---|
58 | Canadian Cross Building |
---|
59 | ^^^^^^^^^^^^^^^^^^^^^^^ |
---|
60 | |
---|
61 | A Canadian cross builds are where the **build**, **host** and **target** |
---|
62 | machines all differ. For example building an RTEMS compiler for an ARM |
---|
63 | processor that runs on Windows is built using a Linux machine. The process is |
---|
64 | controlled by setting the build triplet to the host you are building, the host |
---|
65 | triplet to the host the tools will run on and the target to the RTEMS |
---|
66 | architecture you require. The tools needed by the RSB are: |
---|
67 | |
---|
68 | - Build host C and C++ compiler |
---|
69 | |
---|
70 | - Host C and C++ cross compiler |
---|
71 | |
---|
72 | The RTEMS Source Builder requires you provide the build host C and C++ compiler |
---|
73 | and the final host C and C++ cross-compiler. The RSB will build the build host |
---|
74 | RTEMS compiler and the final host RTEMS C and C++ compiler, the output of this |
---|
75 | process. |
---|
76 | |
---|
77 | The Host C and C++ compiler is a cross-compiler that builds executables for the |
---|
78 | host you want the tools for. You need to provide these tools. For Windows a |
---|
79 | number of Unix operating systems provide MinGW tool sets as packages. |
---|
80 | |
---|
81 | The RSB will build an RTEMS tool set for the build host. This is needed when |
---|
82 | building the final host's RTEMS compiler as it needs to build RTEMS runtime |
---|
83 | code such as *libc* on the build host. |
---|
84 | |
---|
85 | TIP: Make sure the host's cross-compiler tools are in your path before run the |
---|
86 | RSB build command. |
---|
87 | |
---|
88 | TIP: Canadian Cross built tools will not run on the machine being used to build |
---|
89 | them so you should provide the ``--bset-tar-files`` and ``--no-install`` |
---|
90 | options. The option to not install the files lets you provide a prefix that |
---|
91 | does not exist or you cannot access. |
---|
92 | |
---|
93 | To perform a cross build add ``--host=`` to the command line. For example |
---|
94 | to build a MinGW tool set on FreeBSD for Windows add ``--host=mingw32`` |
---|
95 | if the cross compiler is ``mingw32-gcc``: |
---|
96 | |
---|
97 | .. code-block:: none |
---|
98 | |
---|
99 | $ ../source-builder/sb-set-builder --host=mingw32 \ |
---|
100 | --log=l-mingw32-4.11-sparc.txt \ |
---|
101 | --prefix=$HOME/development/rtems/5 \ |
---|
102 | 5/rtems-sparc |
---|
103 | |
---|
104 | If you are on a Linux Fedora build host with the MinGW packages installed the |
---|
105 | command line is: |
---|
106 | |
---|
107 | .. code-block:: none |
---|
108 | |
---|
109 | $ ../source-builder/sb-set-builder --host=i686-w64-mingw32 \ |
---|
110 | --log=l-mingw32-4.11-sparc.txt \ |
---|
111 | --prefix=$HOME/development/rtems/5 \ |
---|
112 | 5/rtems-sparc |
---|