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 \ |
| 16 | libsctp-dev sqlite3 |
| 17 | |
| 18 | ./gen_makefile.py 3G+2G.deps default.opts iu.opts -I -m make |
| 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 | |
| 43 | Run ./gen_makefile.py with a choice of projects (2G only or also 3G?) |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 44 | and a choice of configure options. |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 45 | |
Neels Hofmeyr | 00e6a57 | 2017-09-20 19:41:09 +0200 | [diff] [blame] | 46 | |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 47 | Examples: |
| 48 | |
| 49 | Full 2G and 3G support: |
| 50 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 51 | ./gen_makefile.py 3G+2G.deps default.opts iu.opts -m make |
| 52 | cd make |
| 53 | make |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 54 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 55 | 2G only, and a custom dir name of 'make-2G': |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 56 | |
Neels Hofmeyr | 95ea8ec | 2017-09-06 18:54:58 +0200 | [diff] [blame] | 57 | ./gen_makefile.py 2G.deps default.opts -m make-2G |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 58 | cd make-2G |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 59 | make |
| 60 | |
| 61 | If you make modifications in one of the source trees, this Makefile will pick |
| 62 | it up, rebuild the project and also rebuild all dependencies (according to the |
| 63 | *.deps file the Makefile was generated from). |
| 64 | |
| 65 | If you modify the *.deps or *.opts file, you can easily run 'make regen' in a |
| 66 | make-* subdir to regenerate the Makefile from the same files. |
| 67 | |
| 68 | In your make-* subdir there are empty status files that are touched for every |
| 69 | completed make target. From these, 'make' can detect what needs to be rebuilt. |
| 70 | You can manually remove them to force a rebuild of a specific target. |
| 71 | |
| 72 | For example, if you 'rm .make.libosmocore.autoconf', libosmocore and all |
| 73 | projects depending on libosmocore will be rebuilt from scratch. |
| 74 | |
| 75 | For more details on the *.opts and *.deps syntax, read the docs at the top of |
| 76 | ./gen_makefile.py. |
| 77 | |
| 78 | It is also easily possible to keep sources and build trees in various |
| 79 | configurations, see the command line options of ./gen_makefile.py. |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 80 | |
| 81 | |
Neels Hofmeyr | 7aeaf42 | 2018-11-19 02:54:11 +0100 | [diff] [blame] | 82 | === Install in /usr |
| 83 | |
| 84 | By default, the Osmocom install prefix is /usr/local, while (currently) the |
| 85 | default systemd *.service files expect binaries installed in /usr/bin. To |
| 86 | install in /usr instead, use prefix_usr.opts, which sets --prefix=/usr. |
| 87 | |
| 88 | |
Neels Hofmeyr | 1cbec19 | 2018-11-19 02:56:04 +0100 | [diff] [blame] | 89 | === Systemd Service Files |
| 90 | |
| 91 | If you encounter problems installing *.service files, no_systemd.opts may help: |
| 92 | |
| 93 | Systemd recommends installing service files in the distribution's single |
| 94 | service file location; that may sound sane, but if that location is |
| 95 | /lib/systemd/system, that means even a --prefix=/home/private/prefix ends up |
| 96 | trying to install service files system-wide in /lib/systemd/system, making all |
| 97 | attempts to install to a user-writable location fail. |
| 98 | |
| 99 | no_systemd.opts disables installing *.service files. |
| 100 | |
| 101 | |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 102 | === Build Environment |
| 103 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 104 | For dependencies, see the "External dependencies" on: |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 105 | |
| 106 | https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source |
| 107 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 108 | If /usr/local/ is not writable by your user, pass the --sudo-make-install |
| 109 | option to gen_makefile.py above (a custom --prefix is not yet supported). |
| 110 | |
| 111 | If your system doesn't have this by default, you will need: |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 112 | |
| 113 | export LD_LIBRARY_PATH="/usr/local/lib" |
| 114 | |
| 115 | and |
| 116 | |
| 117 | export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" |
| 118 | |
| 119 | to your environment. To use the installed binaries after installation, also |
| 120 | |
| 121 | export PATH="$PATH:/usr/local/bin" |
| 122 | |
| 123 | |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 124 | === osmo-uninstall.sh |
| 125 | |
| 126 | Remove osmocom built binaries and headers from given prefix, |
| 127 | default is /usr/local. |
Neels Hofmeyr | f6402d8 | 2017-09-04 04:32:21 +0200 | [diff] [blame] | 128 | |
| 129 | |
| 130 | === src/* |
| 131 | |
| 132 | Find other useful scripts in src/, see src/README. |
Neels Hofmeyr | c3adf3e | 2018-11-06 15:35:37 +0100 | [diff] [blame] | 133 | |
| 134 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 135 | === ttcn3/ttcn3.sh |
| 136 | |
Oliver Smith | 8bdd7ab | 2020-05-05 14:16:35 +0200 | [diff] [blame] | 137 | Run a given testsuite with docker, so it behaves exactly the same as when |
| 138 | jenkins runs it [1], but use osmo-dev to build all related Osmocom components |
| 139 | and the testsuite, and mount them inside the docker containers. After building |
| 140 | the docker containers for the first time (which takes rather long), this gives |
| 141 | short test cycles: just modify something, run the script again and the relevant |
| 142 | objects will be built directly, already built objects do not need to be |
| 143 | rebuilt. (This is a big speed improvement over just using docker containers as |
| 144 | you don't need to push your sources to a git server first, have the docker |
| 145 | containers fetch the git sources and build the modified component from scratch |
| 146 | again.) |
| 147 | |
| 148 | The docker containers are used, so we don't have to maintain a second set of |
| 149 | configs which works without docker (that was tried before, and found not to be |
| 150 | feasible). |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 151 | |
| 152 | Example usage: |
| 153 | |
| 154 | ./ttcn3/ttcn3.sh mgw |
Oliver Smith | f3eb0ba | 2021-08-10 15:41:47 +0200 | [diff] [blame] | 155 | IMAGE_SUFFIX=latest ./ttcn3/ttcn3.sh mgw |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 156 | |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 157 | More about the testsuites: |
| 158 | https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites |
| 159 | |
Oliver Smith | 8bdd7ab | 2020-05-05 14:16:35 +0200 | [diff] [blame] | 160 | [1] https://jenkins.osmocom.org/jenkins/view/TTCN3/ |
Oliver Smith | e398564 | 2019-10-11 16:37:59 +0200 | [diff] [blame] | 161 | |
Neels Hofmeyr | c3adf3e | 2018-11-06 15:35:37 +0100 | [diff] [blame] | 162 | === Troubleshooting |
| 163 | |
| 164 | When using sanitize.opts, osmo-trx is not built with the address sanitizer |
| 165 | enabled. Linking a sanitizer-enabled libosmocore will not work. |