Project

General

Profile

Docker build environment ยป docker-poky.sh

Jonathan Cormier, 08/05/2020 09:09 PM

 
1
#!/bin/bash
2

    
3
# Launch a docker container which can be used to develop a yocto project
4
#
5
# Expected usage would be to cd into the yocto base directory and run
6
# this script
7
# jcormier 20190712
8

    
9
# Set default values
10
IMAGE_NAME=${IMAGE_NAME:-poky:ubuntu-18.04}
11
SERVER=${SERVER:-crops/}
12
IMAGE=${IMAGE:-"${SERVER}${IMAGE_NAME}"}
13
WORKDIR=${WORKDIR:-"$PWD"}
14

    
15
# Make bash history persistent atleast until host machine reboots
16
HISTORY=/tmp/.bash_history_$(id -u)
17
touch $HISTORY
18

    
19
docker run --rm -it -v "$WORKDIR:/work" -v $HISTORY:/home/pokyuser/.bash_history -v /home/tools:/home/tools --env "TOOLCHAIN_PATH_ARMV7=/home/tools/mitysom-57x/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf" "$IMAGE" --workdir=/work
20

    
21
# Alternative way of launching image, skips entrypoint script and forces user id to match
22
#docker run --rm -it -u "$(id -u):$(id -g)" --entrypoint= -v $HISTORY:/home/pokyuser/.bash_history -v "$WORKDIR:/work" -w /work  "$IMAGE" bash
23

    
    (1-1/1)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)