mirror of
https://github.com/OpenSolo/OpenSolo.git
synced 2025-04-29 22:24:32 +02:00
BUILD: Housekeeping, add artoo bulild, directory moves/names, new build opts
- Changed build directory to /solo-build since it isn't alt anymore. - Move 3dr-yocto-bsp-base into solo-builder directory - Remove unused files and directories from solo-builder - Added building artoo STM32 FW to build - Updated command line options for nuke and scripted - Removed debug outputs
This commit is contained in:
parent
2148f82457
commit
2cd8ac3875
@ -127,7 +127,7 @@ done
|
|||||||
if [ "$updated" = "true" ]; then
|
if [ "$updated" = "true" ]; then
|
||||||
|
|
||||||
echo "\nACTION REQUIRED: The project root content has been updated. Please run $0 again."
|
echo "\nACTION REQUIRED: The project root content has been updated. Please run $0 again."
|
||||||
exit 1
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $OEROOT
|
cd $OEROOT
|
13
solo-builder/build_artoo.sh
Executable file
13
solo-builder/build_artoo.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
rm -rf /vagrant/artoo/artoo.bin
|
||||||
|
cd /vagrant/artoo
|
||||||
|
tup
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy new Artoo STM32 FW to Artoo FW Bitbake recipe
|
||||||
|
cp /vagrant/artoo/artoo.bin /vagrant/meta-3dr/recipes-firmware/artoo/files
|
@ -1,79 +1,108 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# USAGE: builder.sh -a GIT_ACCOUNT -r GIT_REPO -b GIT_BRANCH -b BUILD_MACHINE
|
# USAGE: builder.sh -a -m -c -n
|
||||||
|
# "-a true" will build the Artoo STM32 firmware, and copy the artoo.bin file into the build. Default is true if not specified.
|
||||||
|
# "-m solo" will build only the copter's IMX
|
||||||
|
# "-m controller" will build only the controller's IMX
|
||||||
|
# "-m both" will build both the copter and controller IMX. Default is both if not specified.
|
||||||
|
# "-c true" will clean the build recipies prior to beginning the build. Default is false if not specified.
|
||||||
|
# "-n true" nuclear option will delete the entire build directory to start from a totally clean slate. Default is false if not specified.
|
||||||
|
|
||||||
# EXAMPLE: builder.sh -a OpenSolo -r 3dr-arm-yocto-bsp -b Master
|
|
||||||
# These are also the defaults that will be used if options are not specified
|
|
||||||
|
|
||||||
# EXAMPLE: builder.sh -a Pedals2Paddles -r 3dr-arm-yocto-bsp -b v0.1.0
|
|
||||||
# This will use Matt's fork with a branch named v0.1.0
|
|
||||||
# TIP: if the GIT_BRANCH starts with tags/, then it's actually a git tag that's used, if not it's a branch
|
|
||||||
|
|
||||||
# Defaults if options are not set from command line set
|
# Defaults if options are not set from command line set
|
||||||
GIT_ACCOUNT=OpenSolo
|
MACHINE_BUILD='both'
|
||||||
GIT_REPO=3dr-arm-yocto-bsp
|
ARTOO_BUILD=true
|
||||||
GIT_BRANCH=master
|
CLEAN_BUILD=false
|
||||||
BUILD_MACHINE=both
|
NUKE_BUILD=false
|
||||||
CLEAN=
|
SCRIPT_MODE=false
|
||||||
|
|
||||||
|
|
||||||
# Check command line options for git account, repo, and branch.
|
# Check command line options for git account, repo, and branch.
|
||||||
while getopts a:r:b:m:c: option
|
while getopts a:m:c:n:s: option
|
||||||
do
|
do
|
||||||
case ${option}
|
case ${option}
|
||||||
in
|
in
|
||||||
a) GIT_ACCOUNT=${OPTARG};;
|
a) ARTOO_BUILD=${OPTARG};;
|
||||||
r) GIT_REPO=${OPTARG};;
|
m) MACHINE_BUILD=${OPTARG};;
|
||||||
b) GIT_BRANCH=${OPTARG};;
|
c) CLEAN_BUiLD=${OPTARG};;
|
||||||
m) BUILD_MACHINE=$${OPTARG};;
|
n) NUKE_BUILD=${OPTARG};;
|
||||||
c) CLEAN=${OPTARG};;
|
s) SCRIPT_MODE=${OPTARG};;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
## If nuke arg true, delete the build directory to start from a clean slate
|
||||||
|
if $NUKE_BUILD; then
|
||||||
|
if ! $SCRIPT_MODE; then
|
||||||
|
echo
|
||||||
|
read -p "Wipe build directory to star over from a clean slate? (y/n):" choice
|
||||||
|
echo
|
||||||
|
case "$choice" in
|
||||||
|
y|Y ) ;;
|
||||||
|
n|N ) echo "Aborting..." && exit 1;;
|
||||||
|
* ) echo "Invalid response. Quit pushing my buttons. Aborting..." && exit 1;;
|
||||||
|
esac
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
echo "Deleting entire build directory. Please wait.."
|
||||||
|
echo
|
||||||
|
sudo rm -rf /solo-build
|
||||||
|
echo
|
||||||
|
echo "Build directory nuked."
|
||||||
|
fi
|
||||||
|
|
||||||
# Prompt for what is about to execute
|
# Prompt for what is about to execute
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo "Ready to initialize the "$GIT_ACCOUNT $GIT_REPO" repo using branch "$GIT_BRANCH
|
|
||||||
echo
|
|
||||||
read -p "This is your last chance to say no. Proceed with build? (y/n):" choice
|
|
||||||
echo
|
|
||||||
case "$choice" in
|
|
||||||
y|Y ) echo "Yes! Proceeding with build.";;
|
|
||||||
n|N ) echo "No? Fine. Aborting build.." && exit 1;;
|
|
||||||
* ) echo "Invalid response. Quit pushing my buttons. Aborting build." && exit 1;;
|
|
||||||
esac
|
|
||||||
echo
|
|
||||||
|
|
||||||
#Do it.
|
if ! $SCRIPT_MODE; then
|
||||||
/vagrant/solo-builder/source_sync.sh $GIT_BRANCH 2>&1
|
echo
|
||||||
echo "sync done"
|
read -p "Proceed with build? (y/n):" choice
|
||||||
|
echo
|
||||||
|
case "$choice" in
|
||||||
|
y|Y ) echo "Yes! Proceeding with build.";;
|
||||||
|
n|N ) echo "No? Fine. Aborting build.." && exit 1;;
|
||||||
|
* ) echo "Invalid response. Quit pushing my buttons. Aborting build." && exit 1;;
|
||||||
|
esac
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
cd /solo-build-alt
|
## Run source_sync.sh script to pull in build sources
|
||||||
|
/vagrant/solo-builder/source_sync.sh
|
||||||
if [ ! $? -eq 0 ]
|
if [ ! $? -eq 0 ]; then
|
||||||
then
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Switch to build directory
|
||||||
|
cd /solo-build
|
||||||
|
|
||||||
|
|
||||||
export MACHINE=imx6solo-3dr-1080p
|
export MACHINE=imx6solo-3dr-1080p
|
||||||
EULA=1 source ./setup-environment build
|
EULA=1 source ./setup-environment build
|
||||||
|
export_return=$?
|
||||||
if [ ! $? -eq 0 ]
|
if [ $export_return -eq 0 ]; then
|
||||||
then
|
echo "Build environment ready"
|
||||||
|
elif [ $export_return -eq 2 ]; then
|
||||||
|
# Automatic restart as required
|
||||||
|
echo "Restarting setup environment"
|
||||||
|
export MACHINE=imx6solo-3dr-1080p
|
||||||
|
EULA=1 source ./setup-environment build
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
echo "Machine export error."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Machine export error."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TIP: how to build just one bit, such as the pixhawk firmware from OpenSolo/meta-3dr/recipes-firmware/pixhawk/pixhawk-firmware_1.3.1.bb :
|
#TIP: how to build just one bit, such as the pixhawk firmware from OpenSolo/meta-3dr/recipes-firmware/pixhawk/pixhawk-firmware_1.3.1.bb :
|
||||||
#assuming you've run the 'export MACHINE...' and 'source ./setup...' commands first, and are in /solo-build-alt/build/ folder as a result:
|
#assuming you've run the 'export MACHINE...' and 'source ./setup...' commands first, and are in /solo-build/build/ folder as a result:
|
||||||
#bitbake -c clean pixhawk-firmware
|
#bitbake -c clean pixhawk-firmware
|
||||||
#bitbake pixhawk-firmware
|
#bitbake pixhawk-firmware
|
||||||
#or verbose:
|
#or verbose:
|
||||||
#bitbake pixhawk-firmware -v
|
#bitbake pixhawk-firmware -v
|
||||||
#TIP: -k means continue-after-error-for-as-much-as-possible
|
#TIP: -k means continue-after-error-for-as-much-as-possible
|
||||||
|
|
||||||
|
## If -c = true, run the recipe clean commands on everything
|
||||||
if [ $CLEAN = clean ]
|
if $CLEAN_BUILD; then
|
||||||
then
|
|
||||||
# these clean command/s are very verbose, and return an error code even though the clean works, lets quieten them:
|
# these clean command/s are very verbose, and return an error code even though the clean works, lets quieten them:
|
||||||
echo "solo clean started..."
|
echo "solo clean started..."
|
||||||
MACHINE=imx6solo-3dr-1080p bitbake world -c cleansstate -f -k 2>&1 > /dev/null
|
MACHINE=imx6solo-3dr-1080p bitbake world -c cleansstate -f -k 2>&1 > /dev/null
|
||||||
@ -83,40 +112,76 @@ then
|
|||||||
MACHINE=imx6solo-3dr-artoo bitbake world -c cleansstate -f -k 2>&1 > /dev/null
|
MACHINE=imx6solo-3dr-artoo bitbake world -c cleansstate -f -k 2>&1 > /dev/null
|
||||||
echo "...controller clean finished"
|
echo "...controller clean finished"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# clean the solo specific recipies, even with -c true to ensure local changes are picked up
|
||||||
MACHINE=imx6solo-3dr-1080p bitbake 3dr-solo
|
if ! $CLEAN_BUILD; then
|
||||||
if [ ! $? -eq 0 ]
|
MACHINE=imx6solo-3dr-1080p bitbake -c clean -f -k sololink shotmanager sololink-python pymavlink mavproxy cubeBlack-solo gimbal-firmware 2>&1 > /dev/null
|
||||||
then
|
if [ ! $? -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
MACHINE=imx6solo-3dr-artoo bitbake -c clean -f -k sololink sololink-python pymavlink mavproxy artoo-firmware stm32loader 2>&1 > /dev/null
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MACHINE=imx6solo-3dr-artoo bitbake 3dr-controller
|
## if -a arg is true, build the Artoo STM32 firmware and copy artoo.bin to the build.
|
||||||
if [ ! $? -eq 0 ]
|
if $ARTOO_BUILD; then
|
||||||
then
|
/vagrant/solo-builder/build_artoo.sh
|
||||||
exit 1
|
if [ ! $? -eq 0 ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TIPS:
|
|
||||||
|
## if -m arg is solo or both, build the Solo's IMX
|
||||||
|
if [ $MACHINE_BUILD = 'solo' ] || [ $MACHINE_BUILD = 'both' ]; then
|
||||||
|
MACHINE=imx6solo-3dr-1080p bitbake 3dr-solo
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## if -m arg is controller or both, build the Controller's IMX
|
||||||
|
if [ $MACHINE_BUILD = 'controller' ] || [ $MACHINE_BUILD = 'both' ]; then
|
||||||
|
MACHINE=imx6solo-3dr-artoo bitbake 3dr-controller
|
||||||
|
if [ ! $? -eq 0 ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Copy the relevant files to a date/time stamped completed directory in the git repo folder for easy access (on git ignore list).
|
# Copy the relevant files to a date/time stamped completed directory in the git repo folder for easy access (on git ignore list).
|
||||||
# Make an MD5sum of each as is required for the Solo and Controller to accept the files.
|
# Make an MD5sum of each as is required for the Solo and Controller to accept the files.
|
||||||
# The tar.gz and the .md5 go directly in the /log/updates/ directory on the solo and/or controller.
|
# The tar.gz and the .md5 go directly in the /log/updates/ directory on the solo and/or controller.
|
||||||
COMP="completed_$(date +%F_%H-%M)"
|
# Also copies the artoo.bin STM32 FW file used in the build.
|
||||||
NEW_DIR=/vagrant/solo-builder/binaries/$COMP
|
COMP_DATE="$(date +%F_%H-%M)"
|
||||||
|
COMP_DIR="completed_$(date +%F_%H-%M)"
|
||||||
|
NEW_DIR=/vagrant/solo-builder/binaries/$COMP_DIR
|
||||||
echo $COMP > /tmp/COMP.txt
|
echo $COMP > /tmp/COMP.txt
|
||||||
mkdir -p $NEW_DIR
|
mkdir -p $NEW_DIR
|
||||||
cd $NEW_DIR
|
cd $NEW_DIR
|
||||||
|
|
||||||
cp /solo-build-alt/build/tmp-eglibc/deploy/images/imx6solo-3dr-1080p/3dr-solo.tar.gz $NEW_DIR
|
if [ $MACHINE_BUILD = 'solo' ] || [ $MACHINE_BUILD = 'both' ]; then
|
||||||
md5sum 3dr-solo.tar.gz > 3dr-solo.tar.gz.md5
|
cp /solo-build/build/tmp-eglibc/deploy/images/imx6solo-3dr-1080p/3dr-solo.tar.gz $NEW_DIR
|
||||||
|
md5sum 3dr-solo.tar.gz > 3dr-solo.tar.gz.md5
|
||||||
|
fi
|
||||||
|
|
||||||
cp /solo-build-alt/build/tmp-eglibc/deploy/images/imx6solo-3dr-artoo/3dr-controller.tar.gz $NEW_DIR
|
if [ $MACHINE_BUILD = 'controller' ] || [ $MACHINE_BUILD = 'both' ]; then
|
||||||
md5sum 3dr-controller.tar.gz > 3dr-controller.tar.gz.md5
|
cp /solo-build/build/tmp-eglibc/deploy/images/imx6solo-3dr-artoo/3dr-controller.tar.gz $NEW_DIR
|
||||||
|
md5sum 3dr-controller.tar.gz > 3dr-controller.tar.gz.md5
|
||||||
ls -lh $NEW_DIR
|
cp /vagrant/meta-3dr/recipes-firmware/artoo/files/artoo.bin "$NEW_DIR/artoo_$COMP_DATE.bin"
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "All build files located in below directories of the Vagrant virtual machine (squashfs, uImage, kernel, u-boot, dtb file, initramfs, rootfs.cpio, etc)"
|
echo "All completed files located in below directories of the Vagrant virtual machine (squashfs, uImage, kernel, u-boot, dtb file, initramfs, rootfs.cpio, etc)"
|
||||||
echo /solo-build-alt/build/tmp-eglibc/deploy/images/imx6solo-3dr-1080p/
|
echo /solo-build/build/tmp-eglibc/deploy/images/imx6solo-3dr-1080p/
|
||||||
echo /solo-build-alt/build/tmp-eglibc/deploy/images/imx6solo-3dr-artoo/
|
echo /solo-build/build/tmp-eglibc/deploy/images/imx6solo-3dr-artoo/
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Completed binaries have been copied to the /solo-builder/binaries/ directory:"
|
||||||
|
ls -lh $NEW_DIR
|
||||||
|
22
solo-builder/gtk-doc-stub_git.bb
Normal file
22
solo-builder/gtk-doc-stub_git.bb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
SUMMARY = "Stub implementation of gtk-doc"
|
||||||
|
DESCRIPTION = "Stub implementation of gtk-doc, as we don't want to build the API documentation"
|
||||||
|
SECTION = "x11/base"
|
||||||
|
LICENSE = "GPLv2"
|
||||||
|
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
|
||||||
|
|
||||||
|
PROVIDES = "gtk-doc gobject-introspection-stub"
|
||||||
|
|
||||||
|
#SRCREV = "3dfd0a09de696ec8c544762747f8a0f77153622e"
|
||||||
|
SRCREV = "${AUTOREV}"
|
||||||
|
PV = "0.0+git${SRCPV}"
|
||||||
|
PR = "r0"
|
||||||
|
|
||||||
|
SRC_URI = "git://gitlab.gnome.org/GNOME/gtk-doc-stub;protocol=https"
|
||||||
|
|
||||||
|
S = "${WORKDIR}/git"
|
||||||
|
|
||||||
|
inherit autotools
|
||||||
|
|
||||||
|
FILES_${PN} += "${datadir}"
|
||||||
|
|
||||||
|
BBCLASSEXTEND = "native"
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cd $(dirname $0)
|
|
||||||
|
|
||||||
set -e
|
|
||||||
rm -rf static
|
|
||||||
mkdir -p static
|
|
||||||
while read -r p && [[ "$p" != '' ]]; do
|
|
||||||
cp ../build/tmp-eglibc/deploy/rpm/$p static/
|
|
||||||
done <packages
|
|
||||||
cd static
|
|
||||||
createrepo .
|
|
||||||
aws s3 sync . s3://solo-packages/3.10.17-rt12/ --acl public-read --delete
|
|
@ -1,9 +0,0 @@
|
|||||||
cortexa9hf_vfp_neon/busybox-1.21.1-r1.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/libptp-1.1.10-r0.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/e2fsprogs-1.42.8-r0.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/e2fsprogs-badblocks-1.42.8-r0.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/e2fsprogs-mke2fs-1.42.8-r0.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/libss2-1.42.8-r0.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/lsof-4.87-r0.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/parted-3.1-r1.cortexa9hf_vfp_neon.rpm
|
|
||||||
cortexa9hf_vfp_neon/libusb-0.1-4-0.1.5-r0.cortexa9hf_vfp_neon.rpm
|
|
@ -1,93 +1,72 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# alternative to the 'sync' tool, which puts stuff in /solo-build, for now we'll use /solo-build-alt
|
|
||||||
#
|
|
||||||
# 'master', 'tags/2.9.94' ( for a tag) or '2.9.94' ( for a branch ) is ok:
|
|
||||||
set -xv
|
|
||||||
|
|
||||||
name=$1
|
# Create the build directory and make sure we own it.
|
||||||
echo "git reference: $name"
|
build_dir=/solo-build
|
||||||
#
|
source_dir=$build_dir/sources
|
||||||
sudo mkdir /solo-build-alt
|
sudo mkdir -p $source_dir
|
||||||
sudo chown vagrant /solo-build-alt
|
sudo chown -R $USER $build_dir
|
||||||
cd /solo-build-alt
|
cd $build_dir
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/poky
|
mkdir -p $source_dir/poky
|
||||||
git clone git://git.yoctoproject.org/poky sources/poky 2>&1 | grep -v 'fatal'
|
git clone git://git.yoctoproject.org/poky $source_dir/poky 2>&1 | grep -v 'fatal'
|
||||||
cd sources/poky
|
cd $source_dir/poky
|
||||||
git fetch
|
git fetch
|
||||||
git checkout bee7e3756adf70edaeabe9d43166707aab84f581 2>&1
|
git checkout bee7e3756adf70edaeabe9d43166707aab84f581
|
||||||
cd ../..
|
|
||||||
|
## This BB file has a bad source URI, but it isn't our file to fix.
|
||||||
|
cp -f /vagrant/solo-builder/gtk-doc-stub_git.bb $source_dir/poky/meta/recipes-gnome/gtk-doc-stub/gtk-doc-stub_git.bb
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-fsl-arm
|
mkdir -p $source_dir/meta-fsl-arm
|
||||||
git clone git://git.yoctoproject.org/meta-fsl-arm sources/meta-fsl-arm 2>&1 | grep -v 'fatal'
|
git clone git://git.yoctoproject.org/meta-fsl-arm $source_dir/meta-fsl-arm 2>&1 | grep -v 'fatal'
|
||||||
cd sources/meta-fsl-arm
|
cd $source_dir/meta-fsl-arm
|
||||||
git fetch
|
git fetch
|
||||||
git checkout af392c22bf6b563525ede4a81b6755ff1dd2c1c6 2>&1
|
git checkout af392c22bf6b563525ede4a81b6755ff1dd2c1c6
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-openembedded
|
mkdir -p $source_dir/meta-openembedded
|
||||||
git clone git://git.openembedded.org/meta-openembedded sources/meta-openembedded 2>&1 | grep -v 'fatal'
|
git clone git://git.openembedded.org/meta-openembedded $source_dir/meta-openembedded 2>&1 | grep -v 'fatal'
|
||||||
cd sources/meta-openembedded
|
cd $source_dir/meta-openembedded
|
||||||
git fetch
|
git fetch
|
||||||
git checkout eb4563b83be0a57ede4269ab19688af6baa62cd2 2>&1
|
git checkout eb4563b83be0a57ede4269ab19688af6baa62cd2
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/base
|
mkdir -p $source_dir/base
|
||||||
rsync -r /vagrant/3dr-yocto-bsp-base/ sources/base --delete
|
rsync -r /vagrant/solo-builder/3dr-yocto-bsp-base/ $source_dir/base --delete
|
||||||
# mkdir -p sources/base
|
cp $source_dir/base/README.md $build_dir
|
||||||
# git clone git://github.com/OpenSolo/3dr-yocto-bsp-base sources/base 2>&1 | grep -v 'fatal'
|
cp $source_dir/base/setup-environment $build_dir
|
||||||
# cd sources/base
|
|
||||||
# git fetch
|
|
||||||
# echo git checkout $name 2>&1
|
|
||||||
# git checkout $name 2>&1
|
|
||||||
# cd ../..
|
|
||||||
cp sources/base/README.md .
|
|
||||||
cp sources/base/setup-environment .
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-3dr
|
mkdir -p $source_dir/meta-3dr
|
||||||
rsync -r /vagrant/meta-3dr/ sources/meta-3dr --delete
|
rsync -r /vagrant/meta-3dr/ $source_dir/meta-3dr --delete
|
||||||
# mkdir -p sources/meta-3dr
|
|
||||||
# git clone git://github.com/OpenSolo/meta-3dr sources/meta-3dr 2>&1 | grep -v 'fatal'
|
|
||||||
# cd sources/meta-3dr
|
|
||||||
# git fetch
|
|
||||||
# echo git checkout $name 2>&1
|
|
||||||
# git checkout $name 2>&1
|
|
||||||
# git pull origin
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-fsl-arm-extra
|
mkdir -p $source_dir/meta-fsl-arm-extra
|
||||||
git clone git://github.com/Freescale/meta-fsl-arm-extra sources/meta-fsl-arm-extra 2>&1 | grep -v 'fatal'
|
git clone git://github.com/Freescale/meta-fsl-arm-extra $source_dir/meta-fsl-arm-extra 2>&1 | grep -v 'fatal'
|
||||||
cd sources/meta-fsl-arm-extra
|
cd $source_dir/meta-fsl-arm-extra
|
||||||
git fetch
|
git fetch
|
||||||
git checkout 07ad83db0fb67c5023bd627a61efb7f474c52622 2>&1
|
git checkout 07ad83db0fb67c5023bd627a61efb7f474c52622
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-fsl-demos
|
mkdir -p $source_dir/meta-fsl-demos
|
||||||
git clone git://github.com/Freescale/meta-fsl-demos sources/meta-fsl-demos 2>&1 | grep -v 'fatal'
|
git clone git://github.com/Freescale/meta-fsl-demos $source_dir/meta-fsl-demos 2>&1 | grep -v 'fatal'
|
||||||
cd sources/meta-fsl-demos
|
cd $source_dir/meta-fsl-demos
|
||||||
git fetch
|
git fetch
|
||||||
git checkout 5a12677ad000a926d23c444266722a778ea228a7 2>&1
|
git checkout 5a12677ad000a926d23c444266722a778ea228a7
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-browser
|
mkdir -p $source_dir/meta-browser
|
||||||
git clone git://github.com/OSSystems/meta-browser sources/meta-browser 2>&1 | grep -v 'fatal'
|
git clone git://github.com/OSSystems/meta-browser $source_dir/meta-browser 2>&1 | grep -v 'fatal'
|
||||||
cd sources/meta-browser
|
cd $source_dir/meta-browser
|
||||||
git fetch
|
git fetch
|
||||||
git checkout fc3969f63bda343c38c40a23f746c560c4735f3e 2>&1
|
git checkout fc3969f63bda343c38c40a23f746c560c4735f3e
|
||||||
cd ../..
|
|
||||||
|
|
||||||
echo "----------------------------------------------------------------------------"
|
echo "----------------------------------------------------------------------------"
|
||||||
mkdir -p sources/meta-fsl-bsp-release
|
mkdir -p $source_dir/meta-fsl-bsp-release
|
||||||
git clone git://git.freescale.com/imx/meta-fsl-bsp-release sources/meta-fsl-bsp-release 2>&1 | grep -v 'fatal'
|
git clone git://git.freescale.com/imx/meta-fsl-bsp-release $source_dir/meta-fsl-bsp-release 2>&1 | grep -v 'fatal'
|
||||||
cd sources/meta-fsl-bsp-release
|
cd $source_dir/meta-fsl-bsp-release
|
||||||
git fetch
|
git fetch
|
||||||
git checkout dora_3.10.17-1.0.0_GA 2>&1
|
git checkout dora_3.10.17-1.0.0_GA
|
||||||
cd ../..
|
cd $build_dir
|
||||||
cp sources/meta-fsl-bsp-release/imx/tools/fsl-setup-release.sh .
|
cp $source_dir/meta-fsl-bsp-release/imx/tools/fsl-setup-release.sh $build_dir
|
||||||
|
@ -1,187 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import pwd
|
|
||||||
import subprocess
|
|
||||||
import os, pwd, grp
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
def get_username():
|
|
||||||
return pwd.getpwuid( os.getuid() )[ 0 ]
|
|
||||||
|
|
||||||
me = get_username()
|
|
||||||
if ( me != 'root' ) :
|
|
||||||
print(" must be run as root, sorry, aborting. \n");
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
if os.path.isfile("/vagrant/progress.log"):
|
|
||||||
print "unable to run, another copy is already runniing, see /vagrant/progress.log";
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
# open logfile:
|
|
||||||
logfile = "/vagrant/progress.log"
|
|
||||||
log = open(logfile, "w+")
|
|
||||||
|
|
||||||
|
|
||||||
# we display results as-it-happens, but also capture them
|
|
||||||
def run_command_capture_results(cmd='true', doLog=True):
|
|
||||||
if doLog:
|
|
||||||
print >>log, "cmd: "+cmd+"\n"
|
|
||||||
print "cmd: "+cmd+"\n"
|
|
||||||
p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE,stdout=subprocess.PIPE)
|
|
||||||
ret = ''
|
|
||||||
|
|
||||||
dobreak = False
|
|
||||||
doNext = False
|
|
||||||
while True:
|
|
||||||
#print p.poll()
|
|
||||||
|
|
||||||
#out = p.stdout.readline()
|
|
||||||
out = p.stdout.read(1)
|
|
||||||
# poll() returns None if process is still running, or exit code if it's done
|
|
||||||
if out == "":
|
|
||||||
if p.poll() is not None:
|
|
||||||
#print "OUT BREAK : " + str(p.poll())
|
|
||||||
dobreak = True
|
|
||||||
# otherwise handle the data we got prom the process:
|
|
||||||
while out != '' and doNext == False:
|
|
||||||
#if doNext == True:
|
|
||||||
# out = out + "\n"
|
|
||||||
# doNext = False
|
|
||||||
sys.stdout.write(out)
|
|
||||||
sys.stdout.flush()
|
|
||||||
if doLog:
|
|
||||||
log.write(out)
|
|
||||||
log.flush()
|
|
||||||
ret += out
|
|
||||||
out = p.stdout.read(1)
|
|
||||||
#if out == "\n":
|
|
||||||
# doNext = True
|
|
||||||
|
|
||||||
#err = p.stderr.readline()
|
|
||||||
err = p.stderr.read(1)
|
|
||||||
if err == "":
|
|
||||||
if p.poll() is not None:
|
|
||||||
#print "ERR BREAK" + str(p.poll())
|
|
||||||
dobreak = True
|
|
||||||
while err != '' and doNext == False:
|
|
||||||
#if doNext == True:
|
|
||||||
# out = out + "\n"
|
|
||||||
# doNext = False
|
|
||||||
sys.stdout.write(err)
|
|
||||||
sys.stdout.flush()
|
|
||||||
if doLog:
|
|
||||||
log.write(err)
|
|
||||||
log.flush()
|
|
||||||
ret += err
|
|
||||||
err = p.stderr.read(1)
|
|
||||||
#if err == "\n":
|
|
||||||
# doNext = True
|
|
||||||
|
|
||||||
if dobreak == True:
|
|
||||||
break
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
def drop_privileges(uid_name='nobody', gid_name='nogroup'):
|
|
||||||
if os.getuid() != 0:
|
|
||||||
# We're not root so, like, whatever dude
|
|
||||||
return
|
|
||||||
|
|
||||||
# Get the uid/gid from the name
|
|
||||||
running_uid = pwd.getpwnam(uid_name).pw_uid
|
|
||||||
running_gid = grp.getgrnam(gid_name).gr_gid
|
|
||||||
|
|
||||||
# Remove group privileges
|
|
||||||
os.setgroups([])
|
|
||||||
|
|
||||||
# Try setting the new uid/gid
|
|
||||||
os.setgid(running_gid)
|
|
||||||
os.setuid(running_uid)
|
|
||||||
|
|
||||||
# Ensure a very conservative umask
|
|
||||||
old_umask = os.umask(002)
|
|
||||||
|
|
||||||
# tasks potentially needing root:
|
|
||||||
|
|
||||||
print >>log, "fixing perms\n";
|
|
||||||
print "fixing perms\n";
|
|
||||||
run_command_capture_results("chown -R vagrant /vagrant/.git /vagrant/.gitignore");
|
|
||||||
run_command_capture_results("chown -R vagrant /vagrant/*");
|
|
||||||
|
|
||||||
# now actually do ita:
|
|
||||||
#print >>log, "dropping privs to 'vagrant'\n";
|
|
||||||
drop_privileges('vagrant','vagrant');
|
|
||||||
|
|
||||||
me = get_username()
|
|
||||||
if ( me != 'vagrant' ) :
|
|
||||||
print >>log, "error while trying to drop root and running as vagrant user, aborting. \n";
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
|
|
||||||
run_command_capture_results("rm /vagrant/www/latest_run.txt", False);
|
|
||||||
|
|
||||||
#run_command_capture_results("touch /vagrant/www/in-progress.txt", False);
|
|
||||||
progress = open("/vagrant/www/in-progress.txt",'w+')
|
|
||||||
|
|
||||||
|
|
||||||
print >>log, "now running as 'vagrant' user.\nstarting run at:\n";
|
|
||||||
print "now running as 'vagrant' user.\nstarting run at:\n";
|
|
||||||
run_command_capture_results("date");
|
|
||||||
|
|
||||||
|
|
||||||
print >>log, "chdir /vagrant";
|
|
||||||
print "chdir /vagrant";
|
|
||||||
os.chdir("/vagrant");
|
|
||||||
|
|
||||||
run_command_capture_results("git pull");
|
|
||||||
|
|
||||||
# compare git rev with last-run, if changed, then we run again...
|
|
||||||
gitrev = run_command_capture_results("git rev-parse --verify HEAD");
|
|
||||||
touch = run_command_capture_results("touch /vagrant/gitrev.txt");
|
|
||||||
with open('gitrev.txt', 'r+') as f_in:
|
|
||||||
prev = f_in.read()
|
|
||||||
f_in.close()
|
|
||||||
# if they are different, make them the same.
|
|
||||||
if gitrev != prev:
|
|
||||||
with open('gitrev.txt', 'w+') as f_out:
|
|
||||||
f_out.write(gitrev)
|
|
||||||
f_in.close()
|
|
||||||
# just let the human know the thing we are currently trying to do, by it's git hash..
|
|
||||||
progress.write(gitrev)
|
|
||||||
|
|
||||||
# if no change, then don't re-run
|
|
||||||
if gitrev == prev:
|
|
||||||
print >>log, "no change in solo-builder git revision, not re-running. ( to force re-run, delete /vagrant/gitrev.txt file)";
|
|
||||||
print "no change in solo-builder git revision, not re-running. ( to force re-run, delete /vagrant/gitrev.txt file)";
|
|
||||||
|
|
||||||
else:
|
|
||||||
# run something.
|
|
||||||
run_command_capture_results("echo \"y\" |/vagrant/builder.sh");
|
|
||||||
|
|
||||||
print >>log, "finished run at:\n";
|
|
||||||
run_command_capture_results("date");
|
|
||||||
|
|
||||||
print "log closed. \n";
|
|
||||||
log.close();
|
|
||||||
|
|
||||||
print "log relocated. \n";
|
|
||||||
|
|
||||||
comp = ''
|
|
||||||
with open('/tmp/COMP.txt', 'r+') as f_in:
|
|
||||||
comp = f_in.read()
|
|
||||||
f_in.close()
|
|
||||||
comp = comp.rstrip()
|
|
||||||
if comp == '':
|
|
||||||
print "log relocation aborted,cant find /tmp/COMP.txt";
|
|
||||||
|
|
||||||
run_command_capture_results("mv /vagrant/progress.log /vagrant/binaries/"+comp+"/latest_run.txt", False);
|
|
||||||
|
|
||||||
# either way, wind up the files and handles:
|
|
||||||
progress.close()
|
|
||||||
run_command_capture_results("rm /vagrant/www/latest_run.txt", False);
|
|
||||||
run_command_capture_results("mv /vagrant/www/in-progress.txt /vagrant/www/latest_run.txt", False);
|
|
||||||
run_command_capture_results("rm /vagrant/progress.log", False);
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user