File: initramfs.hook

package info (click to toggle)
amd64-microcode 1.20160316.1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 128 kB
  • sloc: sh: 98; makefile: 39
file content (53 lines) | stat: -rwxr-xr-x 1,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# amd64-microcode initramfs-tools hook script
# Copyright (C) 2012 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
# Released under the GPL v2 or later license
#
# Generates a copy of the minimal microcode for the current system if
# possible, and installs it in the initramfs.
#

PREREQ=""

prereqs()
{
   echo "$PREREQ"
}

case $1 in
prereqs)
   prereqs
   exit 0
   ;;
esac

. /usr/share/initramfs-tools/hook-functions

verbose()
{
	if [ "${verbose}" = "y" ] ; then
		echo "amd64-microcode: $@"
	fi
	:
}

AUCODE_FW_DIR=/lib/firmware/amd-ucode

if [ ! -d "${AUCODE_FW_DIR}" ] ; then
	verbose "no AMD64 processor microcode datafiles to install"
	exit 0;
fi

verbose "installing all microcode datafiles for AMD64 processors"

# Generate firmware dir
mkdir -m 755 -p "${DESTDIR}${AUCODE_FW_DIR}" || true
cp -fr "${AUCODE_FW_DIR}/." "${DESTDIR}${AUCODE_FW_DIR}/."

if ! rmdir "${DESTDIR}${AUCODE_FW_DIR}" 2>/dev/null ; then
	# The directory was not empty, so we have work to do
	verbose "installing AMD64 processor microcode update support into initramfs..."
	force_load microcode
fi

: