Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 1 | === WHAT IS THIS? |
| 2 | |
| 3 | * quickly build the entire Osmocom core network stack from source, with a |
| 4 | generated top-level makefile (see the rest of this README file below). |
| 5 | |
| 6 | * quickly configure, launch and tear down an entire Osmocom core network on |
| 7 | your box (see net/README). |
| 8 | |
| 9 | |
Neels Hofmeyr | 569f8ff | 2018-01-06 21:20:28 +0100 | [diff] [blame] | 10 | === Quick Start |
| 11 | |
| 12 | sudo apt install \ |
| 13 | build-essential gcc g++ make automake autoconf libtool pkg-config \ |
| 14 | libtalloc-dev libpcsclite-dev libortp-dev libsctp-dev libssl-dev libdbi-dev \ |
| 15 | libdbd-sqlite3 libsqlite3-dev libpcap-dev libc-ares-dev libgnutls28-dev \ |
Oliver Smith | aa015b1 | 2021-12-10 17:10:25 +0100 | [diff] [blame] | 16 | libsctp-dev sqlite3 libusb-1.0-0-dev libmnl-dev libsofia-sip-ua-glib-dev |
Neels Hofmeyr | 569f8ff | 2018-01-06 21:20:28 +0100 | [diff] [blame] | 17 | |
Oliver Smith | aa015b1 | 2021-12-10 17:10:25 +0100 | [diff] [blame] | 18 | ./gen_makefile.py default.opts iu.opts no_dahdi.opts -I -m make |
Neels Hofmeyr | 569f8ff | 2018-01-06 21:20:28 +0100 | [diff] [blame] | 19 | |
| 20 | cd make |
| 21 | make |
| 22 | |
| 23 | - 'make' will ask for sudo password to run 'make install' and 'ldconfig'. |
| 24 | To run non-interactively: |
| 25 | |
| 26 | - 'make install': |
| 27 | chown $USER: /usr/local |
| 28 | Then call gen_makefile.py once without the -I option |
| 29 | |
| 30 | - 'ldconfig': |
| 31 | echo "$USER ALL= NOPASSWD: /sbin/ldconfig" > /etc/sudoers.d/ldconfig |
| 32 | |
| 33 | |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 34 | === gen_makefile.py |
| 35 | |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 36 | This provides a set of top-level makefiles to build variants of the Osmocom |
| 37 | source trees. It is inteded for the core network components and related |
| 38 | projects, but works generically. |
| 39 | |
| 40 | The idea is to have all your Osmocom git clones in ./src, while keeping one or |
| 41 | more separate build trees in ./make-*. |
| 42 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 43 | Run ./gen_makefile.py with a choice of choice of configure options. |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 44 | |
Neels Hofmeyr | 00e6a57 | 2017-09-20 19:41:09 +0200 | [diff] [blame] | 45 | |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 46 | Examples: |
| 47 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 48 | CN with full 2G and 3G support: |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 49 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 50 | ./gen_makefile.py default.opts iu.opts -m make |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 51 | cd make |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 52 | make cn |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 53 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 54 | Other make targets exist for specific use cases: |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 55 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 56 | - 'usrp': |
| 57 | Build the CN, OsmoBSC, OsmoBTS and OsmoTRX (default, e.g. when connecting |
| 58 | to an USRP) |
| 59 | |
| 60 | - 'cn-bsc': |
| 61 | Build the CN and OsmoBSC (e.g. when connecting to an external sysmoBTS) |
| 62 | |
| 63 | - 'osmo-msc': |
| 64 | Build only the OsmoMSC project and its dependencies (this can be used for |
| 65 | any project in all.deps). |
| 66 | |
| 67 | - '.make.osmo-ttcn3-hacks.clone' |
| 68 | Clone the osmo-ttcn3-hacks git repository (it cannot be built by osmo-dev, |
| 69 | but cloning it is still useful.) |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 70 | |
| 71 | If you make modifications in one of the source trees, this Makefile will pick |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 72 | it up, rebuild the project and also rebuild all dependencies (according to |
| 73 | all.deps). |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 74 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 75 | If you modify the all.deps or *.opts file, you can easily run 'make regen' in a |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 76 | make-* subdir to regenerate the Makefile from the same files. |
| 77 | |
| 78 | In your make-* subdir there are empty status files that are touched for every |
| 79 | completed make target. From these, 'make' can detect what needs to be rebuilt. |
| 80 | You can manually remove them to force a rebuild of a specific target. |
| 81 | |
| 82 | For example, if you 'rm .make.libosmocore.autoconf', libosmocore and all |
| 83 | projects depending on libosmocore will be rebuilt from scratch. |
| 84 | |
Oliver Smith | 0a4d8ea | 2021-07-29 14:32:29 +0200 | [diff] [blame] | 85 | For more details on the *.opts and all.deps syntax, read the docs at the top of |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 86 | ./gen_makefile.py. |
| 87 | |
| 88 | It is also easily possible to keep sources and build trees in various |
| 89 | configurations, see the command line options of ./gen_makefile.py. |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 90 | |
| 91 | |
Neels Hofmeyr | 7aeaf42 | 2018-11-19 02:54:11 +0100 | [diff] [blame] | 92 | === Install in /usr |
| 93 | |
| 94 | By default, the Osmocom install prefix is /usr/local, while (currently) the |
| 95 | default systemd *.service files expect binaries installed in /usr/bin. To |
| 96 | install in /usr instead, use prefix_usr.opts, which sets --prefix=/usr. |
| 97 | |
| 98 | |
Neels Hofmeyr | 1cbec19 | 2018-11-19 02:56:04 +0100 | [diff] [blame] | 99 | === Systemd Service Files |
| 100 | |
| 101 | If you encounter problems installing *.service files, no_systemd.opts may help: |
| 102 | |
| 103 | Systemd recommends installing service files in the distribution's single |
| 104 | service file location; that may sound sane, but if that location is |
| 105 | /lib/systemd/system, that means even a --prefix=/home/private/prefix ends up |
| 106 | trying to install service files system-wide in /lib/systemd/system, making all |
| 107 | attempts to install to a user-writable location fail. |
| 108 | |
| 109 | no_systemd.opts disables installing *.service files. |
| 110 | |
| 111 | |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 112 | === Build Environment |
| 113 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 114 | For dependencies, see the "External dependencies" on: |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 115 | |
| 116 | https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source |
| 117 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 118 | If /usr/local/ is not writable by your user, pass the --sudo-make-install |
| 119 | option to gen_makefile.py above (a custom --prefix is not yet supported). |
| 120 | |
| 121 | If your system doesn't have this by default, you will need: |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 122 | |
| 123 | export LD_LIBRARY_PATH="/usr/local/lib" |
| 124 | |
| 125 | and |
| 126 | |
| 127 | export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" |
| 128 | |
| 129 | to your environment. To use the installed binaries after installation, also |
| 130 | |
| 131 | export PATH="$PATH:/usr/local/bin" |
| 132 | |
| 133 | |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 134 | === osmo-uninstall.sh |
| 135 | |
| 136 | Remove osmocom built binaries and headers from given prefix, |
| 137 | default is /usr/local. |
Neels Hofmeyr | f6402d8 | 2017-09-04 04:32:21 +0200 | [diff] [blame] | 138 | |
| 139 | |
| 140 | === src/* |
| 141 | |
| 142 | Find other useful scripts in src/, see src/README. |
Neels Hofmeyr | c3adf3e | 2018-11-06 15:35:37 +0100 | [diff] [blame] | 143 | |
| 144 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 145 | === ttcn3/ttcn3.sh |
| 146 | |
Oliver Smith | 8bdd7ab | 2020-05-05 14:16:35 +0200 | [diff] [blame] | 147 | Run a given testsuite with docker, so it behaves exactly the same as when |
| 148 | jenkins runs it [1], but use osmo-dev to build all related Osmocom components |
| 149 | and the testsuite, and mount them inside the docker containers. After building |
| 150 | the docker containers for the first time (which takes rather long), this gives |
| 151 | short test cycles: just modify something, run the script again and the relevant |
| 152 | objects will be built directly, already built objects do not need to be |
| 153 | rebuilt. (This is a big speed improvement over just using docker containers as |
| 154 | you don't need to push your sources to a git server first, have the docker |
| 155 | containers fetch the git sources and build the modified component from scratch |
| 156 | again.) |
| 157 | |
| 158 | The docker containers are used, so we don't have to maintain a second set of |
| 159 | configs which works without docker (that was tried before, and found not to be |
| 160 | feasible). |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 161 | |
| 162 | Example usage: |
| 163 | |
| 164 | ./ttcn3/ttcn3.sh mgw |
Oliver Smith | f3eb0ba | 2021-08-10 15:41:47 +0200 | [diff] [blame] | 165 | IMAGE_SUFFIX=latest ./ttcn3/ttcn3.sh mgw |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 166 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 167 | More about the testsuites: |
| 168 | https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites |
| 169 | |
Oliver Smith | 8bdd7ab | 2020-05-05 14:16:35 +0200 | [diff] [blame] | 170 | [1] https://jenkins.osmocom.org/jenkins/view/TTCN3/ |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 171 | |
Vadim Yanitskiy | 3414a48 | 2021-12-09 21:42:58 +0300 | [diff] [blame] | 172 | === ttcn3/tmux |
| 173 | |
| 174 | It's possible to run TTCN-3 test cases without using Docker. This directory |
| 175 | contains scripts for starting a testsuite and the related binaries in a tmux |
| 176 | session. For example, ttcn3-bsc-test.sh does the following: |
| 177 | |
| 178 | * Starts osmo-bsc, osmo-stp, and three instances of osmo-bts-omldummy. |
| 179 | * Prepares a command for execuring the test suite. |
| 180 | |
Neels Hofmeyr | c3adf3e | 2018-11-06 15:35:37 +0100 | [diff] [blame] | 181 | === Troubleshooting |
| 182 | |
| 183 | When using sanitize.opts, osmo-trx is not built with the address sanitizer |
| 184 | enabled. Linking a sanitizer-enabled libosmocore will not work. |