Commit bea56308 authored by iv's avatar iv

nayuos: Add custom ebuilds for re6st and change path for produced images.

parent 9be490db
......@@ -10,6 +10,7 @@ in /etc/sudoers:
<pre><code>
\<slapuser\> ALL= NOPASSWD: /srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/clone-depot-tools/cros_sdk, /srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/chromite/bin/cros_sdk, /srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/chromite/bootstrap/cros_sdk, /srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/chromite/scripts/cros_sdk.py, /srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/chromite/scripts/cros_sdk.pyc, /srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/chromium/tools/depot_tools/cros_sdk
</code></pre>
* the custom ebuilds of net-libs/miniupnpc, net-misc/babeld-re6stnet and net-misc/re6stnet in the custom_ebuilds directory
## Input
In the vifib parameters (softinst\<nb\>.host.vifib.net \> Services \> Parameters):
......@@ -19,9 +20,9 @@ In the vifib parameters (softinst\<nb\>.host.vifib.net \> Services \> Parameters
## Output
The image will be produced in
<code>/srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/\<board_name\>.img</code>
and the logs are in
The image will be produced in:
<code>/srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/parts/chromiumos/images/</code>
and the logs are in:
<code>/srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/var/log/cros_sources_dl.log</code> and <code>/srv/slapgrid/\<part\>/srv/runner/instance/\<inst_part\>/var/log/cros_build.log</code>
The script that download the sources and build is located in
......
[buildout]
parts =
parameters
modify-image-script
template-full-build-script
# eggs given by software.cfg
......@@ -39,6 +38,8 @@ recipe = slapos.cookbook:mkdirectory
log = ${buildout:directory}/var/log
run = ${buildout:directory}/etc/run
cros_location = ${buildout:directory}/parts/chromiumos
ebuilds_dir = {{ ebuilds_dir }}
scripts_dir = {{ scripts_dir }}
[template-full-build-script]
......@@ -47,7 +48,7 @@ cros_location = ${buildout:directory}/parts/chromiumos
recipe = slapos.recipe.template:jinja2
template = {{ scripts_dir }}/cros_full_build.sh.in
rendered = ${directory:run}/cros_full_build.sh
# md5sum =
md5sum = a698b56b99492b22f76d402d3def5774
mode = 0770
context =
# for access to the eggs from the instance
......@@ -56,15 +57,5 @@ context =
key depot_tools_export_path_cmd depot-tools:export-path
key branch parameters:configuration.branch
key boards_list parameters:configuration.boards
[modify-image-script]
# create the script that will modify the image after the build
recipe = slapos.recipe.template:jinja2
template = {{ scripts_dir }}/modify_image.sh.in
rendered = ${directory:cros_location}/src/scripts/modify_image.sh
mode = 0770
commands = sudo rm /tmp/m/etc/init/openssh-server.conf
sudo emerge-$${BOARD} --root=/tmp/m --root-deps=rdeps --usepkgonly git
context =
key board parameters:configuration.boards
key commands :commands
\ No newline at end of file
key ebuilds_dir directory:ebuilds_dir
key scripts_dir directory:scripts_dir
\ No newline at end of file
#!/bin/bash
#XXX: should not depend on the host's bash ^
#################mo####### Download of sources using the "repo" command ########################
######################## Download of sources using the "repo" command ########################
DL_LOG={{ instance_log_dir }}/cros_sources_dl.log
BRANCH={{ branch }}
echo "getting Chromium OS sources..." >> $DL_LOG
{{ depot_tools_export_path_cmd }}
cd {{ cros_location }}
repo init -u https://chromium.googlesource.com/chromiumos/manifest.git -b {{ branch }} >> $DL_LOG
repo init -u https://chromium.googlesource.com/chromiumos/manifest.git -b ${BRANCH} >> $DL_LOG
repo sync >> $DL_LOG
############################## Prepare chroot environment ###################################
{{ depot_tools_export_path_cmd }}
cd {{ cros_location }}
# create chroot environment (exit on failure)
cros_sdk --download || exit 1
# add custom script for modifying the final image after building
# that is useful for custumizing Chromium OS and produce Nayu images for now
cp {{ scripts_dir }}/modify_image.sh {{ cros_location }}/src/scripts/modify_image.sh \
&& chmod 770 {{ cros_location }}/src/scripts/modify_image.sh || exit 1
# add custom ebuilds
for category in $( ls {{ ebuilds_dir }} ); do
echo ${category}
cp -R {{ ebuilds_dir }}/${category}/* {{ cros_location}}/src/third_party/chromiumos-overlay/${category}/
done
######################################## Build ##############################################
BOARDS="{{ boards_list }}"
for board in ${BOARDS}; do
echo ${board}
if [ ${board} == daisy ]; then
......@@ -19,8 +39,6 @@ for board in ${BOARDS}; do
cros_sdk -- sudo sh -c "echo 'ACCEPT_LICENSE=\"*\"' >> /etc/make.conf.user"
fi
{{ depot_tools_export_path_cmd }}
cd {{ cros_location }}
IMAGE_LOCATION=${board}.chromiumos.img
NAYU_IMAGE_LOCATION=${board}.nayuos.img
BUILD_LOG={{ instance_log_dir }}/cros_build.log
......@@ -43,13 +61,35 @@ for board in ${BOARDS}; do
echo "rebuilding image with noenable_rootfs_verification and modifying image" >> $BUILD_LOG
cros_sdk -- ./build_image --noenable_rootfs_verification --board=${board} >> $BUILD_LOG \
&& echo "modifying image, removing old image if any and creating image file $NAYU_IMAGE_LOCATION..." >> $BUILD_LOG \
&& cros_sdk -- sudo install -d /usr/local/usr/lib/debug \
&& cros_sdk -- sudo emerge-${board} net-misc/babeld-re6stnet net-libs/miniupnpc net-misc/re6stnet >> $BUILD_LOG \
&& cros_sdk -- ./modify_image.sh ${board} \
&& cros_sdk -- rm -f $NAYU_IMAGE_LOCATION && cros_sdk -- touch $NAYU_IMAGE_LOCATION \
&& cros_sdk -- cros flash --board=${board} file://$NAYU_IMAGE_LOCATION >> $BUILD_LOG
&& cros_sdk -- cros flash --board=${board} file://$NAYU_IMAGE_LOCATION >> $BUILD_LOG \
|| exit 1
# add some packages to the board's packages
echo "adding re6st and its dependencies to the chroot/build/${board}/packages..." >> $BUILD_LOG
if [ ${board} == daisy ]; then
echo "daisy board: removing accepted license for the next builds..."
cros_sdk -- sudo sh -c "cp /etc/make.conf.user.save /etc/make.conf.user"
cros_sdk -- sudo sh -c "mv /etc/make.conf.user.save /etc/make.conf.user"
fi
done
####################################### Post build ##########################################
# keep only the substring between - as current release
RELEASE=$(sed 's/.*-\(.*\)-.*//' <<< "$BRANCH")
DIR_IMAGE_LOCATION={{ cros_location }}/images/${RELEASE}/$(date +'%F')
install ${DIR_IMAGE_LOCATION} -d
mv {{ cros_location }}/src/scripts/*.img ${DIR_IMAGE_LOCATION}
cd ${DIR_IMAGE_LOCATION}
for hashfunction in md5sum sha1 sha256 sh512; do
${hashfunction} *.img >> hashes.txt
done
for file in $(ls *.img); do
tar cfz ${file}.tar ${file}
done
exit 0
\ No newline at end of file
#! /bin/bash
# will modify all the images produced after running the script for the given board
# This script will modify all the images produced after running it for the given board,
# that is given as first parameter
BOARD=$1
./mount_gpt_image.sh -f $( ./get_latest_image.sh --board=${BOARD} )
{{ commands }}
sudo rm /tmp/m/etc/init/openssh-server.conf
sudo emerge-${BOARD} --root=/tmp/m --root-deps=rdeps --usepkgonly git babeld-re6stnet re6stnet
./mount_gpt_image.sh -f $( ./get_latest_image.sh --board=${BOARD} ) -u
\ No newline at end of file
......@@ -35,14 +35,16 @@ command = sudo -V
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg
rendered = ${buildout:directory}/instance.cfg
md5sum = 1d0d186af7d838ae79313d1b330c1c37
md5sum = fd1efcf9ad466694bde651ab52fd31c9
mode = 0644
scripts_dir = ${:_profile_base_location_}/scripts
ebuilds_dir = ${:_profile_base_location_}/custom_ebuilds
context =
# for access to the eggs from the instance
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
key scripts_dir :scripts_dir
key ebuilds_dir :ebuilds_dir
[install-eggs-for-the-instance]
# after installation of the eggs, the recipes
......
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