Skip to content

Commit 8724c49

Browse files
committed
tools/labs: Add docker for building and running qemu infrastructure
Signed-off-by: Sergiu Weisz <[email protected]>
1 parent 4c5cf62 commit 8724c49

File tree

5 files changed

+77
-15
lines changed

5 files changed

+77
-15
lines changed

tools/labs/Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ copy: $(YOCTO_IMAGE)
3232
rmdir $(TEMPDIR)
3333

3434
docker-docs:
35-
cd docs && docker-compose build
36-
cd docs && docker-compose run docs-build bash -c "cd /linux/tools/labs && make docs"
35+
cd docker && docker-compose build docs-build
36+
cd docker && UID=$(shell id -u) GID=$(shell id -g) docker-compose run docs-build bash -c "cd /linux/tools/labs && make docs"
37+
38+
docker-kernel:
39+
cd docker && UID=$(shell id -u) GID=$(shell id -g) docker-compose build kernel-build
40+
cd docker && docker-compose up -d kernel-build
41+
cd docker && docker-compose exec -u ubuntu kernel-build bash
42+
43+
stop-docker-kernel:
44+
cd docker && docker-compose down
3745

3846
docs:
3947
$(MAKE) -C $(KDIR) DOCBOOKS= SPHINXDIRS="teaching" htmldocs
@@ -48,4 +56,4 @@ clean::
4856
clean_skels:
4957
rm -rf skels
5058

51-
.PHONY: skels build copy docs docker-docs clean clean_skels
59+
.PHONY: skels build copy docs docker-docs docker-kernel stop-docker-kernel clean clean_skels

tools/labs/docker/docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3'
2+
services:
3+
docs-build:
4+
build:
5+
context: .
6+
dockerfile: ./docs/Dockerfile
7+
volumes:
8+
- ../../../:/linux
9+
environment:
10+
# workaround for binfmt_misc support in containers
11+
- SPHINX_DITAA_CMD=jexec
12+
- SPHINX_DITAA_ARG=/usr/bin/ditaa
13+
kernel-build:
14+
privileged: true
15+
tty: true
16+
build:
17+
context: .
18+
dockerfile: ./kernel/Dockerfile
19+
args:
20+
UID: ${UID}
21+
GID: ${GID}
22+
volumes:
23+
- ../../../:/linux
File renamed without changes.

tools/labs/docker/kernel/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM ubuntu:18.04
2+
3+
RUN apt-get update
4+
RUN apt-get install -y software-properties-common
5+
RUN apt-get install -y gcc-multilib
6+
RUN apt-get install -y libncurses5-dev
7+
RUN apt-get install -y bc
8+
RUN apt-get install -y qemu-system-x86
9+
RUN apt-get install -y qemu-system-arm
10+
RUN apt-get install -y python3
11+
RUN apt-get install -y minicom
12+
RUN apt-get install -y git
13+
RUN apt-get install -y wget
14+
RUN apt-get install -y curl
15+
RUN apt-get install -y sudo
16+
17+
RUN apt-get install -y iproute2
18+
RUN apt-get install -y netcat-openbsd
19+
RUN apt-get install -y vim
20+
RUN apt-get install -y dnsmasq
21+
RUN apt-get install -y iputils-ping
22+
RUN apt-get install -y bash-completion
23+
RUN apt-get install -y build-essential
24+
RUN apt-get install -y bison
25+
RUN apt-get install -y flex
26+
27+
RUN apt-get -y clean
28+
29+
RUN rm -rf /var/lib/apt/lists/*
30+
31+
ARG UID
32+
ARG GID
33+
34+
RUN groupadd -g $GID ubuntu
35+
RUN useradd -u $UID -g $GID -ms /bin/bash ubuntu && adduser ubuntu sudo && echo -n 'ubuntu:ubuntu' | chpasswd
36+
37+
# Enable passwordless sudo for users under the "sudo" group
38+
RUN sed -i.bkp -e \
39+
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
40+
/etc/sudoers
41+
42+
USER ubuntu
43+
WORKDIR /home/ubuntu/

tools/labs/docs/docker-compose.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)