From 171899ead13a17efe2daf78d6b6bc6f0344b8a85 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Wed, 15 Nov 2017 17:07:42 -0500 Subject: [PATCH] Add fio bundle --- src/.config | 7 ++++ src/README | 4 ++ src/minimal_overlay/bundles/fio/01_get.sh | 41 +++++++++++++++++++++ src/minimal_overlay/bundles/fio/02_build.sh | 38 +++++++++++++++++++ src/minimal_overlay/bundles/fio/bundle.sh | 9 +++++ 5 files changed, 99 insertions(+) create mode 100755 src/minimal_overlay/bundles/fio/01_get.sh create mode 100755 src/minimal_overlay/bundles/fio/02_build.sh create mode 100755 src/minimal_overlay/bundles/fio/bundle.sh diff --git a/src/.config b/src/.config index 2e3b2d13b..022f48fac 100644 --- a/src/.config +++ b/src/.config @@ -65,6 +65,12 @@ DROPBEAR_SOURCE_URL=http://matt.ucc.asn.au/dropbear/releases/dropbear-2017.75.ta # FELIX_SOURCE_URL=http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-5.6.8.tar.gz +# You can find the latest fio source bundles here: +# +# https://github.com/axboe/fio/releases +# +FIO_SOURCE_URL=https://github.com/axboe/fio/archive/fio-3.2.tar.gz + # You need to manually download Oracle's JRE or JDK and set the property with # the absolute path to the downloaded archive. Example: # @@ -221,6 +227,7 @@ COPY_SOURCE_ISO=true # dhcp - DHCP and DNS functionality. # dropbear - SSH server and client. # felix - Apache Felix OSGi framework. +# fio - I/O load generator. # java - installs Oracle's JRE or JDK. Manual preparations are required. # kbd - keyboard utilities # links - text browser for the web. diff --git a/src/README b/src/README index 673b12652..8654250da 100644 --- a/src/README +++ b/src/README @@ -45,6 +45,10 @@ Currently available overlay bundles: This overlay bundle requires JRE or JDK. +* fio - I/O load generator that can simulate a wide variety of workloads + on RAM or disks. fio is essential for troubleshooting data + bottlenecks. + * JRE / JDK - Oracle's JRE or JDK. Requires ~366MB additional space for JDK. This overlay bundle requires some manual preparation steps. Refer to the "JAVA_ARCHIVE" property in the ".config" file for more diff --git a/src/minimal_overlay/bundles/fio/01_get.sh b/src/minimal_overlay/bundles/fio/01_get.sh new file mode 100755 index 000000000..d02590fb0 --- /dev/null +++ b/src/minimal_overlay/bundles/fio/01_get.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i FIO_SOURCE_URL $MAIN_SRC_DIR/.config | cut -f2 -d'=') + +# Grab everything after the last '/' character. +ARCHIVE_FILE=${DOWNLOAD_URL##*/} + +# Read the 'USE_LOCAL_SOURCE' property from '.config' +USE_LOCAL_SOURCE="$(grep -i USE_LOCAL_SOURCE $MAIN_SRC_DIR/.config | cut -f2 -d'=')" + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE ] ; then + echo "Source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading fio source bundle file. The '-c' option allows the download to resume. + echo "Downloading fio source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local fio source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted fio. +echo "Removing fio work area. This may take a while..." +rm -rf $WORK_DIR/overlay/fio +mkdir $WORK_DIR/overlay/fio + +# Extract fio to folder 'work/overlay/fio'. +# Full path will be something like 'work/overlay/fio/fio-3.2'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/fio + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/fio/02_build.sh b/src/minimal_overlay/bundles/fio/02_build.sh new file mode 100755 index 000000000..d41153eca --- /dev/null +++ b/src/minimal_overlay/bundles/fio/02_build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/fio + +DESTDIR="$PWD/fio_installed" + +# Change to the fio source directory which ls finds, e.g. 'fio-3.2'. +cd $(ls -d fio-*) + +echo "Preparing fio work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +echo "Configuring fio..." +CFLAGS="$CFLAGS" ./configure \ + --prefix=/usr + +echo "Building fio..." +make -j $NUM_JOBS + +echo "Installing fio..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing fio size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/* $ROOTFS + +echo "fio has been installed." + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/fio/bundle.sh b/src/minimal_overlay/bundles/fio/bundle.sh new file mode 100755 index 000000000..ffd32c002 --- /dev/null +++ b/src/minimal_overlay/bundles/fio/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +./01_get.sh +./02_build.sh + +cd $SRC_DIR +