system/microcode_ctl: Updated for version 1.26.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Andrzej Telszewski 2014-07-22 05:58:22 +07:00 committed by Willy Sudiarto Raharjo
parent 256a0c56a0
commit cfc82f0a12
6 changed files with 124 additions and 58 deletions

View file

@ -19,8 +19,8 @@ http://downloadcenter.intel.com/default.aspx and should be placed under
/lib/firmware/microcode.dat.
To have the microcode updated each time at boot, start the included
init script in rc.local:
init script from /etc/rc.d/rc.local:
if [ -e "/etc/rc.d/rc.microcode_ctl" ];
if [ -x /etc/rc.d/rc.microcode_ctl ]; then
/etc/rc.d/rc.microcode_ctl start
fi

View file

@ -1,22 +1,27 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
for infile in $1; do
NEW="$infile"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
done
}
# Keep same perms on rc.microcode_ctl.new:
if [ -e etc/rc.d/rc.microcode_ctl ]; then
cp -a etc/rc.d/rc.microcode_ctl etc/rc.d/rc.microcode_ctl.new.incoming
cat etc/rc.d/rc.microcode_ctl.new > etc/rc.d/rc.microcode_ctl.new.incoming
mv etc/rc.d/rc.microcode_ctl.new.incoming etc/rc.d/rc.microcode_ctl.new
fi
config etc/rc.d/rc.microcode_ctl.new
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.microcode_ctl.new

View file

@ -1,11 +1,30 @@
#!/bin/sh
# Slackware build script for microcode_ctl
# Author: Andrzej Telszewski <atelszewski@gmail.com>
# Copyright 2014 Andrzej Telszewski, Sabadell
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=microcode_ctl
VERSION=1.17
BUILD=${BUILD:-2}
VERSION=${VERSION:-1.26}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -21,55 +40,56 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# use our CFLAGS
sed -i "s/-O2/$SLKCFLAGS/" Makefile
# Build:
CC=${CC:-gcc}
echo "$CC $SLKCFLAGS -Wall microcode_ctl.c -o microcode_ctl"
$CC $SLKCFLAGS -Wall microcode_ctl.c -o microcode_ctl
strip --strip-unneeded microcode_ctl
# look for microcode.dat file in a more appropriate place
sed -i "s|/etc/|/lib/firmware/|" microcode_ctl.c
sed -i "s|/etc/microcode.dat|/lib/firmware/microcode.dat|" \
microcode_ctl.start
# Install:
install -D -m 0755 microcode_ctl $PKG/usr/sbin/microcode_ctl
install -D -m 0644 $CWD/rc.microcode_ctl $PKG/etc/rc.d/rc.microcode_ctl.new
make \
PREFIX=/usr \
RCHOMEDIR=rc.d
make \
PREFIX=/usr \
RCHOMEDIR=rc.d \
DESTDIR=$PKG \
install
# This is way outdated
rm -f $PKG/etc/microcode.dat
# move init-script into place
mv $PKG/etc/rc.d/microcode_ctl $PKG/etc/rc.d/rc.microcode_ctl.new
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
gzip -k -9 microcode_ctl.8
mkdir -p $PKG/usr/man/man8
cp -a microcode_ctl.8.gz $PKG/usr/man/man8
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp Changelog README $PKG/usr/doc/$PRGNAM-$VERSION
cp -a Changelog README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -1,8 +1,8 @@
PRGNAM="microcode_ctl"
VERSION="1.17"
HOMEPAGE="http://www.urbanmyth.org/microcode/"
DOWNLOAD="http://ponce.cc/slackware/sources/repo/microcode_ctl-1.17.tar.gz"
MD5SUM="98a7f06acef8459c8ef2a1b0fb86a99e"
VERSION="1.26"
HOMEPAGE="https://fedorahosted.org/microcode_ctl/"
DOWNLOAD="https://fedorahosted.org/released/microcode_ctl/microcode_ctl-1.26.tar.xz"
MD5SUM="b417b9cf75c3e7eb68a5c1d81299489f"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""

View file

@ -0,0 +1,41 @@
#!/bin/sh
# Start script for microcode_ctl
# Copyright 2014 Andrzej Telszewski, Sabadell
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
microcode_ctl_start() {
echo "Uploading microcode: /usr/sbin/microcode_ctl -uq"
if [ ! -c /dev/cpu/microcode ]; then
/sbin/modprobe microcode || return $?
fi
/usr/sbin/microcode_ctl -uq || return $?
}
case "$1" in
'start')
microcode_ctl_start
;;
*)
echo "usage: $0 start"
esac

View file

@ -15,5 +15,5 @@ microcode_ctl: - it decodes and sends new microcode to the kernel driver to be
microcode_ctl: uploaded to Intel IA32 processors
microcode_ctl: - it signals the kernel driver to release any buffers it may hold
microcode_ctl:
microcode_ctl: https://fedorahosted.org/microcode_ctl/
microcode_ctl:
microcode_ctl: http://www.urbanmyth.org/microcode/