From 171899ead13a17efe2daf78d6b6bc6f0344b8a85 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Wed, 15 Nov 2017 17:07:42 -0500 Subject: [PATCH 1/2] 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 + From 497721addd0a8186cd080468e34a644bb7481d6f Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Wed, 15 Nov 2017 17:14:46 -0500 Subject: [PATCH 2/2] Add libevent bundle --- src/.config | 7 ++++ src/README | 4 ++ .../bundles/libevent/01_get.sh | 41 +++++++++++++++++++ .../bundles/libevent/02_build.sh | 37 +++++++++++++++++ .../bundles/libevent/bundle.sh | 9 ++++ 5 files changed, 98 insertions(+) create mode 100755 src/minimal_overlay/bundles/libevent/01_get.sh create mode 100755 src/minimal_overlay/bundles/libevent/02_build.sh create mode 100755 src/minimal_overlay/bundles/libevent/bundle.sh diff --git a/src/.config b/src/.config index 2e3b2d13b..c25068120 100644 --- a/src/.config +++ b/src/.config @@ -84,6 +84,12 @@ KBD_SOURCE_URL=https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.4.tar.gz # KEXEC_TOOLS_SOURCE_URL=http://kernel.org/pub/linux/utils/kernel/kexec/kexec-tools-2.0.15.tar.xz +# You can find the latest libevent archives here: +# +# https://github.com/libevent/libevent/releases/ +# +LIBEVENT_SOURCE_URL=https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz + # You can find the latest Links source bundles here: # # http://links.twibright.com @@ -223,6 +229,7 @@ COPY_SOURCE_ISO=true # felix - Apache Felix OSGi framework. # java - installs Oracle's JRE or JDK. Manual preparations are required. # kbd - keyboard utilities +# libevent - event notification library. # links - text browser for the web. # lua - scripting language. # mll_utils - set of executable utilities (mll-*). diff --git a/src/README b/src/README index 673b12652..a78a43144 100644 --- a/src/README +++ b/src/README @@ -57,6 +57,10 @@ Currently available overlay bundles: loadkeys de +* libevent - event notification library API provides a mechanism to execute a + callback function when a specific event occurs on a file + descriptor or after a timeout has been reached. + * Links - Text based browser. Requires ~1MB additional space. Use the "links" command to activate the browser. diff --git a/src/minimal_overlay/bundles/libevent/01_get.sh b/src/minimal_overlay/bundles/libevent/01_get.sh new file mode 100755 index 000000000..79beb6988 --- /dev/null +++ b/src/minimal_overlay/bundles/libevent/01_get.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +# Grab everything after the '=' character. +DOWNLOAD_URL=$(grep -i LIBEVENT_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 libevent source bundle file. The '-c' option allows the download to resume. + echo "Downloading libevent source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local libevent source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted libevent. +echo "Removing libevent work area. This may take a while..." +rm -rf $WORK_DIR/overlay/libevent +mkdir $WORK_DIR/overlay/libevent + +# Extract libevent to folder 'work/overlay/libevent'. +# Full path will be something like 'work/overlay/libevent/libevent-2.1.8-stable'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/libevent + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/libevent/02_build.sh b/src/minimal_overlay/bundles/libevent/02_build.sh new file mode 100755 index 000000000..3360ed45b --- /dev/null +++ b/src/minimal_overlay/bundles/libevent/02_build.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +. ../../common.sh + +cd $WORK_DIR/overlay/libevent + +DESTDIR="$PWD/libevent_installed" + +# Change to the libevent source directory which ls finds, e.g. 'libevent-2.1.8-stable'. +cd $(ls -d libevent-*) + +echo "Preparing libevent work area. This may take a while..." +make -j $NUM_JOBS clean + +rm -rf $DESTDIR + +echo "Configuring libevent..." +CFLAGS="$CFLAGS" ./configure + +echo "Building libevent..." +make -j $NUM_JOBS + +echo "Installing libevent..." +make -j $NUM_JOBS install DESTDIR=$DESTDIR + +echo "Reducing libevent size..." +strip -g $DESTDIR/usr/bin/* + +ROOTFS="$WORK_DIR/src/minimal_overlay/rootfs" + +cp -r $DESTDIR/usr/local/* $ROOTFS + +echo "libevent has been installed." + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/libevent/bundle.sh b/src/minimal_overlay/bundles/libevent/bundle.sh new file mode 100755 index 000000000..ffd32c002 --- /dev/null +++ b/src/minimal_overlay/bundles/libevent/bundle.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +SRC_DIR=$(pwd) + +./01_get.sh +./02_build.sh + +cd $SRC_DIR +