From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v1 3/9] board/intel/common: Add possibility for adding ACPI tables to the initrd
Date: Thu, 25 Aug 2016 23:43:48 +0200 [thread overview]
Message-ID: <20160825234348.643e106e@free-electrons.com> (raw)
In-Reply-To: <1472133887-34746-4-git-send-email-andriy.shevchenko@linux.intel.com>
Hello,
On Thu, 25 Aug 2016 17:04:41 +0300, Andy Shevchenko wrote:
> in order to take advantage of these.
>
> +BOARD_INTEL_ACPI_TABLES
> + list of table names to built into the ``initrd``.
Please make this a Buildroot configuration option.
> +# Pick iASL.
> +# First try from buildroot and if not there then try from the host.
> +[ -x "$HOST_DIR/usr/bin/iasl" ] && iasl="$HOST_DIR/usr/bin/iasl" || iasl=$(which iasl)
> +
> +[ -x "$iasl" ] || {
> + echo "You need to to have iASL compiler available. You can either enable"
> + echo "BR2_PACKAGE_HOST_ACPICA or install it locally for your host."
> + echo "Typically the package is called acpica-tools in major distros".
> + exit 1
> +}
> +
> +# The name of the folder is the name of a board
> +board_name="${BOARD_DIR##*/}"
> +[ "$board_name" = "common" ] && {
> + echo "Adding ACPI tables is always specific to a board!"
> + echo "You are not supposed to use common as board here!"
> + exit 1
> +}
> +
> +# Always prefix with the board name to avoid mistakes if the initrd is used
> +# with another board.
> +updated_initrd_name="${board_name}-acpi-rootfs.cpio"
> +updated_initrd="$BINARIES_DIR/$updated_initrd_name"
> +initrd="$(readlink -enq "$BINARIES_DIR/initrd")"
> +tmpamldir="$BINARIES_DIR/acpi-tables"
> +
> +# Make sure existing tables get cleared
> +rm -fr $tmpamldir
> +mkdir -p $tmpamldir/kernel/firmware/acpi
> +
> +for table in $ACPI_TABLES; do
> + [ -f "$ACPI_DIR/$table" ] || continue
> +
> + $iasl -p $tmpamldir/kernel/firmware/acpi/$table "$ACPI_DIR/$table" > /dev/null 2>&1
> +
> + echo "ACPI: Compiled ASL from $(realpath --relative-to=$PWD $ACPI_DIR/$table)"
> +done
> +
> +# Exit if no tables were compiled
> +[ -n "$(find $tmpamldir -type f)" ] || {
> + echo "ACPI: No tables were compiled"
> + exit 0
> +}
> +
> +# Attach compiled tables to initrd
> +(
> + cd $tmpamldir
> + find kernel | cpio -H newc -o > $updated_initrd 2>/dev/null
> + cat $initrd >> $updated_initrd
> + ln -sf "$updated_initrd_name" "$BINARIES_DIR/initrd"
> +)
> +
> +echo "ACPI: Created initrd with updated ACPI tables in $(realpath --relative-to=$PWD $updated_initrd)"
And move all of this logic into Buildroot make code. I'm not sure yet
exactly where it fits. Maybe as an option of the host-acpica package ?
As an option in the "System configuration" menu ? Or, maybe better,
since those updated ACPI tables are consumed by the kernel, as a kernel
option ?
But clearly, something like that shouldn't be done in a post-image or
post-build script.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-08-25 21:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 14:04 [Buildroot] [PATCH v1 0/9] board: introduce common infrastructure for Intel SoCs Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 1/9] package/acpica: Add host configuration to the tool Andy Shevchenko
2016-08-25 21:44 ` Thomas Petazzoni
2016-08-26 10:50 ` Erico Nunes
2016-08-25 14:04 ` [Buildroot] [PATCH v1 2/9] board/intel/common: Add common files for x86 boards Andy Shevchenko
2016-08-25 21:37 ` Thomas Petazzoni
2016-08-26 16:42 ` Arnout Vandecappelle
2016-08-25 14:04 ` [Buildroot] [PATCH v1 3/9] board/intel/common: Add possibility for adding ACPI tables to the initrd Andy Shevchenko
2016-08-25 21:43 ` Thomas Petazzoni [this message]
2016-08-26 6:13 ` Arnout Vandecappelle
2016-08-26 8:39 ` Thomas Petazzoni
[not found] ` <20160826090454.GK1812@lahna.fi.intel.com>
2016-08-26 9:30 ` Thomas Petazzoni
[not found] ` <20160826093901.GO1812@lahna.fi.intel.com>
2016-08-26 13:28 ` Thomas Petazzoni
2016-08-26 16:30 ` Arnout Vandecappelle
[not found] ` <20160829065522.GV1812@lahna.fi.intel.com>
2016-08-29 7:45 ` Arnout Vandecappelle
[not found] ` <20160829075810.GA1709@lahna.fi.intel.com>
2016-08-29 9:08 ` Arnout Vandecappelle
2016-08-25 14:04 ` [Buildroot] [PATCH v1 4/9] board / intel: Add SPI peripherals for Minnowboard MAX Andy Shevchenko
2016-08-25 21:47 ` Thomas Petazzoni
[not found] ` <20160826090917.GL1812@lahna.fi.intel.com>
2016-08-26 9:26 ` Thomas Petazzoni
2016-08-25 14:04 ` [Buildroot] [PATCH v1 5/9] board / intel: Add SPI peripherals for Joule Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 6/9] board / intel: Add Aosong AM2315 sensor for Intel Joule Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 7/9] board / intel: Add GPIO LEDs " Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 8/9] board / intel: Add GPIO LEDs for Intel Minnowboard Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 9/9] board / intel: Add GPIO buttons " Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160825234348.643e106e@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox