You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: images.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ in these docker images.
19
19
20
20
As the images have no editor installed by default you can create a simple
21
21
program using `cat` as below. If needed you can install an editor with `apt-get`
22
-
or by extending the docker image.
22
+
or [by extending the docker image](#extending-the-docker-image).
23
23
24
24
Create a `hello.c`
25
25
@@ -60,6 +60,8 @@ Create the `hello.c` file as described above, then to compile our program run
60
60
or1k-elf-gcc hello.c -o hello
61
61
```
62
62
63
+
If you see errors related to missing dependencies while compiling, you can add the dependent libraries [by extending the docker image](#extending-the-docker-image)
64
+
63
65
After the program is compiled we can run the program in the simulator with the
64
66
following:
65
67
@@ -226,6 +228,54 @@ Hello
226
228
src/mor1kx_5.2/bench/verilog/mor1kx_monitor.v:140: $finish called at 171635 (1s)
227
229
```
228
230
231
+
## Extending the docker image
232
+
233
+
To add vim or other terminal based text editors while running docker you can extend the docker image with the following steps:
234
+
235
+
1. Create a file named `Dockerfile` where you're planning to run OpenRISC image from (ensure you're not running the docker image):
236
+
237
+
```bash
238
+
touch Dockerfile
239
+
```
240
+
241
+
2. Add the following to the `Dockerfile` and save it:
242
+
243
+
```bash
244
+
FROM stffrdhrn/or1k-sim-env
245
+
246
+
# Install the terminal-based Vim
247
+
RUN apt-get update && apt-get install -y \
248
+
vim \
249
+
&& rm -rf /var/lib/apt/lists/*
250
+
```
251
+
252
+
3. Build and run:
253
+
254
+
```bash
255
+
docker build -t openrisc-vim .
256
+
docker run -it openrisc-vim /bin/bash
257
+
```
258
+
259
+
4. You should now be able to open and edit files using vim every time you run the above command:
260
+
261
+
```bash
262
+
$ vi hello.c
263
+
```
264
+
265
+
5. In case you see missing dependent libraries while going through this tutorial (especially while compiling with `gcc`if you see libmpc3, libmpfr6, libgmp10 libraries missing), you can add these to the Dockerfile and compile without errors:
266
+
267
+
```bash
268
+
FROM stffrdhrn/or1k-sim-env
269
+
270
+
# Install the terminal-based Vim & other dependent lib
271
+
RUN apt-get update && apt-get install -y \
272
+
libmpc3 \
273
+
libmpfr6 \
274
+
libgmp10 \
275
+
vim \
276
+
&& rm -rf /var/lib/apt/lists/*
277
+
```
278
+
229
279
## Further Reading
230
280
231
281
- [stffrdhrn/or1k-docker-images](https://github.com/stffrdhrn/or1k-docker-images) - OpenRISC docker images home page
0 commit comments