1 | .. comment 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 NTP for RTEMS on your |
---|
21 | development machine. |
---|
22 | |
---|
23 | To build the NTP package for RTEMS you enter the RSB command:: |
---|
24 | |
---|
25 | $ ../source-builder/sb-set-builder \ |
---|
26 | --log=log_ntp_arm.txt \ |
---|
27 | --prefix=$HOME/development/rtems/4.11 \ <1> |
---|
28 | --host=arm-rtems4.11 \ <2> |
---|
29 | --with-rtems-bsp=xilinx_zynq_zc706 \ <3> |
---|
30 | 4.11/net/ntp |
---|
31 | |
---|
32 | .. topic:: Items: |
---|
33 | |
---|
34 | 1. The tools and the RTEMS BSP are installed under the same prefix. |
---|
35 | |
---|
36 | 2. The ``--host`` command is the RTEMS architecture and version. |
---|
37 | |
---|
38 | 3. The BSP is built and installed in the prefix. The arhcitecture must match |
---|
39 | the ``--host`` architecture. |
---|
40 | |
---|
41 | .. note: Installing Into Different Directories |
---|
42 | |
---|
43 | If you install BSPs into a different path to the prefix use the |
---|
44 | ``--with-tools`` option to specify the path to the tools. Do not add the |
---|
45 | 'bin' directory at the end of the path. |
---|
46 | |
---|
47 | Canadian Cross Building |
---|
48 | ----------------------- |
---|
49 | |
---|
50 | A Canadian cross builds are where the **build**, **host** and **target** |
---|
51 | machines all differ. For example building an RTEMS compiler for an ARM |
---|
52 | processor that runs on Windows is built using a Linux machine. The process is |
---|
53 | controlled by setting the build triplet to the host you are building, the host |
---|
54 | triplet to the host the tools will run on and the target to the RTEMS |
---|
55 | architecture you require. The tools needed by the RSB are: |
---|
56 | |
---|
57 | - Build host C and C++ compiler |
---|
58 | |
---|
59 | - Host C and C++ cross compiler |
---|
60 | |
---|
61 | The RTEMS Source Builder requires you provide the build host C and C++ compiler |
---|
62 | and the final host C and C++ cross-compiler. The RSB will build the build host |
---|
63 | RTEMS compiler and the final host RTEMS C and C++ compiler, the output of this |
---|
64 | process. |
---|
65 | |
---|
66 | The Host C and C++ compiler is a cross-compiler that builds executables for the |
---|
67 | host you want the tools for. You need to provide these tools. For Windows a |
---|
68 | number of Unix operating systems provide MinGW tool sets as packages. |
---|
69 | |
---|
70 | The RSB will build an RTEMS tool set for the build host. This is needed when |
---|
71 | building the final host's RTEMS compiler as it needs to build RTEMS runtime |
---|
72 | code such as *libc* on the build host. |
---|
73 | |
---|
74 | TIP: Make sure the host's cross-compiler tools are in your path before run the |
---|
75 | RSB build command. |
---|
76 | |
---|
77 | TIP: Canadian Cross built tools will not run on the machine being used to build |
---|
78 | them so you should provide the ``--bset-tar-files`` and ``--no-install`` |
---|
79 | options. The option to not install the files lets you provide a prefix that |
---|
80 | does not exist or you cannot access. |
---|
81 | |
---|
82 | To perform a cross build add ``--host=`` to the command line. For example |
---|
83 | to build a MinGW tool set on FreeBSD for Windows add ``--host=mingw32`` |
---|
84 | if the cross compiler is ``mingw32-gcc``:: |
---|
85 | |
---|
86 | $ ../source-builder/sb-set-builder --host=mingw32 \ |
---|
87 | --log=l-mingw32-4.11-sparc.txt \ |
---|
88 | --prefix=$HOME/development/rtems/4.11 \ |
---|
89 | 4.11/rtems-sparc |
---|
90 | |
---|
91 | If you are on a Linux Fedora build host with the MinGW packages installed the |
---|
92 | command line is:: |
---|
93 | |
---|
94 | $ ../source-builder/sb-set-builder --host=i686-w64-mingw32 \ |
---|
95 | --log=l-mingw32-4.11-sparc.txt \ |
---|
96 | --prefix=$HOME/development/rtems/4.11 \ |
---|
97 | 4.11/rtems-sparc |
---|