linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND] Implement ACPI table overriding via initramfs
@ 2013-09-27 18:10 Thomas Renninger
  2013-09-27 18:10 ` [PATCH 1/4] dracut: Generlize microcode early cpio usage Thomas Renninger
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Thomas Renninger @ 2013-09-27 18:10 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA

Modification to the first series:
  - Add
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  - Add ACPI table override documentation

Would be great if these can get pushed in.

Thanks,

      Thomas

[PATCH 1/4] dracut: Generlize microcode early cpio usage
[PATCH 2/4] dracut: Do not create early_cpio if no suitable
[PATCH 3/4] dracut: Implement ACPI table overriding
[PATCH 4/4] dracut.conf.5.asc: Add ACPI table override and

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] dracut: Generlize microcode early cpio usage
  2013-09-27 18:10 [RESEND] Implement ACPI table overriding via initramfs Thomas Renninger
@ 2013-09-27 18:10 ` Thomas Renninger
  2013-09-27 18:10 ` [PATCH 2/4] dracut: Do not create early_cpio if no suitable microcode exist in hostonly case Thomas Renninger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Renninger @ 2013-09-27 18:10 UTC (permalink / raw)
  To: harald; +Cc: initramfs, linux-acpi, konrad.wilk, Thomas Renninger

ACPI early table override also may need to place files into an early cpio.
Reflect this in variable and file names.
This change is renaming only and does not introduce any real change.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 dracut.sh |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index 0c42958..0383c7e 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -696,9 +696,9 @@ readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
 }
 
 if [[ $early_microcode = yes ]]; then
-    readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)"
-    [ -d "$microcode_dir" ] || {
-        printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2
+    readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
+    [ -d "$early_cpio_dir" ] || {
+        printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_cpio.XXXXXX failed." >&2
         exit 1
     }
 fi
@@ -707,7 +707,7 @@ trap '
     ret=$?;
     [[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
     [[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
-    [[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; };
+    [[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
     [[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
     exit $ret;
     ' EXIT
@@ -1279,7 +1279,7 @@ if [[ $early_microcode = yes ]]; then
     dinfo "*** Generating early-microcode cpio image ***"
     ucode_dir=(amd-ucode intel-ucode)
     ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
-    _dest_dir="$microcode_dir/d/kernel/x86/microcode"
+    _dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
     _dest_idx="0 1"
     mkdir -p $_dest_dir
     if [[ $hostonly ]]; then
@@ -1299,14 +1299,15 @@ if [[ $early_microcode = yes ]]; then
             fi
         done
     done
-    (cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio)
+    create_early_cpio="yes"
 fi
 
 rm -f -- "$outfile"
 dinfo "*** Creating image file ***"
-if [[ $early_microcode = yes ]]; then
+if [[ $create_early_cpio = yes ]]; then
     # The microcode blob is _before_ the initramfs blob, not after
-    mv $microcode_dir/ucode.cpio $outfile.$$
+    (cd "$early_cpio_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../early.cpio)
+    mv $early_cpio_dir/early.cpio $outfile.$$
 fi
 if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
     $compress >> "$outfile.$$"; ); then
-- 
1.7.6.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] dracut: Do not create early_cpio if no suitable microcode exist in hostonly case
  2013-09-27 18:10 [RESEND] Implement ACPI table overriding via initramfs Thomas Renninger
  2013-09-27 18:10 ` [PATCH 1/4] dracut: Generlize microcode early cpio usage Thomas Renninger
@ 2013-09-27 18:10 ` Thomas Renninger
  2013-09-27 18:10 ` [PATCH 3/4] dracut: Implement ACPI table overriding Thomas Renninger
       [not found] ` <1380305440-63843-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org>
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Renninger @ 2013-09-27 18:10 UTC (permalink / raw)
  To: harald; +Cc: initramfs, linux-acpi, konrad.wilk, Thomas Renninger

Intel microcodes only exist for very specific family/model/stepping CPUs.
If no microcode gets added, there is no need to create an empty
(only directories) cpio later that gets glued to the initrd.

This also fixes:

*** Constructing GenuineIntel.bin ****
cat: /lib/firmware/intel-ucode/06-3c-03: No such file or directory

in hostonly mode if there is no suitable microcode for the CPU.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 dracut.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index 0383c7e..618c301 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1294,12 +1294,15 @@ if [[ $early_microcode = yes ]]; then
                 dinfo "*** Constructing ${ucode_dest[$idx]} ****"
                 if [[ $hostonly ]]; then
                     _src=$(get_ucode_file)
+                    if ! [[ -r $_fwdir/$_fw/$_src ]];then
+                        break;
+                    fi
                 fi
                 cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
+                create_early_cpio="yes"
             fi
         done
     done
-    create_early_cpio="yes"
 fi
 
 rm -f -- "$outfile"
-- 
1.7.6.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] dracut: Implement ACPI table overriding
  2013-09-27 18:10 [RESEND] Implement ACPI table overriding via initramfs Thomas Renninger
  2013-09-27 18:10 ` [PATCH 1/4] dracut: Generlize microcode early cpio usage Thomas Renninger
  2013-09-27 18:10 ` [PATCH 2/4] dracut: Do not create early_cpio if no suitable microcode exist in hostonly case Thomas Renninger
@ 2013-09-27 18:10 ` Thomas Renninger
       [not found] ` <1380305440-63843-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org>
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Renninger @ 2013-09-27 18:10 UTC (permalink / raw)
  To: harald; +Cc: initramfs, linux-acpi, konrad.wilk, Thomas Renninger

An example config file for this feature could be:

/etc/dracut.conf.d/03-acpi-override.conf

with this content:
acpi_override="yes"
acpi_table_dir="/etc/dracut.conf.d/acpi_tables"

Then all files ending with *.aml will be put into the early cpio
(kernel/firmware/acpi) and will be used to replace the BIOS provided tables
if the kernel supports this feature.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
 dracut.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index 618c301..b94224d 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1305,6 +1305,17 @@ if [[ $early_microcode = yes ]]; then
     done
 fi
 
+if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
+    dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
+    _dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
+    mkdir -p $_dest_dir
+    for table in $acpi_table_dir/*.aml; do
+        dinfo "   Adding ACPI table: $table"
+        cp $table $_dest_dir
+        create_early_cpio="yes"
+    done
+fi
+
 rm -f -- "$outfile"
 dinfo "*** Creating image file ***"
 if [[ $create_early_cpio = yes ]]; then
-- 
1.7.6.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] dracut.conf.5.asc: Add ACPI table override and uncompressed cpio doc
       [not found] ` <1380305440-63843-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org>
@ 2013-09-27 18:10   ` Thomas Renninger
  2013-10-02 10:56   ` [RESEND] Implement ACPI table overriding via initramfs Harald Hoyer
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Renninger @ 2013-09-27 18:10 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA, Thomas Renninger

Signed-off-by: Thomas Renninger <trenn-l3A5Bk7waGM@public.gmane.org>
---
 dracut.conf.5.asc |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
index a32516c..d471f4b 100644
--- a/dracut.conf.5.asc
+++ b/dracut.conf.5.asc
@@ -122,6 +122,21 @@ If chrooted to another root other than the real root device, use --fstab and pro
 *no_kernel=*"{yes|no}"::
     Do not install kernel drivers and firmware files (default=no)
 
+*acpi_override=*"{yes|no}"::
+    [WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
+    Override BIOS provided ACPI tables. For further documentation read
+    Documentation/acpi/initrd_table_override.txt in the kernel sources.
+    Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
+    directory (see below) and add them to a separate uncompressed cpio
+    archive. This cpio archive gets glued (concatenated, uncompressed one
+    must be the first one) to the compressed cpio archive. The first,
+    uncompressed cpio archive is for data which the kernel must be able
+    to access very early (and cannot make use of uncompress alogrithms yet)
+    like microcode or ACPI tables (default=no).
+
+*acpi_table_dir=*"__<dir>__"::
+    Directory to search for ACPI tables if acpi_override= is set to yes.
+
 *early_microcode=*"{yes|no}"::
     Combine early microcode with ramdisk (default=no)
 
-- 
1.7.6.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RESEND] Implement ACPI table overriding via initramfs
       [not found] ` <1380305440-63843-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org>
  2013-09-27 18:10   ` [PATCH 4/4] dracut.conf.5.asc: Add ACPI table override and uncompressed cpio doc Thomas Renninger
@ 2013-10-02 10:56   ` Harald Hoyer
  1 sibling, 0 replies; 6+ messages in thread
From: Harald Hoyer @ 2013-10-02 10:56 UTC (permalink / raw)
  To: Thomas Renninger
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA

On 09/27/2013 08:10 PM, Thomas Renninger wrote:
> Modification to the first series:
>   - Add
>     Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>   - Add ACPI table override documentation
> 
> Would be great if these can get pushed in.
> 
> Thanks,
> 
>       Thomas
> 
> [PATCH 1/4] dracut: Generlize microcode early cpio usage
> [PATCH 2/4] dracut: Do not create early_cpio if no suitable
> [PATCH 3/4] dracut: Implement ACPI table overriding
> [PATCH 4/4] dracut.conf.5.asc: Add ACPI table override and
> 

pushed

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-10-02 10:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-27 18:10 [RESEND] Implement ACPI table overriding via initramfs Thomas Renninger
2013-09-27 18:10 ` [PATCH 1/4] dracut: Generlize microcode early cpio usage Thomas Renninger
2013-09-27 18:10 ` [PATCH 2/4] dracut: Do not create early_cpio if no suitable microcode exist in hostonly case Thomas Renninger
2013-09-27 18:10 ` [PATCH 3/4] dracut: Implement ACPI table overriding Thomas Renninger
     [not found] ` <1380305440-63843-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org>
2013-09-27 18:10   ` [PATCH 4/4] dracut.conf.5.asc: Add ACPI table override and uncompressed cpio doc Thomas Renninger
2013-10-02 10:56   ` [RESEND] Implement ACPI table overriding via initramfs Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).