From 7a24ba85a9b3204485245030ff92f787a2e87a4e Mon Sep 17 00:00:00 2001 From: Sam Betts <sam@code-smash.net> Date: Fri, 18 Mar 2016 17:34:35 +0000 Subject: [PATCH] Fix tinyipa build uname, picking up hosts kernel During the tinyipa build process we use the tinyipa package manager, tce-load. When tce-load trys to look for packages that are kernel specfic it uses uname to calculate the kernel version, and because we're building in a chroot it detects the hosts kernel version instead of the kernel version we are actually going to be using for the final tinyipa image, this causes it to fail to find certain packages. This patch injects a fake uname script into the tinyipa build and finalise environments to simulate running under the correct kernel version. Change-Id: I2b483806cbb1786763e32f3ccb7f88a6deeee3d1 --- imagebuild/tinyipa/build-tinyipa.sh | 5 +- imagebuild/tinyipa/build_files/fakeuname | 104 +++++++++++++++++++ imagebuild/tinyipa/build_files/finalreqs.lst | 1 + imagebuild/tinyipa/finalise-tinyipa.sh | 5 +- 4 files changed, 113 insertions(+), 2 deletions(-) create mode 100755 imagebuild/tinyipa/build_files/fakeuname diff --git a/imagebuild/tinyipa/build-tinyipa.sh b/imagebuild/tinyipa/build-tinyipa.sh index ebbf9a5fa..6bd04e43b 100755 --- a/imagebuild/tinyipa/build-tinyipa.sh +++ b/imagebuild/tinyipa/build-tinyipa.sh @@ -5,7 +5,7 @@ WORKDIR=$(readlink -f $0 | xargs dirname) BUILDDIR="$WORKDIR/tinyipabuild" BUILD_AND_INSTALL_TINYIPA=${BUILD_AND_INSTALL_TINYIPA:-false} -CHROOT_PATH="/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin" +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" TC=1001 @@ -62,6 +62,9 @@ $CHROOT_CMD chmod a+rwx /etc/sysconfig/tcedir $CHROOT_CMD touch /etc/sysconfig/tcuser $CHROOT_CMD chmod a+rwx /etc/sysconfig/tcuser +mkdir $BUILDDIR/tmp/overides +cp $WORKDIR/build_files/fakeuname $BUILDDIR/tmp/overides/uname + while read line; do sudo chroot --userspec=$TC:$STAFF $BUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy tce-load -wci $line done < $WORKDIR/build_files/buildreqs.lst diff --git a/imagebuild/tinyipa/build_files/fakeuname b/imagebuild/tinyipa/build_files/fakeuname new file mode 100755 index 000000000..a6e31fdd0 --- /dev/null +++ b/imagebuild/tinyipa/build_files/fakeuname @@ -0,0 +1,104 @@ +#!/bin/sh +S="Linux" +N="box" +R="3.16.6-tinycore64" +P="unknown" +V="#777 SMP (2016-02-29)" +M="x86_64" +I="unknown" +O="GNU/Linux" + +OPT_A=false +OPT_S=false +OPT_N=false +OPT_R=false +OPT_P=false +OPT_V=false +OPT_M=false +OPT_I=false +OPT_O=false + +if [ -z "$1" ]; then + echo "-ASNRPVMIO" + exit 1 +fi + +while :; do + case $1 in + -a) + OPT_A=true + shift + ;; + -s) + OPT_S=true + shift + ;; + -n) + OPT_N=true + shift + ;; + -r) + OPT_R=true + shift + ;; + -p) + OPT_P=true + shift + ;; + -v) + OPT_V=true + shift + ;; + -m) + OPT_M=true + shift + ;; + -i) + OPT_I=true + shift + ;; + -o) + OPT_O=true + shift + ;; + *) + if [ ! -z "$1" ]; then + echo "uname -asnrpvmio" + exit 1 + fi + break + ;; + esac +done + +if $OPT_A; then + echo "$S $N $R $V $M $O" + exit 0 +fi + +string='' +if $OPT_S; then + string="$string $S" +fi +if $OPT_N; then + string="$string $N" +fi +if $OPT_R; then + string="$string $R" +fi +if $OPT_P; then + string="$string $P" +fi +if $OPT_V; then + string="$string $V" +fi +if $OPT_M; then + string="$string $M" +fi +if $OPT_I; then + string="$string $I" +fi +if $OPT_O; then + string="$string $O" +fi +echo $string diff --git a/imagebuild/tinyipa/build_files/finalreqs.lst b/imagebuild/tinyipa/build_files/finalreqs.lst index 20aec0002..e9356cb70 100644 --- a/imagebuild/tinyipa/build_files/finalreqs.lst +++ b/imagebuild/tinyipa/build_files/finalreqs.lst @@ -10,3 +10,4 @@ scsi-3.16.6-tinycore64.tcz udev-lib.tcz util-linux.tcz glib2.tcz +iproute2.tcz diff --git a/imagebuild/tinyipa/finalise-tinyipa.sh b/imagebuild/tinyipa/finalise-tinyipa.sh index 5958b78f0..d789d191e 100755 --- a/imagebuild/tinyipa/finalise-tinyipa.sh +++ b/imagebuild/tinyipa/finalise-tinyipa.sh @@ -9,7 +9,7 @@ BUILD_AND_INSTALL_TINYIPA=${BUILD_AND_INSTALL_TINYIPA:-false} TC=1001 STAFF=50 -CHROOT_PATH="/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin" +CHROOT_PATH="/tmp/overides:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin" CHROOT_CMD="sudo chroot $FINALDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy" TC_CHROOT_CMD="sudo chroot --userspec=$TC:$STAFF $FINALDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy" @@ -55,6 +55,9 @@ cp $WORKDIR/build_files/qemu-utils.* $FINALDIR/tmp/builtin/optional # Mount /proc for chroot commands sudo mount --bind /proc $FINALDIR/proc +mkdir $FINALDIR/tmp/overides +cp $WORKDIR/build_files/fakeuname $FINALDIR/tmp/overides/uname + while read line; do $TC_CHROOT_CMD tce-load -wi $line done < $WORKDIR/build_files/finalreqs.lst