Print this page
12817 ucode/update.intel should be able to use git repos
12815 ucode/update.intel needs pkgfmt fix

Split Close
Expand all
Collapse all
          --- old/usr/src/data/ucode/update.intel
          +++ new/usr/src/data/ucode/update.intel
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3  # This file and its contents are supplied under the terms of the
   4    4  # Common Development and Distribution License ("CDDL"), version 1.0.
   5    5  # You may only use this file in accordance with the terms of version
   6    6  # 1.0 of the CDDL.
   7    7  #
   8    8  # A full copy of the text of the CDDL should have accompanied this
   9    9  # source. A copy of the CDDL is also available via the Internet at
  10   10  # http://www.illumos.org/license/CDDL.
  11   11  
  12   12  # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
  13      -# Copyright 2019 Joyent, Inc.
       13 +# Copyright 2020 Joyent, Inc.
  14   14  
  15   15  # A simple update script that extracts an Intel microcode download file
  16   16  # into the intel/ directory, and updates the hardlinks in the
  17   17  # system/kernel/platform manifest.
  18   18  
  19   19  set -e
  20   20  set -o pipefail
  21   21  
  22      -[[ -z "$1" ]] || [[ ! -f "$1" ]] && {
  23      -        echo "Syntax: $0 <path to microcode tar>" >&2
  24      -        exit 1
  25      -}
       22 +# Remove this once we start using pkgfmt without it in the rest of -gate.
       23 +export PKGFMT_OUTPUT=v1
  26   24  
  27      -ucodetar="$1"
       25 +# Change me if the world evolves, but for now, this is the source of
       26 +# truth for Intel microcode.
       27 +REPOSOURCE="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files"
  28   28  
       29 +tmp=$(mktemp -d)
       30 +mkdir $tmp/out
  29   31  mf=../../pkg/manifests/system-microcode-intel.mf
  30   32  [[ -f $mf ]] || {
  31   33          echo "Run from usr/src/data/ucode" 2>&1
  32   34          exit 1
  33   35  }
  34   36  
  35   37  fw=platform/i86pc/ucode/GenuineIntel
  36   38  
  37      -tmp=$(mktemp -d)
  38      -mkdir $tmp/out
       39 +if [[ -z "$1" ]]; then
       40 +        goback=`pwd`
       41 +        cd $tmp
       42 +        # Hope git is available if we need it...
       43 +        git clone $REPOSOURCE || {
       44 +                echo "Git clone of $REPOSOURCE failed." 2>&1
       45 +                exit 1
       46 +        }
       47 +        cd $goback
       48 +        # Change with REPOSOURCE name
       49 +        dir=$tmp/Intel-Linux-Processor-Microcode-Data-Files
       50 +elif [[ -d "$1" ]]; then
       51 +        dir=$1
       52 +else
       53 +        gtar -C $tmp -xvf "$1"
       54 +        # This will expand properly if the tarball appends a release
       55 +        # to the name.
       56 +        dir=$tmp/Intel-Linux-Processor-Microcode-Data-Files*
       57 +fi
  39   58  
  40      -gtar -C $tmp -xvf "$ucodetar"
  41      -
  42      -find $tmp/Intel-Linux-Processor-Microcode-Data*/intel-ucode*/ -type f \
       59 +find $dir/intel-ucode*/ -type f \
  43   60      | while read f; do
  44   61          echo "Converting $(basename $f)"
  45   62          cp $f $tmp/intel-fw
  46   63          ucodeadm -i -R $tmp/out $tmp/intel-fw
  47   64          rm -f $tmp/intel-fw
  48   65  done
  49   66  
  50   67  pkgfmt -u $mf
  51   68  mv $mf $mf.tmp
  52   69  egrep -v "(file|hardlink) path=$fw" $mf.tmp > $mf
  53   70  rm -f $mf.tmp
  54   71  
  55   72  rm -f intel/*
  56   73  
  57      -cp $tmp/Intel-Linux-Processor-Microcode-Data*/license intel/THIRDPARTYLICENSE
       74 +cp $dir/license intel/THIRDPARTYLICENSE
  58   75  echo Intel Processor Microcode Data Files > intel/THIRDPARTYLICENSE.descrip
  59   76  
  60   77  rm -f Makefile.links
  61   78  
  62   79  typeset -A seen
  63   80  typeset -A inodes
  64   81  typeset -A links
  65   82  
  66   83  for f in $tmp/out/*; do
  67   84          bf=$(basename $f)
↓ open down ↓ 38 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX