User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:howto:turris_os_build [2018/06/07 11:27]
kkoci [Compiling Turris OS]
en:howto:turris_os_build [2018/09/05 17:39] (current)
jschlehofer Docker for now is no longer available
Line 11: Line 11:
 ===== Preparing the development environment ===== ===== Preparing the development environment =====
  
-The best way to guarantee a smooth compilation process is to use an identical environment to the one used in production. Best is to have a container with this environment,​ which will enable the separation of the main system from the system for compilation. There are two supported ways of doing this, either by using a tool called [[https://​www.vagrantup.com/​|Vagrant]] ​or using Docker. ​+The best way to guarantee a smooth compilation process is to use an identical environment to the one used in production. Best is to have a container with this environment,​ which will enable the separation of the main system from the system for compilation. There is currently one way how to doing it via tool called [[https://​www.vagrantup.com/​|Vagrant]]
  
 ==== Vagrant ==== ==== Vagrant ====
Line 34: Line 34:
  
 To access the development system the command ''​vagrant ssh''​ can be run in Turris repository directory. This opens up an SSH connection to the container with the development environment and it can now be used as normal system. The directory synchronized with the Turris OS repository is accessible through the path ''/​openwrt''​. To access the development system the command ''​vagrant ssh''​ can be run in Turris repository directory. This opens up an SSH connection to the container with the development environment and it can now be used as normal system. The directory synchronized with the Turris OS repository is accessible through the path ''/​openwrt''​.
- 
-==== Docker ==== 
- 
-Docker is in comparison with the Vagrant tool more widespread, and thus it is possible that it is already installed and configured on your system. The files needed to create Docker containers are located in the cloned Turris OS repository in the directory '​Docker'​. The necessary files are the scripts: ''​build-all''​ and ''​run''​ and especially files describing Docker containers. 
-The first step is to create containers. The script ''​build-all''​ contains five lines calling ''​docker'',​ which create five containers. Their names and meaning are the following: 
- 
- 
- * //base// -- basic system containing all the dependencies needed to build Turris OS. Source codes are cloned in the directory '/ home / build / openwrt'​ in the latest version of the '​test'​ branch (a branch which is now being developed). 
- * //​omnia-toolchain//​ -- requires the //base// and builds on it. It is the place where the configuration for Turris Omnia is and it contains the compiled toolchain. Packages, however, are not compiled. This can be useful, if you need to adjust a single package only, not the whole system. 
- * //omnia// -- requires and is based on the //​omnia-toolchain//​. The container accommodates the basic system and the system for Turris Omnia. This container, however, ​ not all of the packages are compiled (this would require a large amount of time). 
- * //​turris-toolchain//​ - requires and builds on the //base//. It has configurations for Turris 1.x and the compiled toolchain. The packages, however, are not compiled. This can be useful if you need to compile only one package, not the whole system. 
- * //turris// - requires and builds on //​turris-toolchain//​. The container is designed for the basic system of Turris 1.x and so compilation should be quick. But even in this case, not all packages are compiled (that would require a large amount of time). 
- 
-To save time and space you can remove the lines for the platform, which is not relevant to you. Then run the script ''​build-all''​. This process may take hours, depending on the performance of the hardware on which the compilation runs and on which you are creating the containers. 
- 
-After the containers are created, it is possible to access them using the ''​Run''​ script. This script requires the name of the container (e.g. './run Omnia'​) as the first argument. If no arguments are passed, it will attempt to attach to the container //​omnia-toolchain//​. 
- 
-<WRAP important>​ 
-Beware! As far as the Docker is concerned, after the end of the container all changes are discarded if not set otherwise. 
-Also unlike the Vagrant tools, Docker does not work with your original cloned repository. 
-</​WRAP>​ 
- 
-In the following sections distinguish which container you chose to use. In case of //base//, you have to perform the procedure as described. For other Docker containers you do not need to update feeds and configuration settings, you can move straight to the compilation. In that case it is also not recommended to use ''​compile_fw''​ script because that first cleans the repository. 
  
 ==== Installation without Vagrant environment ==== ==== Installation without Vagrant environment ====
Line 80: Line 57:
 If you encounter problems with build then you can try to change ''​-j''​ value or you can just use ''​-j1''​ to disable build in parallel. These problems are caused by race conditions in build and by hard to discover missing dependencies. If you encounter problems with build then you can try to change ''​-j''​ value or you can just use ''​-j1''​ to disable build in parallel. These problems are caused by race conditions in build and by hard to discover missing dependencies.
 </​WRAP>​ </​WRAP>​
-===== Troubleshooting ===== 
- 
-==== Insufficient space when creating the Docker container ​ ==== 
- 
-Docker containers usually take up tens of gigabytes. If their creation failed because of insufficient space, then you should check, if you really have run out of space and clear it. If you however have enough space, then you might need to adjust the configuration of the Docker daemon with the use of these options ​ ''​%%--%%storage-opt dm.basesize=40G %%--%%storage-opt dm.loopmetadatasize=10G''​. 
- 
-The resulting configuration should look something like this:  
- 
- dockerd -H fd:// --storage-opt dm.basesize=40G --storage-opt dm.loopmetadatasize=10G 
- 
-After this adjustment it is necessary to restart the Docker daemon and remove all generated files for the change to apply. The exact path of the files depends on your system, but it is usually ''/​var/​lib/​docker''​.