github.com/coreos/rocket@v1.30.1-0.20200224141603-171c416fac02/Documentation/devel/quickstart-dev.md (about) 1 # Preparing development environment and first rkt build 2 3 This is an example configuration and quick start guide for the installation of rkt from source on Ubuntu 16.04 GNOME. For a detailed developer's reference, see [the rkt hacking guide][rkt-hacking]. 4 5 ## Get rkt repo and install dependencies 6 7 In this example ~/Repos is a personal workspace where all repos are stored 8 9 ```sh 10 $ mkdir ~/Repos && cd ~/Repos 11 $ mkdir -p ~/.local/gopath/src/github.com/rkt 12 $ sudo apt-get install git 13 $ git -C ~/.local/gopath/src/github.com/rkt clone https://github.com/rkt/rkt.git 14 $ ln -s ~/.local/gopath/src/github.com/rkt/rkt rkt 15 ``` 16 17 On a fresh system installation, few additional software packages are needed to correctly build rkt: 18 19 ```sh 20 $ sudo ~/Repos/rkt/scripts/install-deps-debian-sid.sh 21 ``` 22 23 See also [the dependencies page][rkt-dependencies]. 24 25 ## Installing Go Programming Language for a single-user 26 27 ``` 28 $ cd ~/Downloads 29 $ wget https://storage.googleapis.com/golang/go1.6.1.linux-amd64.tar.gz 30 $ tar -xvf go1.6.1.linux-amd64.tar.gz 31 $ mv go ~/.local 32 ``` 33 34 Add GO variables to .bashrc file: 35 36 ```sh 37 export PATH=~/.local/bin:~/.local/go/bin:$PATH 38 export GOPATH=~/.local/gopath 39 export GOROOT=~/.local/go 40 ``` 41 42 ## Install ccache (optional step) 43 44 Ccache can save a lot of time. If you build a kernel once, most of the compiled code can just be taken from the cache. 45 Ccache can be configured in a few easy steps: 46 47 ```sh 48 $ sudo apt-get install ccache 49 $ ccache --max-size=10G 50 $ sudo ln -s /usr/bin/ccache /usr/local/bin/gcc 51 ``` 52 53 The maximum cache size is 10GB now (the default value is too small to cache kernel compilation). 54 55 ## Building rkt 56 57 Run the autogen and configure commands with the relevant arguments, for example (kvm as flavor): 58 59 ```sh 60 $ cd ~/Repos/rkt 61 $ ./autogen.sh && ./configure --enable-functional-tests --enable-incremental-build --with-stage1-flavors=kvm 62 ``` 63 64 Now build rkt with: 65 66 ```sh 67 $ make V=2 -j 68 ``` 69 70 REMEMBER: If you want to test somebody else's changes: 71 72 ```sh 73 $ git checkout <branch> 74 $ make clean 75 $ ./autogen.sh && ./configure <proper arguments> 76 ``` 77 78 ## A few useful commands 79 80 ### Just build and run tests: 81 82 ```sh 83 $ ./tests/build-and-run-tests.sh -f kvm 84 ``` 85 86 ### Run only functional tests after build: 87 88 ```sh 89 $ make functional-check 90 ``` 91 92 ### Check only one test: 93 94 ```sh 95 $ make functional-check GO_TEST_FUNC_ARGS='-run TEST_NAME_HERE' 96 ``` 97 98 See more in [the tests readme][rkt-tests-readme] page. 99 100 ### Simple usage of rkt container (run, exit, remove): 101 102 ```sh 103 $ sudo ./build-rkt-*/bin/rkt run --insecure-options=image --interactive docker://busybox 104 $ exit 105 $ sudo ./build-rkt-*/bin/rkt gc --grace-period=0 106 ``` 107 108 ### Remove all network interfaces created by rkt: 109 110 ```sh 111 for link in $(ip link | grep rkt | cut -d':' -f2 | cut -d'@' -f1); 112 sudo ip link del "${link}" 113 done 114 ``` 115 116 ### Simplify changes in go files, before commit: 117 118 ```sh 119 gofmt -s -w file.go 120 ``` 121 122 [rkt-hacking]: ../hacking.md 123 [rkt-dependencies]: ../dependencies.md 124 [rkt-tests-readme]: ../../tests/README.md