Skip to content

Commit d3be56f

Browse files
authored
Merge pull request #1091 from Pinata-Consulting/docker-run-script
docker: add a ./or script to run GUI from within docker image
2 parents 0f102f7 + a9d42d8 commit d3be56f

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

flow/util/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Building example design using Docker image
2+
==========================================
3+
4+
The `docker_shell` script is used as a prefix to launch a command within the OpenROAD docker image.
5+
6+
This script is set up to run the OpenROAD GUI from
7+
within the Docker image on the host platform.
8+
9+
Also, the current working directory is mapped into the Docker image using the current user's credentials.
10+
11+
Build docker image
12+
------------------
13+
14+
First build the docker image:
15+
16+
```
17+
cd OpenROAD-flow-scripts
18+
sudo ./setup.sh
19+
./build_openroad.sh
20+
```
21+
22+
Build an example design and run the GUI:
23+
24+
```
25+
cd flow
26+
util/docker_shell make
27+
util/docker_shell make gui_final
28+
```
29+
30+
You can also launch an interactive bash session:
31+
32+
```
33+
util/docker_shell bash
34+
```
35+
36+
If you need to use a different Docker image than default, override by using the `docker_shell_IMAGE`
37+
environment variable:
38+
39+
```
40+
OR_IMAGE=openroad/flow-centos7-builder:v1234 util/docker_shell make
41+
```
42+
43+
Using `docker_shell` from outside of `OpenROAD-flow-scripts/flow` folder
44+
------------------------------------------------------------------------
45+
46+
If you have designs you are keeping in a git source repository that is not
47+
a fork of the OpenROAD-flow-scripts git repository, you can still use
48+
the `docker_shell` script.
49+
50+
Two ways to use `docker_shell`
51+
52+
1. Simply invoke it from the ORFS location.
53+
2. Copy the script into your source folder. This would allow you
54+
to build and publish a Docker image to a private Docker repository
55+
and lock the ORFS version to the version of your source code. This
56+
gives you a way to deploy updates of ORFS
57+
easily, publish a new Docker image, modify the copy of `docker_shell`
58+
and create a pull request to possibly test your upgrade on your private
59+
build serves.

flow/util/docker_shell

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
set -ex
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
WORKSPACE=$(pwd)
6+
7+
XSOCK=/tmp/.X11-unix
8+
XAUTH=/tmp/.docker.xauth
9+
xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
10+
ARGUMENTS=$@
11+
12+
if test -t 0; then
13+
DOCKER_INTERACTIVE=-ti
14+
fi
15+
16+
# Most of these options below has to do with allowing to
17+
# run the OpenROAD GUI from within Docker.
18+
docker run -u $(id -u ${USER}):$(id -g ${USER}) \
19+
-e LIBGL_ALWAYS_SOFTWARE=1 \
20+
-e "QT_X11_NO_MITSHM=1" \
21+
-e XDG_RUNTIME_DIR=/tmp/xdg-run \
22+
-e DISPLAY=$DISPLAY \
23+
-e QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb \
24+
-v $XSOCK:$XSOCK \
25+
-v $XAUTH:$XAUTH \
26+
-e XAUTHORITY=$XAUTH \
27+
-e FLOW_HOME=/OpenROAD-flow-scripts/flow/ \
28+
-e MAKEFILES=/OpenROAD-flow-scripts/flow/Makefile \
29+
-v $WORKSPACE:`pwd` \
30+
$DOCKER_INTERACTIVE \
31+
${OR_IMAGE:-openroad/flow-centos7-builder:latest} \
32+
bash -c "set -ex
33+
mkdir /tmp/xdg-run
34+
. ./env.sh
35+
cd $WORKSPACE
36+
$ARGUMENTS
37+
"

0 commit comments

Comments
 (0)