From 6950e6030d9f439c981b574da93e965c0c90cdc8 Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Thu, 18 May 2017 12:50:30 +0100 Subject: [PATCH] Add option for building IPMItool into TinyIPA IPMItool is required for discovering the IPMI/BMC address during inspection, currently its not built into TinyIPA so this patch adds the tool to make that feature work. Change-Id: I35bf7db3a870bc3981992e4e86d851d3f2512fd6 --- imagebuild/tinyipa/.gitignore | 1 + imagebuild/tinyipa/build-tinyipa.sh | 14 ++++++++++++-- imagebuild/tinyipa/finalise-tinyipa.sh | 7 +++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/imagebuild/tinyipa/.gitignore b/imagebuild/tinyipa/.gitignore index cd28c77a3..1e6b193f4 100644 --- a/imagebuild/tinyipa/.gitignore +++ b/imagebuild/tinyipa/.gitignore @@ -5,6 +5,7 @@ tinyipabuild tinyipafinal *.vmlinuz vmlinuz64 +*.sha256 *.iso *.tcz* squashfs-root diff --git a/imagebuild/tinyipa/build-tinyipa.sh b/imagebuild/tinyipa/build-tinyipa.sh index 099aa7469..9ceda4342 100755 --- a/imagebuild/tinyipa/build-tinyipa.sh +++ b/imagebuild/tinyipa/build-tinyipa.sh @@ -7,6 +7,7 @@ BUILDDIR="$WORKDIR/tinyipabuild" BUILD_AND_INSTALL_TINYIPA=${BUILD_AND_INSTALL_TINYIPA:-false} TINYCORE_MIRROR_URL=${TINYCORE_MIRROR_URL:-} TINYIPA_REQUIRE_BIOSDEVNAME=${TINYIPA_REQUIRE_BIOSDEVNAME:-false} +TINYIPA_REQUIRE_IPMITOOL=${TINYIPA_REQUIRE_IPMITOOL:-true} CHROOT_PATH="/tmp/overides:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin" CHROOT_CMD="sudo chroot $BUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy" @@ -58,12 +59,15 @@ sudo sh -c "echo $TINYCORE_MIRROR_URL > $BUILDDIR/opt/tcemirror" # Download get-pip into ramdisk ( cd "$BUILDDIR/tmp" && wget https://bootstrap.pypa.io/get-pip.py ) -# Download TGT, Qemu-utils, and Biosdevname source +# Download TGT, Qemu-utils, Biosdevname and IPMItool source clone_and_checkout "https://github.com/fujita/tgt.git" "${BUILDDIR}/tmp/tgt" "v1.0.62" clone_and_checkout "https://github.com/qemu/qemu.git" "${BUILDDIR}/tmp/qemu" "v2.5.0" if $TINYIPA_REQUIRE_BIOSDEVNAME; then wget -N -O - https://linux.dell.com/biosdevname/biosdevname-0.7.2/biosdevname-0.7.2.tar.gz | tar -xz -C "${BUILDDIR}/tmp" -f - fi +if $TINYIPA_REQUIRE_IPMITOOL; then + wget -N -O - https://sourceforge.net/projects/ipmitool/files/ipmitool/1.8.18/ipmitool-1.8.18.tar.gz/download | tar -xz -C "${BUILDDIR}/tmp" -f - +fi # Create directory for python local mirror mkdir -p "$BUILDDIR/tmp/localpip" @@ -115,7 +119,6 @@ rm -rf $WORKDIR/build_files/qemu-utils.tcz $CHROOT_CMD /bin/sh -c "cd /tmp/qemu && ./configure --disable-system --disable-user --disable-linux-user --disable-bsd-user --disable-guest-agent --disable-blobs && make && make install DESTDIR=/tmp/qemu-utils" find $BUILDDIR/tmp/qemu-utils/ -type f -executable | xargs file | awk -F ':' '/ELF/ {print $1}' | sudo xargs strip cd $WORKDIR/build_files && mksquashfs $BUILDDIR/tmp/qemu-utils qemu-utils.tcz && md5sum qemu-utils.tcz > qemu-utils.tcz.md5.txt - # Create qemu-utils.tcz.dep echo "glib2.tcz" > qemu-utils.tcz.dep @@ -126,3 +129,10 @@ if $TINYIPA_REQUIRE_BIOSDEVNAME; then find $BUILDDIR/tmp/biosdevname-installed/ -type f -executable | xargs file | awk -F ':' '/ELF/ {print $1}' | sudo xargs strip cd $WORKDIR/build_files && mksquashfs $BUILDDIR/tmp/biosdevname-installed biosdevname.tcz && md5sum biosdevname.tcz > biosdevname.tcz.md5.txt fi + +if $TINYIPA_REQUIRE_IPMITOOL; then + rm -rf $WORKDIR/build_files/ipmitool.tcz + $CHROOT_CMD /bin/sh -c "cd /tmp/ipmitool-* && ./configure && make && make install DESTDIR=/tmp/ipmitool" + find $BUILDDIR/tmp/ipmitool/ -type f -executable | xargs file | awk -F ':' '/ELF/ {print $1}' | sudo xargs strip + cd $WORKDIR/build_files && mksquashfs $BUILDDIR/tmp/ipmitool ipmitool.tcz && md5sum ipmitool.tcz > ipmitool.tcz.md5.txt +fi diff --git a/imagebuild/tinyipa/finalise-tinyipa.sh b/imagebuild/tinyipa/finalise-tinyipa.sh index 5971cf92a..4d1419d63 100755 --- a/imagebuild/tinyipa/finalise-tinyipa.sh +++ b/imagebuild/tinyipa/finalise-tinyipa.sh @@ -11,6 +11,7 @@ ENABLE_SSH=${ENABLE_SSH:-false} SSH_PUBLIC_KEY=${SSH_PUBLIC_KEY:-} PYOPTIMIZE_TINYIPA=${PYOPTIMIZE_TINYIPA:-true} TINYIPA_REQUIRE_BIOSDEVNAME=${TINYIPA_REQUIRE_BIOSDEVNAME:-false} +TINYIPA_REQUIRE_IPMITOOL=${TINYIPA_REQUIRE_IPMITOOL:-true} TC=1001 STAFF=50 @@ -90,6 +91,9 @@ cp $WORKDIR/build_files/qemu-utils.* $FINALDIR/tmp/builtin/optional if $TINYIPA_REQUIRE_BIOSDEVNAME; then cp $WORKDIR/build_files/biosdevname.* $FINALDIR/tmp/builtin/optional fi +if $TINYIPA_REQUIRE_IPMITOOL; then + cp $WORKDIR/build_files/ipmitool.* $FINALDIR/tmp/builtin/optional +fi # Mount /proc for chroot commands sudo mount --bind /proc $FINALDIR/proc @@ -130,6 +134,9 @@ $TC_CHROOT_CMD tce-load -ic /tmp/builtin/optional/qemu-utils.tcz if $TINYIPA_REQUIRE_BIOSDEVNAME; then $TC_CHROOT_CMD tce-load -ic /tmp/builtin/optional/biosdevname.tcz fi +if $TINYIPA_REQUIRE_IPMITOOL; then + $TC_CHROOT_CMD tce-load -ic /tmp/builtin/optional/ipmitool.tcz +fi # Ensure tinyipa picks up installed kernel modules $CHROOT_CMD depmod -a `$WORKDIR/build_files/fakeuname -r`