Merge pull request #198 from resin-io/oe-base-image

Open Embedded base image
This commit is contained in:
Petros Angelatos 2016-09-14 02:36:45 +01:00 committed by GitHub
commit d00c6f3952
17 changed files with 397 additions and 0 deletions

6
.gitignore vendored
View File

@ -6,3 +6,9 @@ gosuper/bin/
tools/dind/config.json tools/dind/config.json
tools/dind/apps.json tools/dind/apps.json
tools/dind/config/localenv tools/dind/config/localenv
base-image/build/bitbake.lock
base-image/build/cache
base-image/build/downloads
base-image/build/sstate-cache
base-image/build/tmp-glibc

11
.gitmodules vendored Normal file
View File

@ -0,0 +1,11 @@
[submodule "base-image/meta-nodejs"]
path = base-image/meta-nodejs
url = https://github.com/imyller/meta-nodejs.git
branch = krogoth
[submodule "base-image/oe-core"]
path = base-image/oe-core
url = git://git.openembedded.org/openembedded-core
branch = krogoth
[submodule "base-image/bitbake"]
path = base-image/bitbake
url = git://git.openembedded.org/bitbake

4
base-image/.dockerignore Normal file
View File

@ -0,0 +1,4 @@
build
oe-core
meta-nodejs
bitbake

34
base-image/Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM ubuntu:15.04
# Install the following utilities (required by openembedded)
# http://www.openembedded.org/wiki/Getting_started#Ubuntu_.2F_Debian
RUN apt-get update \
&& apt-get install -y \
build-essential \
chrpath \
cpio \
curl \
diffstat \
file \
gawk \
git-core \
libsdl1.2-dev \
python3 \
texinfo \
unzip \
wget \
xterm \
sudo \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV SOURCE_DIR /source
ENV DEST_DIR /dest
ENV SHARED_DOWNLOADS /yocto/shared-downloads
ENV SHARED_SSTATE /yocto/shared-sstate
COPY build.sh /
CMD bash -ex build.sh

View File

@ -0,0 +1,57 @@
#!/bin/bash
set -o errexit
set -o pipefail
date=$(date +'%Y%m%d' -u)
JENKINS_PERSISTENT_WORKDIR=${1:-/var/lib/yocto}
DL_DIR="$JENKINS_PERSISTENT_WORKDIR/shared-downloads"
# MACHINE_LIST: generic-x86-64 generic-x86 generic-armv6 generic-armv7hf generic-armv5
# MACHINE_LIST should be set in jenkins config
git submodule update --init --recursive
rm -rf dest
mkdir dest
docker build -t supervisor-base-builder .
for machine in $MACHINE_LIST; do
case "$machine" in
'generic-x86-64')
REPO='resin/amd64-supervisor-base'
;;
'generic-x86')
REPO='resin/i386-supervisor-base'
;;
'generic-armv6')
REPO='resin/rpi-supervisor-base'
;;
'generic-armv7hf')
REPO='resin/armv7hf-supervisor-base'
;;
'generic-armv5')
REPO='resin/armel-supervisor-base'
;;
esac
SSTATE_DIR="$JENKINS_PERSISTENT_WORKDIR/$machine/sstate"
# Make sure shared directories are in place
mkdir -p $DL_DIR
mkdir -p $SSTATE_DIR
docker run --rm \
-e TARGET_MACHINE=$machine \
-e BUILDER_UID=$(id -u) \
-e BUILDER_GID=$(id -g) \
-v `pwd`:/source \
-v $DL_DIR:/yocto/shared-downloads \
-v $SSTATE_DIR:/yocto/shared-sstate \
-v `pwd`/dest:/dest \
supervisor-base-builder
if [ -f dest/rootfs.tar.gz ]; then
docker import dest/rootfs.tar.gz $REPO:$date
docker tag -f $REPO:$date $REPO:latest
docker push $REPO
else
echo "rootfs is missing!"
exit 1
fi
done

1
base-image/bitbake Submodule

@ -0,0 +1 @@
Subproject commit 25859009b710cb35ac8f9ee9eb3a7305f9e13402

13
base-image/build.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -o errexit
BUILD_DIR='/home/builder/tmp'
groupadd -g $BUILDER_GID builder
useradd -m -u $BUILDER_UID -g $BUILDER_GID builder
sudo -H -u builder /bin/bash -c "mkdir -p $BUILD_DIR \
&& cp -r $SOURCE_DIR/* $BUILD_DIR/ \
&& cd $BUILD_DIR \
&& source oe-core/oe-init-build-env build bitbake \
&& DL_DIR=$SHARED_DOWNLOADS SSTATE_DIR=$SHARED_SSTATE MACHINE=$TARGET_MACHINE $BUILD_DIR/bitbake/bin/bitbake core-image-minimal"
cp --dereference $BUILD_DIR/build/tmp-glibc/deploy/images/$TARGET_MACHINE/core-image-minimal-$TARGET_MACHINE.tar.gz $DEST_DIR/rootfs.tar.gz

View File

@ -0,0 +1,11 @@
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "7"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
${TOPDIR}/../oe-core/meta \
${TOPDIR}/../meta-nodejs \
"

View File

@ -0,0 +1,225 @@
#
# This file is your local configuration file and is where all local user settings
# are placed. The comments in this file give some guide to the options a new user
# to the system might want to change but pretty much any configuration option can
# be set in this file. More adventurous users can look at local.conf.extended
# which contains other examples of configuration which can be placed in this file
# but new users likely won't need any of them initially.
#
# Lines starting with the '#' character are commented out and in some cases the
# default values are provided as comments to show people example syntax. Enabling
# the option is a question of removing the # character and making any change to the
# variable as required.
PREFERRED_PROVIDER_virtual/kernel="linux-dummy"
#
# Machine Selection
#
# You need to select a specific machine to target the build with. There are a selection
# of emulated machines available which can boot and run in the QEMU emulator:
#
#MACHINE ?= "qemuarm"
#MACHINE ?= "qemuarm64"
#MACHINE ?= "qemumips"
#MACHINE ?= "qemumips64"
#MACHINE ?= "qemuppc"
#MACHINE ?= "qemux86"
#MACHINE ?= "qemux86-64"
#
# This sets the default machine to be qemux86 if no other machine is selected:
# MACHINE ??= ""
#
# Where to place downloads
#
# During a first build the system will download many different source code tarballs
# from various upstream projects. This can take a while, particularly if your network
# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you
# can preserve this directory to speed up this part of subsequent builds. This directory
# is safe to share between multiple builds on the same machine too.
#
# The default is a downloads directory under TOPDIR which is the build directory.
#
#DL_DIR ?= "${TOPDIR}/downloads"
#
# Where to place shared-state files
#
# BitBake has the capability to accelerate builds based on previously built output.
# This is done using "shared state" files which can be thought of as cache objects
# and this option determines where those files are placed.
#
# You can wipe out TMPDIR leaving this directory intact and the build would regenerate
# from these files if no changes were made to the configuration. If changes were made
# to the configuration, only shared state files where the state was still valid would
# be used (done using checksums).
#
# The default is a sstate-cache directory under TOPDIR.
#
#SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
#
# Where to place the build output
#
# This option specifies where the bulk of the building work should be done and
# where BitBake should place its temporary files and output. Keep in mind that
# this includes the extraction and compilation of many applications and the toolchain
# which can use Gigabytes of hard disk space.
#
# The default is a tmp directory under TOPDIR.
#
#TMPDIR = "${TOPDIR}/tmp"
#
# Package Management configuration
#
# This variable lists which packaging formats to enable. Multiple package backends
# can be enabled at once and the first item listed in the variable will be used
# to generate the root filesystems.
# Options are:
# - 'package_deb' for debian style deb files
# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager)
# - 'package_rpm' for rpm style packages
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
# We default to ipk:
PACKAGE_CLASSES ?= "package_ipk"
#
# SDK target architecture
#
# This variable specifies the architecture to build SDK items for and means
# you can build the SDK packages for architectures other than the machine you are
# running the build on (i.e. building i686 packages on an x86_64 host).
# Supported values are i686 and x86_64
#SDKMACHINE ?= "i686"
#
# Extra image configuration defaults
#
# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated
# images. Some of these options are added to certain image types automatically. The
# variable can contain the following options:
# "dbg-pkgs" - add -dbg packages for all installed packages
# (adds symbol information for debugging/profiling)
# "dev-pkgs" - add -dev packages for all installed packages
# (useful if you want to develop against libs in the image)
# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages
# (useful if you want to run the package test suites)
# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.)
# "tools-debug" - add debugging tools (gdb, strace)
# "eclipse-debug" - add Eclipse remote debugging support
# "tools-profile" - add profiling tools (oprofile, lttng, valgrind)
# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.)
# "debug-tweaks" - make an image suitable for development
# e.g. ssh root access has a blank password
# There are other application targets that can be used here too, see
# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details.
# We default to enabling the debugging tweaks.
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
#
# Additional image features
#
# The following is a list of additional classes to use when building images which
# enable extra features. Some available options which can be included in this variable
# are:
# - 'buildstats' collect build statistics
# - 'image-mklibs' to reduce shared library files size for an image
# - 'image-prelink' in order to prelink the filesystem image
# - 'image-swab' to perform host system intrusion detection
# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink
# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended
# image-prelink disabled for now due to issues with IFUNC symbol relocation
USER_CLASSES ?= "buildstats image-mklibs"
IMAGE_FSTYPES ?= "tar.gz"
#
# Runtime testing of images
#
# The build system can test booting virtual machine images under qemu (an emulator)
# after any root filesystems are created and run tests against those images. To
# enable this uncomment this line. See classes/testimage(-auto).bbclass for
# further details.
#TEST_IMAGE = "1"
#
# Interactive shell configuration
#
# Under certain circumstances the system may need input from you and to do this it
# can launch an interactive shell. It needs to do this since the build is
# multithreaded and needs to be able to handle the case where more than one parallel
# process may require the user's attention. The default is iterate over the available
# terminal types to find one that works.
#
# Examples of the occasions this may happen are when resolving patches which cannot
# be applied, to use the devshell or the kernel menuconfig
#
# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none
# Note: currently, Konsole support only works for KDE 3.x due to the way
# newer Konsole versions behave
#OE_TERMINAL = "auto"
# By default disable interactive patch resolution (tasks will just fail instead):
PATCHRESOLVE = "noop"
#
# Disk Space Monitoring during the build
#
# Monitor the disk space during the build. If there is less that 1GB of space or less
# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully
# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort
# of the build. The reason for this is that running completely out of space can corrupt
# files and damages the build in ways which may not be easily recoverable.
# It's necesary to monitor /tmp, if there is no space left the build will fail
# with very exotic errors.
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
#
# Shared-state files from other locations
#
# As mentioned above, shared state files are prebuilt cache data objects which can
# used to accelerate build time. This variable can be used to configure the system
# to search other mirror locations for these objects before it builds the data itself.
#
# This can be a filesystem directory, or a remote url such as http or ftp. These
# would contain the sstate-cache results from previous builds (possibly from other
# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the
# cache locations to check for the shared objects.
# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH
# at the end as shown in the examples below. This will be substituted with the
# correct path within the directory structure.
#SSTATE_MIRRORS ?= "\
#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
#file://.* file:///some/local/dir/sstate/PATH"
#
# Qemu configuration
#
# By default qemu will build with a builtin VNC server where graphical output can be
# seen. The two lines below enable the SDL backend too. By default libsdl-native will
# be built, if you want to use your host's libSDL instead of the minimal libsdl built
# by libsdl-native then uncomment the ASSUME_PROVIDED line below.
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
#ASSUME_PROVIDED += "libsdl-native"
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
# track the version of this file when it was generated. This can safely be ignored if
# this doesn't mean anything to you.
CONF_VERSION = "1"
IMAGE_INSTALL_append += " btrfs-tools ca-certificates iptables nodejs rsync"
VIRTUAL-RUNTIME_init_manager="busybox"
VIRTUAL-RUNTIME_dev_manager="busybox-mdev"
PREFERRED_VERSION_nodejs = "6.5.0"

View File

@ -0,0 +1,7 @@
#@TYPE: Machine
#@NAME: Generic armv5te machine
#@DESCRIPTION: Machine configuration for armv5te based boards
require conf/machine/include/arm/arch-armv5.inc
DEFAULTTUNE = "armv5t-vfp"

View File

@ -0,0 +1,7 @@
#@TYPE: Machine
#@NAME: Generic armv6 machine
#@DESCRIPTION: Machine configuration for armv6 based boards
require conf/machine/include/arm/arch-armv6.inc
DEFAULTTUNE = "armv6thf"

View File

@ -0,0 +1,7 @@
#@TYPE: Machine
#@NAME: Generic armv7a hard float machine
#@DESCRIPTION: Machine configuration for armv7a based boards
require conf/machine/include/arm/arch-armv7a.inc
DEFAULTTUNE = "armv7athf-vfpv3d16"

View File

@ -0,0 +1,6 @@
#@TYPE: Machine
#@NAME: common_pc
#@DESCRIPTION: Machine configuration for running a common x86
DEFAULTTUNE ?= "core2-64"
require conf/machine/include/tune-core2.inc

View File

@ -0,0 +1,5 @@
#@TYPE: Machine
#@NAME: common_pc
#@DESCRIPTION: Machine configuration for running a common x86
require conf/machine/include/tune-i586.inc

View File

@ -0,0 +1 @@
meta/conf

@ -0,0 +1 @@
Subproject commit 65ccd459ecff3fd5958509e535426135fa1381be

1
base-image/oe-core Submodule

@ -0,0 +1 @@
Subproject commit dd330056ace289c8a9c5d77b6bb6e860b9f0913e