Skip to content

Commit

Permalink
tools/labs: Add docker for building and running qemu infrastructure
Browse files Browse the repository at this point in the history
Signed-off-by: Sergiu Weisz <[email protected]>
  • Loading branch information
Sergiu121 committed Dec 21, 2020
1 parent 4c5cf62 commit 8724c49
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 15 deletions.
14 changes: 11 additions & 3 deletions tools/labs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ copy: $(YOCTO_IMAGE)
rmdir $(TEMPDIR)

docker-docs:
cd docs && docker-compose build
cd docs && docker-compose run docs-build bash -c "cd /linux/tools/labs && make docs"
cd docker && docker-compose build docs-build
cd docker && UID=$(shell id -u) GID=$(shell id -g) docker-compose run docs-build bash -c "cd /linux/tools/labs && make docs"

docker-kernel:
cd docker && UID=$(shell id -u) GID=$(shell id -g) docker-compose build kernel-build
cd docker && docker-compose up -d kernel-build
cd docker && docker-compose exec -u ubuntu kernel-build bash

stop-docker-kernel:
cd docker && docker-compose down

docs:
$(MAKE) -C $(KDIR) DOCBOOKS= SPHINXDIRS="teaching" htmldocs
Expand All @@ -48,4 +56,4 @@ clean::
clean_skels:
rm -rf skels

.PHONY: skels build copy docs docker-docs clean clean_skels
.PHONY: skels build copy docs docker-docs docker-kernel stop-docker-kernel clean clean_skels
23 changes: 23 additions & 0 deletions tools/labs/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3'
services:
docs-build:
build:
context: .
dockerfile: ./docs/Dockerfile
volumes:
- ../../../:/linux
environment:
# workaround for binfmt_misc support in containers
- SPHINX_DITAA_CMD=jexec
- SPHINX_DITAA_ARG=/usr/bin/ditaa
kernel-build:
privileged: true
tty: true
build:
context: .
dockerfile: ./kernel/Dockerfile
args:
UID: ${UID}
GID: ${GID}
volumes:
- ../../../:/linux
File renamed without changes.
43 changes: 43 additions & 0 deletions tools/labs/docker/kernel/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get install -y gcc-multilib
RUN apt-get install -y libncurses5-dev
RUN apt-get install -y bc
RUN apt-get install -y qemu-system-x86
RUN apt-get install -y qemu-system-arm
RUN apt-get install -y python3
RUN apt-get install -y minicom
RUN apt-get install -y git
RUN apt-get install -y wget
RUN apt-get install -y curl
RUN apt-get install -y sudo

RUN apt-get install -y iproute2
RUN apt-get install -y netcat-openbsd
RUN apt-get install -y vim
RUN apt-get install -y dnsmasq
RUN apt-get install -y iputils-ping
RUN apt-get install -y bash-completion
RUN apt-get install -y build-essential
RUN apt-get install -y bison
RUN apt-get install -y flex

RUN apt-get -y clean

RUN rm -rf /var/lib/apt/lists/*

ARG UID
ARG GID

RUN groupadd -g $GID ubuntu
RUN useradd -u $UID -g $GID -ms /bin/bash ubuntu && adduser ubuntu sudo && echo -n 'ubuntu:ubuntu' | chpasswd

# Enable passwordless sudo for users under the "sudo" group
RUN sed -i.bkp -e \
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
/etc/sudoers

USER ubuntu
WORKDIR /home/ubuntu/
12 changes: 0 additions & 12 deletions tools/labs/docs/docker-compose.yml

This file was deleted.

0 comments on commit 8724c49

Please sign in to comment.