[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#712521: marked as done (initramfs-tools: please add early-initramfs support for ucode update)



Your message dated Tue, 18 Jun 2013 09:34:05 +0000
with message-id <E1UosIf-00037D-TK@franck.debian.org>
and subject line Bug#712521: fixed in initramfs-tools 0.113
has caused the Debian Bug report #712521,
regarding initramfs-tools: please add early-initramfs support for ucode update
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
712521: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712521
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: initramfs-tools
Version: 0.112+nmu1
Severity: wishlist
Tags: patch

Enclosed you will find two patches to add early-initramfs support to
initramfs-tools.

It adds, and properly documents, a hook function that allows packages
to _prepend_ data to the main initramfs archive.

It will be used by intel-microcode and amd64-microcode to supply an early
initramfs with microcode data for the kernel.  This is extremely important
to properly work around bugs that would otherwise force the kernel to
disable important functionality (such as the ones in the Atom that requires
disabling PME, which previously required a bios update or the use of Intel
BITS to work around.  We have several documented cases of Debian users that
cannot use either method).

Please review and comment.  If it is OK, please apply.
git tree for git merge available upon request.

-- no debconf information

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
>From 53852844059e8dac529618acfeffc285b32a3ee5 Mon Sep 17 00:00:00 2001
From: Henrique de Moraes Holschuh <hmh@debian.org>
Date: Fri, 31 May 2013 22:16:44 -0300
Subject: [PATCH 1/2] implement early initramfs support

Add a new hook function, prepend_earlyinitramfs(), which prepends
the content of the file passed as a parameter to the initramfs
that will be generated.

This will be used to pass system processor microcode and ACPI table
overrides to the kernel (requires Linux kernel v3.9 or later).

Signed-off-by: Henrique de Moraes Holschuh <hmh@debian.org>
---
 hook-functions    |   10 ++++++++++
 initramfs-tools.8 |   14 ++++++++++++++
 mkinitramfs       |   19 ++++++++++++++++---
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/hook-functions b/hook-functions
index 817d06c..e751021 100644
--- a/hook-functions
+++ b/hook-functions
@@ -10,6 +10,16 @@ catenate_cpiogz() {
 	cat "${1}" >>"${__TMPCPIOGZ}"
 }
 
+prepend_earlyinitramfs() {
+	# Sanity check
+	if [ ! -e "${1}" ]; then
+		echo "W: prepend_earlyinitramfs: arg1='${1}' does not exist." >&2
+		return
+	fi
+
+	cat "${1}" >>"${__TMPEARLYCPIO}"
+}
+
 # force_load module [args...]
 force_load()
 {
diff --git a/initramfs-tools.8 b/initramfs-tools.8
index 375e5c1..546bb01 100644
--- a/initramfs-tools.8
+++ b/initramfs-tools.8
@@ -240,6 +240,20 @@ and copy them to the initramfs. This means that most executables, unless
 compiled with klibc, will automatically include glibc in the image which will
 increase its size by several hundred kilobytes.
 
+.SS Including a system firmware preimage (early initramfs)
+If you need to prepend data to the initramfs image, you need to prepare it
+in a file, and call the \fB\fIprepend_earlyinitramfs\fR function.  The file
+can be disposed of as soon as the function returns.
+
+.B Example:
+.nf
+TEMP_FILE=$(mktemp ...)
+  ...
+prepend_earlyinitramfs ${TEMP_FILE}
+rm -f ${TEMP_FILE}
+
+.RE
+
 .SS Exported variables
 mkinitramfs sets several variables for the hook scripts environment.
 
diff --git a/mkinitramfs b/mkinitramfs
index d9a54e2..cdec420 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -175,6 +175,7 @@ if [ -n "$fs" ] && mount | grep -q "on $fs .*noexec" ; then
 fi
 
 __TMPCPIOGZ="$(mktemp ${TMPDIR:-/var/tmp}/mkinitramfs-OL_XXXXXX)" || exit 1
+__TMPEARLYCPIO="$(mktemp ${TMPDIR:-/var/tmp}/mkinitramfs-FW_XXXXXX)" || exit 1
 
 DPKG_ARCH=`dpkg --print-architecture`
 
@@ -193,6 +194,9 @@ export BUSYBOX
 # Private, used by 'catenate_cpiogz'.
 export __TMPCPIOGZ
 
+# Private, used by 'prepend_earlyinitramfs'.
+export __TMPEARLYCPIO
+
 for d in bin conf/conf.d etc lib/modules run sbin scripts ${MODULESDIR}; do
 	mkdir -p "${DESTDIR}/${d}"
 done
@@ -331,9 +335,17 @@ if [ "$DPKG_ARCH" = armhf ]; then
 fi
 
 [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs"
+
+if [ -s "${__TMPEARLYCPIO}" ]; then
+	cat "${__TMPEARLYCPIO}" >"${outfile}" || exit 1
+else
+	# truncate
+	> "${outfile}"
+fi
+
 (
 # work around lack of "set -o pipefail" for the following pipe:
-# cd "${DESTDIR}" && find . | cpio --quiet -R 0:0 -o -H newc | gzip >"${outfile}" || exit 1
+# cd "${DESTDIR}" && find . | cpio --quiet -R 0:0 -o -H newc | gzip >>"${outfile}" || exit 1
 exec 3>&1
 eval `
 	# http://cfaj.freeshell.org/shell/cus-faq-2.html
@@ -343,7 +355,7 @@ eval `
 		find . 4>&-; echo "ec1=$?;" >&4
 	} | {
 		cpio --quiet -R 0:0 -o -H newc 4>&-; echo "ec2=$?;" >&4
-	} | ${compress} >"${outfile}"
+	} | ${compress} >>"${outfile}"
 	echo "ec3=$?;" >&4
 `
 if [ "$ec1" -ne 0 ]; then
@@ -365,10 +377,11 @@ if [ -s "${__TMPCPIOGZ}" ]; then
 fi
 
 if [ "${keep}" = "y" ]; then
-	echo "Working files in ${DESTDIR} and overlay in ${__TMPCPIOGZ}"
+	echo "Working files in ${DESTDIR}, early initramfs in ${__TMPEARLYCPIO} and overlay in ${__TMPCPIOGZ}"
 else
 	rm -rf "${DESTDIR}"
 	rm -rf "${__TMPCPIOGZ}"
+	rm -rf "${__TMPEARLYCPIO}"
 fi
 
 exit 0
-- 
1.7.10.4

>From 810e64e2460978dc509930f64a4f2a3576a1a1b2 Mon Sep 17 00:00:00 2001
From: Henrique de Moraes Holschuh <hmh@debian.org>
Date: Sun, 2 Jun 2013 17:50:36 -0300
Subject: [PATCH 2/2] lsinitramfs(8): document failure to deal with early
 initramfs

lsinitramfs cannot deal with a multi-segmented initramfs archive, such
as one with an uncompressed early initramfs prepended to the main
compressed initramfs.  Document this in the manpage.

The kernel will parse all cpio archives it can find in the initramfs in
sequence, and it doesn't care if some of them are compressed and others
are not.

Signed-off-by: Henrique de Moraes Holschuh <hmh@debian.org>
---
 lsinitramfs.8 |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lsinitramfs.8 b/lsinitramfs.8
index b07ddeb..798aa8d 100644
--- a/lsinitramfs.8
+++ b/lsinitramfs.8
@@ -36,6 +36,13 @@ List content of two initramfs files in verbose mode:
 .PP
 .B lsinitramfs -l /boot/vmlinuz-2.6.31-grml64 /boot/vmlinuz-2.6.33-grml64
 
+.SH BUGS
+.BR lsinitramfs
+cannot deal with multiple-segmented initramfs images, such as those created
+when an early (uncompressed) initramfs with system firmware is prepended to
+the regular compressed initrams, or when overlay data is appended to the
+initramfs.
+
 .SH AUTHOR
 The initramfs-tools are written by Maximilian Attems <maks@debian.org>
 and numerous others.
-- 
1.7.10.4


--- End Message ---
--- Begin Message ---
Source: initramfs-tools
Source-Version: 0.113

We believe that the bug you reported is fixed in the latest version of
initramfs-tools, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 712521@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Prokop <mika@debian.org> (supplier of updated initramfs-tools package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Tue, 18 Jun 2013 09:32:58 +0200
Source: initramfs-tools
Binary: initramfs-tools
Architecture: source all
Version: 0.113
Distribution: unstable
Urgency: low
Maintainer: Debian kernel team <debian-kernel@lists.debian.org>
Changed-By: Michael Prokop <mika@debian.org>
Description: 
 initramfs-tools - generic modular initramfs generator
Closes: 712521
Changes: 
 initramfs-tools (0.113) unstable; urgency=low
 .
   [ Henrique de Moraes Holschuh ]
   * [f59e716] implement early initramfs support (Closes: #712521)
   * [b8295f0] lsinitramfs(8): document failure to deal with early
     initramfs
Checksums-Sha1: 
 214c4a260421833176c56b9a9ad711db5bf2c434 1089 initramfs-tools_0.113.dsc
 04a29aae09214ae5fa6114fe1bca7024a1e36680 86537 initramfs-tools_0.113.tar.gz
 824e238daecdc0bf73b1306ec6ff48b8f64c6216 92226 initramfs-tools_0.113_all.deb
Checksums-Sha256: 
 267a304f24aed84a5fff3f5dd4f7e7d3814239d4266ef14d2b6a342e15216d53 1089 initramfs-tools_0.113.dsc
 3b2bd52ee67fc3e4fb0c55f39c8d5de56d502592ed840c4bce9c8c9b3a053a40 86537 initramfs-tools_0.113.tar.gz
 ec836f465bb8f3a106fbf8c563f2138e9e0d69b09e4f0f011358c82c70c621f4 92226 initramfs-tools_0.113_all.deb
Files: 
 136d83495f114e871701dbdb6369036e 1089 utils optional initramfs-tools_0.113.dsc
 0a5be6db894523c2ed1cfa71258ee013 86537 utils optional initramfs-tools_0.113.tar.gz
 58071e843b4bb89493494117cfe2e14e 92226 utils optional initramfs-tools_0.113_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlHAJmIACgkQ2N9T+zficugnwACghUkL3L4qZl3u15g03sYVk4dp
IXcAn24EuFoJcc9GZx3+KvGWshzI/vJz
=8ffE
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: