1 | RTEMS LibBSD Waf |
---|
2 | ~~~~~~~~~~~~~~~~ |
---|
3 | |
---|
4 | Welcome to building LibBSD for RTEMS using Waf. This package is a library |
---|
5 | containing various parts of the FreeBSD kernel ported to RTEMS. The library |
---|
6 | replaces the networking port of FreeBSD in the RTEMS kernel sources. This |
---|
7 | package is designed to be updated from the FreeBSD kernel sources and contains |
---|
8 | more than just the networking code. |
---|
9 | |
---|
10 | To build this package you need a current RTEMS tool set for your architecture, |
---|
11 | and a recent RTEMS kernel for your BSP configured with networking disabled |
---|
12 | built and installed. If you already have this you can skip to step 3 of the |
---|
13 | build procedure. |
---|
14 | |
---|
15 | Waf Setup |
---|
16 | ~~~~~~~~~ |
---|
17 | |
---|
18 | You can find the Waf project at: |
---|
19 | |
---|
20 | https://waf.io/ |
---|
21 | |
---|
22 | Waf is not intended to be installed by distribution packages so we recommend |
---|
23 | you download a recent waf version and install it in your home directory. |
---|
24 | |
---|
25 | Waf is a Python program so you will also need to have a current Python version |
---|
26 | installed and in your path. |
---|
27 | |
---|
28 | Download the latest signed executable file version to $HOME/bin and symlink it |
---|
29 | to waf. Add the directory $HOME/bin to your path if it is not already in your |
---|
30 | default path. |
---|
31 | |
---|
32 | Building and Installing LibBSD |
---|
33 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
34 | |
---|
35 | The following instructions show you how to build and install RTEMS Tools and |
---|
36 | RTEMS kernel for your BSP in separate paths. Using separate paths for the tools |
---|
37 | and BSPs lets you manage what you have installed. If you are happy with a |
---|
38 | single path you can use the same path in each stage. |
---|
39 | |
---|
40 | The waf build support for RTEMS requires you provide your BSP name as an |
---|
41 | architecture and BSP pair. You must provide both or waf will generate an error |
---|
42 | message during the configure phase. |
---|
43 | |
---|
44 | We will build an ARM Realview PBX A9 QEMU BSP using the name |
---|
45 | 'arm/realview_pbx_a9_qemu'. |
---|
46 | |
---|
47 | Steps |
---|
48 | ----- |
---|
49 | |
---|
50 | 1. Clone the RTEMS Source Build (RSB): |
---|
51 | |
---|
52 | $ git clone git://git.rtems.org/rtems-source-builder.git |
---|
53 | |
---|
54 | 2. Build and install the tools. In this example the path is |
---|
55 | /opt/rtems/4.12/tools: |
---|
56 | |
---|
57 | $ cd rtems-source-builder/rtems |
---|
58 | $ ../source-builder/sb-set-builder \ |
---|
59 | --prefix=/opt/rtems/4.12/tools 4.12/rtems-arm |
---|
60 | |
---|
61 | 3. Clone RTEMS: |
---|
62 | |
---|
63 | $ git clone git://git.rtems.org/rtems.git rtems-4.12 |
---|
64 | |
---|
65 | 4. Bootstrap the RTEMS sources: |
---|
66 | |
---|
67 | $ cd rtems-4.12 |
---|
68 | $ ./bootstrap |
---|
69 | |
---|
70 | 5. Build and install the RTEMS Board Support Packages (BSP) you want to use. In |
---|
71 | this example the path is /opt/rtems/4.12/bsps: |
---|
72 | |
---|
73 | $ mkdir b-realview_pbx_a9_qemu |
---|
74 | $ cd b-realview_pbx_a9_qemu |
---|
75 | $ ../rtems-4.12/configure \ |
---|
76 | --target=arm-rtems4.12 --prefix=/opt/rtems/4.12/bsps \ |
---|
77 | --disable-networking --enable-rtemsbsp=realview_pbx_a9_qemu |
---|
78 | $ make |
---|
79 | $ make install |
---|
80 | |
---|
81 | 6. Populate the rtems_waf git submodule: |
---|
82 | |
---|
83 | $ cd rtems-libbsd |
---|
84 | $ git submodule init |
---|
85 | $ git submodule update rtems_waf |
---|
86 | |
---|
87 | Note, make sure you specify 'rtems_waf' or the FreeBSD kernel source will be |
---|
88 | cloned. |
---|
89 | |
---|
90 | 7. Run Waf's configure with your specific settings. In this case the path to |
---|
91 | the tools and RTEMS are provided on the command line and so do not need to |
---|
92 | be in your path or environment [1]: |
---|
93 | |
---|
94 | $ waf configure --prefix=/opt/rtems/4.12/bsps \ |
---|
95 | --rtems=/opt/rtems/4.12/bsps \ |
---|
96 | --rtems-tools=/opt/rtems/4.12/tools \ |
---|
97 | --rtems-bsps=arm/realview_pbx_a9_qemu |
---|
98 | |
---|
99 | You can use '--rtems-archs=arm,sparc,i386' or |
---|
100 | '--rtems-bsps=arm/realview_pbx_a9_qemu,sparc/sis,i386/pc586' to build for |
---|
101 | more than BSP at a time. |
---|
102 | |
---|
103 | Note, you must provide the architecture and BSP as a pair. Providing just the |
---|
104 | BSP name will fail. |
---|
105 | |
---|
106 | 8. Build and install: |
---|
107 | |
---|
108 | The LibBSD package will be installed into the prefix provided to configure. |
---|
109 | |
---|
110 | $ waf |
---|
111 | $ waf install |
---|
112 | |
---|
113 | [1] It is good practice to keep your environment as empty as possible. Setting |
---|
114 | paths to tools or specific values to configure or control a build is |
---|
115 | dangerous because settings can leak between different builds and change |
---|
116 | what you expect a build to do. The waf tool used here lets you specify on |
---|
117 | the command line the tools and RTEMS paths and this is embedded in waf's |
---|
118 | configuration information. If you have a few source trees working at any |
---|
119 | one time with different tool sets or configurations you can easly move |
---|
120 | between them safe in the knowledge that one build will not infect another. |
---|
121 | |
---|
122 | Updating RTEMS Waf Support |
---|
123 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
124 | |
---|
125 | If you have a working libbsd repository and new changes to the `rtems_waf` |
---|
126 | submodule has been made, you will need update. A `git status` will indicate |
---|
127 | there are new commits with: |
---|
128 | |
---|
129 | $ git status |
---|
130 | [ snip output ] |
---|
131 | modified: rtems_waf (new commits) |
---|
132 | [ snip output ] |
---|
133 | |
---|
134 | To update: |
---|
135 | |
---|
136 | $ git submodule update rtems_waf |
---|
137 | |
---|
138 | Please make sure you use the exact command or you might find you are cloning |
---|
139 | the whole of the FreeBSD source tree. If that happens simply git ^C and try |
---|
140 | again. |
---|
141 | |
---|
142 | The following is for developers only who need to move libbsd to a newer |
---|
143 | versions: |
---|
144 | |
---|
145 | $ git submodule update rtems_waf |
---|
146 | $ cd rtems_waf |
---|
147 | $ git checkout master |
---|
148 | $ git pull |
---|
149 | $ cd .. |
---|
150 | $ git commit -m "Update rtems_waf" rtems_waf |
---|
151 | |
---|
152 | FreeBSD Developer Support |
---|
153 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
154 | |
---|
155 | The --freebsd-option provides a tool you can set special kernel options. This |
---|
156 | is a developer tool and should only be used if you are familiar with the |
---|
157 | internals of the FreeBSD kernel and what these options do. |
---|
158 | |
---|
159 | The options are listed in: |
---|
160 | |
---|
161 | https://github.com/freebsd/freebsd/blob/master/sys/conf/NOTES |
---|
162 | |
---|
163 | An example to turn on a verbose kernel boot, verbose sysinit and bus debugging |
---|
164 | configure with: |
---|
165 | |
---|
166 | --freebsd-options=bootverbose,verbose_sysinit,bus_debug |
---|
167 | |
---|
168 | The LibBSD waf support splits the options and converts them to uppercase and |
---|
169 | adds them -D options on the compiler command line. |
---|