modify.md 3.49 KB
Newer Older
1
# Modifying Your OAI Build
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

This profile is meant to be a jumping-off point for creating your own
experiments. As such, you have access to the source code for OAI
itself, the ability to modify and recompile it, and you can even
create your own profiles by cloning this repository.

## Source Code

The source code for OAI is located in `/opt/oai` on both the `enb1`
and `epc` nodes. This source code is a snapshot of the [official
repositories](https://gitlab.eurecom.fr/oai).

The `/opt/oai` directory is a mounted blockstore which acts as a local
clone. It is both readable and writeable, but the changes you make
won't persist when your experiment is gone.

### Before Building

When building, installation will fail if the associated service is
still running. In addition, OAI is still a work in progress and is
therefore somewhat fragile when the services don't start up in the
right order. For these reasons, it is usually best to kill all
services before building from source and then restart them in the
correct order afterwards.

Run this on the `enb1` node:

29
    sudo /local/repository/bin/enb.kill.sh
30 31 32

Run this on the `epc` node:

33 34 35
    sudo /local/repository/bin/mme.kill.sh
    sudo /local/repository/bin/hss.kill.sh
    sudo /local/repository/bin/spgw.kill.sh
36 37 38 39 40 41 42 43

After these steps, rebuild whichever services you have modified as described below.

### Building the eNodeB

The official repository for the eNodeB source code is
[here](https://gitlab.eurecom.fr/oai/openairinterface5g) along with
[build
Jonathon Duerig's avatar
Jonathon Duerig committed
44
documentation](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/AutoBuild#install-build-enb). A
45 46 47 48 49
snapshot of that repository can be found on the `enb1` node in your
experiment located at `/opt/oai/openairinterface5g`.

You can see exactly which commit this blockstore was forked from:

50 51
    cd /opt/oai/openairinterface5g
    git log
52 53 54 55 56 57 58

Aside from a minor patch which slimmed down the build dependencies,
this is a snapshot of the development branch of the repository.

If you would like to rebuild the source after making some
modification, first kill the enodeb service:

59 60
    cd /opt/oai/openairinterface5g/cmake_targets
    sudo ./build_oai --eNB -w USRP
61 62 63 64 65 66 67 68 69 70 71 72

### Building the MME, HSS, or SPGW

The core network services have a separate
[repository](https://gitlab.eurecom.fr/oai/openair-cn) and are built
using a slightly different
[procedure](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/AutoBuild#building-the-epc-modules-newer-version-latest-developmaster-branch). The
snapshot for this repository is located on the `epc` node in your
experiment in the `/opt/oai/openair-cn` directory.

To build the MME from source:

73 74
    cd /opt/oai/openair-cn/SCRIPTS
    sudo ./build_mme
75 76 77

To build the HSS from source:

78 79
    cd /opt/oai/openair-cn/SCRIPTS
    sudo ./build_hss
80 81

To build the SPGW from source:
82 83 84

    cd /opt/oai/openair-cn/SCRIPTS
    sudo ./build_spgw
85 86 87 88


### Restarting After Rebuilding

89
You can re-run the startup script on either `enb1` or `epc` nodes. This
90 91 92 93 94
will start all services again and syncronize their startups to ensure
the start in the proper order.

On the `epc` node:

95
    sudo /local/repository/bin/start_oai.pl
96 97 98 99 100 101 102

### Saving Source Code Changes Permanently

In order to save changes permanently, you will need an external git
repository. Then add it as a remote in `/opt/oai/openair-cn` or
`/opt/oai/openairinterface5g` and push up your changes.

103 104 105
    cd /opt/oai/openair-cn
    git remote add myrepo url-or-ssh-path-to-my-repo
    git push myrepo
106 107 108

Then on later experiments you can add your experiment as a remote,
pull, and rebuild.