diff options
-rw-r--r-- | system/microcode_ctl/README | 4 | ||||
-rw-r--r-- | system/microcode_ctl/doinst.sh | 37 | ||||
-rw-r--r-- | system/microcode_ctl/microcode_ctl.SlackBuild | 86 | ||||
-rw-r--r-- | system/microcode_ctl/microcode_ctl.info | 8 | ||||
-rw-r--r-- | system/microcode_ctl/rc.microcode_ctl | 41 | ||||
-rw-r--r-- | system/microcode_ctl/slack-desc | 2 |
6 files changed, 122 insertions, 56 deletions
diff --git a/system/microcode_ctl/README b/system/microcode_ctl/README index 9f1bf92d33..75dfb01ced 100644 --- a/system/microcode_ctl/README +++ b/system/microcode_ctl/README @@ -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 diff --git a/system/microcode_ctl/doinst.sh b/system/microcode_ctl/doinst.sh index c78bd94e8b..ec0c991ed4 100644 --- a/system/microcode_ctl/doinst.sh +++ b/system/microcode_ctl/doinst.sh @@ -1,22 +1,27 @@ config() { + 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 +} + +preserve_perms() { 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 + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW fi - # Otherwise, we leave the .new copy for the admin to consider... + config $NEW } -# 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 etc/rc.d/rc.microcode_ctl.new diff --git a/system/microcode_ctl/microcode_ctl.SlackBuild b/system/microcode_ctl/microcode_ctl.SlackBuild index 644802a4b8..861f28e729 100644 --- a/system/microcode_ctl/microcode_ctl.SlackBuild +++ b/system/microcode_ctl/microcode_ctl.SlackBuild @@ -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 {} \; - -# use our CFLAGS -sed -i "s/-O2/$SLKCFLAGS/" Makefile - -# 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 + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -make \ - PREFIX=/usr \ - RCHOMEDIR=rc.d +# 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 -make \ - PREFIX=/usr \ - RCHOMEDIR=rc.d \ - DESTDIR=$PKG \ - install +# 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 -# 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} diff --git a/system/microcode_ctl/microcode_ctl.info b/system/microcode_ctl/microcode_ctl.info index f4eae547b5..ca4d0a5cb5 100644 --- a/system/microcode_ctl/microcode_ctl.info +++ b/system/microcode_ctl/microcode_ctl.info @@ -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="" diff --git a/system/microcode_ctl/rc.microcode_ctl b/system/microcode_ctl/rc.microcode_ctl new file mode 100644 index 0000000000..b62e7c6a5e --- /dev/null +++ b/system/microcode_ctl/rc.microcode_ctl @@ -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 diff --git a/system/microcode_ctl/slack-desc b/system/microcode_ctl/slack-desc index fa93ba1c93..bf3fc12baf 100644 --- a/system/microcode_ctl/slack-desc +++ b/system/microcode_ctl/slack-desc @@ -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/ |