Commit d9785a44 authored by Nick Elsmore's avatar Nick Elsmore

streamline build system

parent 5846eceb
......@@ -14,7 +14,6 @@ RUN DEBIAN_FRONTEND=noninteractive \
sudo \
locales \
locales-all \
git-core \
gnupg \
flex \
bison \
......@@ -41,9 +40,6 @@ RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
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 \
......@@ -51,10 +47,6 @@ RUN groupadd -r docker -g ${PGID} \
&& 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
......
......@@ -3,76 +3,12 @@ set -e
[ $# -eq 0 ] && set -- all
env_setup() {
export USER=$(whoami)
export BUILD_ROOT=/home/docker/pyra-build
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export USER=$(whoami)
export BUILD_ROOT=/home/docker/pyra-build
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
mkdir -p $BUILD_ROOT
cd $BUILD_ROOT
}
mkdir -p $BUILD_ROOT
cd $BUILD_ROOT
print_usage() {
echo "Usage: ./docker_run.sh COMMAND [OPTIONS]"
echo "Commands:"
echo " sync-current Sync all repositories to their current branches"
echo " sync-manifest Sync all repositories to master"
echo " build Run PyraOS build script"
echo " bootloader"
echo " linux"
echo " rootfs"
echo " build-all [2gb|4gb] Build PyraOS for 2gb or 4gb HW"
echo " bash Configure environment and start bash shell"
}
sync_current() {
repo init -u dev.pyra-handheld.com:imagebuild/pyra-manifest.git
repo sync
}
sync_to_manifest() {
repo init -u dev.pyra-handheld.com:imagebuild/pyra-manifest.git
repo sync -d
}
build_all() {
PYRA_DDR=$1 make bootloader
make linux
make rootfs
}
main() {
env_setup
case $1 in
sync-current)
sync_current
;;
sync-manifest)
sync_to_manifest
;;
build)
[[ ! -z $3 ]] && export PYRA_DDR=$3
make $2
;;
build-all)
build_all $2
;;
bash)
exec bash
;;
*)
print_usage
exit 1
;;
esac
}
main "$@"
exit 0
exec bash
#! /bin/bash
BUILD_DIR=$(realpath ../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."
if [ -z ${BUILD_DIR+x} ]; then
echo "BUILD_DIR not set"
exit 1
fi
if [ ! -e $GITCONFIG ]; then
echo "$GITCONFIG not found."
if [ ! -d $BUILD_DIR ]; then
echo "$BUILD_DIR 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 \
--privileged \
-it pyra-build "$@"
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