Commit 65fa0cfc authored by Nick Elsmore's avatar Nick Elsmore

Initial commit

parents
FROM debian:stretch
ARG PUID
ENV PUID=${PUID:-1000}
ARG PGID
ENV PGID=${PGID:-1000}
ENV ENTRYPOINT ${ENTRYPOINT:-/docker-entrypoint.sh}
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update \
&& apt-get install -y -q \
git-core \
gnupg \
flex \
bison \
build-essential \
libssl-dev \
curl \
wget \
gcc-arm-linux-gnueabihf \
python \
bc \
multistrap \
libc6-dev-armhf-cross \
qemu-user-static \
&& apt-get clean
RUN curl http://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo \
&& chmod a+x /usr/local/bin/repo
RUN groupadd -r docker -g ${PGID} \
&& useradd -u ${PUID} -r -g docker -d /home/docker docker \
&& mkdir /home/docker \
&& mkdir /home/docker/pyra-build \
&& chown -R docker.docker /home/docker \
&& echo "docker ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
COPY ./ssh_config /home/docker/.ssh/config
RUN chmod 600 /home/docker/.ssh/config \
&& chown -R docker.docker /home/docker/.ssh
COPY ./docker-entrypoint.sh /
RUN chmod a+x /docker-entrypoint.sh
USER docker
ENTRYPOINT ["/docker-entrypoint.sh"]
# PyraOS Build System
The PyraOS build system utilizes `docker.io` to manage a clean and isolated build environment for building PyraOS images and packages.
## Setting up your host
### Installing dependencies
All you need is a Linux host, preferably x86_64 with 4+ cores and 8GB+ of RAM, with `docker.io` running. On Debian based systems, install `docker.io` via `apt`. On other systems, Google is your friend :)
```
sudo apt install docker.io
```
Note, you will probably need to add your user to the `docker` group.
```
sudo usermod -a -G docker $USER
```
Also ensure that you have an ssh key created named `id_rsa` in `~/.ssh`.
### Setting up your build environment
Start off by cloning the `pyra-docker` repository to a sensible build location.
```
git clone git@dev.pyra-handheld.com:imagebuild/pyra-docker.git /path/to/build/location
cd /path/to/build/location
```
Next, you'll need to create the directory on your host system where we'll be doing all the work. This directory will be linked into the docker environment when we start up the container.
```
mkdir -p pyra-build
```
Now we're ready to build the docker image. This will create and configure a base image of our build environment. If you're curious to see what's going on here or want to modify it, check out `Dockerfile`. Note that as long as you don't modify `Dockerfile` or `docker-entrypoint.sh`, you only have to do this once.
```
./build_docker.sh
```
## Working with the build system
### Building a PyraOS image
Coming soon!
### Building the kernel
Coming soon!
### Building U-Boot
Coming soon!
### Building PyraOS Debian packages
Coming soon!
### Building DBPs
Coming soon!
#! /bin/bash
docker build --build-arg PUID=$UID -t pyra-build .
#! /bin/bash
set -e
[ $# -eq 0 ] && set -- all
env_setup() {
export LANG=en_US.UTF-8
export USER=$(whoami)
export BUILD_ROOT=/home/docker/pyra-build
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
mkdir -p $BUILD_ROOT
}
pyra_init() {
cd $BUILD_ROOT
repo init -u dev.pyra-handheld.com:imagebuild/pyra-manifest.git
repo sync
}
main() {
env_setup
pyra_init
exec bash
}
main "$@"
#! /bin/bash
BUILD_DIR=$(realpath pyra-build)
GITCONFIG=/home/$USER/.gitconfig
ID_RSA=/home/$USER/.ssh/id_rsa
if [ ! -d $BUILD_DIR ]; then
echo "$BUILD_DIR not found."
echo "Please create it before running script."
exit 1
fi
if [ ! -e $GITCONFIG ]; then
echo "$GITCONFIG not found."
echo "Please create it before running script."
exit 1
fi
if [ ! -e $ID_RSA ]; then
echo "$ID_RSA not found."
echo "Please configure it before running script."
exit 1
fi
docker run \
--volume $BUILD_DIR:/home/docker/pyra-build \
--volume $GITCONFIG:/home/docker/.gitconfig \
--volume $ID_RSA:/home/docker/.ssh/id_rsa \
-it pyra-build
Host *
StrictHostKeyChecking no
Host dev.pyra-handheld.com
User git
Hostname dev.pyra-handheld.com
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment