[v4 PATCH 0/2] Update AArch64 filename convention
by Naresh Bhat
The patch does the following,
1. Add a logic to decide GRUB_IMAGE name in grub_git recipe.
2. According to UEFI Specification section "3.5.1.1 Removable Media Boot Behavior"
To generate a file name when none is present in the FilePath, the firmware must
append a default file name in the form \EFI\BOOT\BOOT{machine type short-name}.EFI
where machine type short-name defines a PE32+ image format architecture. Each file
only contains one UEFI image type, and a system may support booting from one or
more images types. Table 12 lists the UEFI image types.
Table 12 UEFI Image Types
Architecture | File Name Convention |PE Executable Machine Name*
....
......
AArch32 | BOOTARM.EFI | 0x01c2
AArch64 | BOOTAA64.EFI | 0xAA64
Note: * The PE Executable machine type is contained in the machine field of the COFF
file header as defined in the Microsoft Portable Executable and Common Object File Format
Specification, Revision 6.0
Media may support multiple architectures by simply having a
\EFI\BOOT\BOOT{machine type short-name}.EFI file of each possible machine type.
v1 Changes:
[1] https://lists.01.org/pipermail/luv/2016-May/001097.html
v2 Changes:
[1] https://lists.01.org/pipermail/luv/2016-May/001109.html
v3 Changes:
[1] https://lists.01.org/pipermail/luv/2016-May/001122.html
Signed-off-by: Naresh Bhat <naresh.bhat(a)linaro.org>
Naresh Bhat (2):
luv-efi: Update AArch64 filename convention
grub: Change the grub image name to bootaa64.efi
meta-luv/classes/luv-efi.bbclass | 6 +++---
meta-luv/recipes-bsp/grub/grub_git.bbappend | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
create mode 100644 meta-luv/recipes-bsp/grub/grub_git.bbappend
--
1.7.11.7
6 years, 1 month
[PATCH 0/2] kernel-efi-warnings: refactor and add more tests
by Ricardo Neri
Hi,
We use the kernel-efi-warnings tests to inspect the kernel message log and
report potential issues discovered by the firmware. For instance, we use
it to discover spurious access to the UEFI Boot Services memory regions
after UEFI ExitBootServices() call has been issued by Linux/bootloader.
This mini-series adds functionality to inspect the kernel message log to
look for the [Firmware Bug/Warn/Info] pattern. This is useful to report
specific potential issues of different degrees of severity as reported
by the kernel when, for instance, parsing ACPI tables.
This test suite simply examines the kernel message log for specific
messages. Thus, I have reworked the suite to utilize a function that
receives as argument the pattern that we are looking for.
Thanks and BR,
Ricardo
Ricardo Neri (2):
kernel-efi-warnings: use a function for pattern searching
kernel-efi-warnings: search dmesg for Firmware Bug/Warn/Info
.../kernel-efi-warnings/kernel-efi-warnings | 66 +++++++++++++++++++---
1 file changed, 58 insertions(+), 8 deletions(-)
--
2.8.1
6 years, 1 month
[PATCH 0/8] luv-test-manager: fix miscellaneous bugs
by Ricardo Neri
Hi,
I have been working on an improved test report in HTML format. While
working on it, I came across several bugs that needed to be fixed. This
series fixes the following problems:
1) Updates the usage comments in the LUV test manager.
2) The LUV test manager was ignoring the warnings issued by the test
suites. Now it counts and reports them.
3) Also, we were parsing the FWTS results incorrectly,
4) We were not reporting the warnings issued by chipsec. Functionality
was added for this. Also, we were missing the result of the
s3bootscript test as it uses an odd string to report status when
it can't be executed.
This is a preparatory series for my improved HTML test report. It will be
sent as a separate series.
Thanks and BR,
Ricardo
Ricardo Neri (7):
luv-test-parser: update schema description
luv-test-parser: correct description of tag data
luv-test-parser: add support to process warnings
luv-test-manager: count warnings issued by the luv test parser
ndctl: parser: use the 'warns' field to report errors
chipsec: parser: report errors and warnings correctly
chipsec: parser: report test cases that issue warnings
fwts: parser: correct emission of the RESULT tag
meta-luv/recipes-core/chipsec/chipsec/luv-parser-chipsec | 11 ++++++++++-
meta-luv/recipes-core/fwts/fwts/luv-parser-fwts | 4 ++--
.../recipes-core/initscripts/initscripts/luv-test-manager | 4 +++-
.../recipes-core/initscripts/initscripts/luv-test-parser | 13 +++++++++++--
meta-luv/recipes-core/ndctl/ndctl/luv-parser-ndctl | 2 +-
5 files changed, 27 insertions(+), 7 deletions(-)
--
2.8.1
6 years, 1 month
[PATCH] kernel: linux-yocto-efi-test: Add linux_quirks.cfg file to enable platform specific configuration options
by Sai Praneeth Prakhya
From: Sai Praneeth <sai.praneeth.prakhya(a)intel.com>
Linux kernel built with default configuration panics on X86 platforms
that has very high number of interrupts. This issue has been traced
back till Linux kernel v3.7. Following are the commit id and patch name
that introduced this issue in Linux kernel.
Commit id: 279f1461432ccdec0b98c0bcbe0a8e2c0f6fdda5
Patch: x86: apic: Use tsc deadline for oneshot when available
So, as a quick fix enable CONFIG_X86_X2APIC and CONFIG_IRQ_REMAP while
building the kernel. Adding linux_quirks.cfg file to add configurations
that might be specific to a platform. Also add this file in the build
process of LUV so that these configurations are enabled by default.
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya(a)intel.com>
Suggested-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
---
meta-luv/recipes-kernel/linux/linux-yocto-efi-test/linux_quirks.cfg | 3 +++
meta-luv/recipes-kernel/linux/linux-yocto-efi-test_4.5.bb | 2 ++
2 files changed, 5 insertions(+)
create mode 100644 meta-luv/recipes-kernel/linux/linux-yocto-efi-test/linux_quirks.cfg
diff --git a/meta-luv/recipes-kernel/linux/linux-yocto-efi-test/linux_quirks.cfg b/meta-luv/recipes-kernel/linux/linux-yocto-efi-test/linux_quirks.cfg
new file mode 100644
index 000000000000..7cc5d4da5121
--- /dev/null
+++ b/meta-luv/recipes-kernel/linux/linux-yocto-efi-test/linux_quirks.cfg
@@ -0,0 +1,3 @@
+# Enable configurations that are work arounds for some specific platforms
+CONFIG_X86_X2APIC=y
+CONFIG_IRQ_REMAP=y
diff --git a/meta-luv/recipes-kernel/linux/linux-yocto-efi-test_4.5.bb b/meta-luv/recipes-kernel/linux/linux-yocto-efi-test_4.5.bb
index b96d64307d92..c69a8200e232 100644
--- a/meta-luv/recipes-kernel/linux/linux-yocto-efi-test_4.5.bb
+++ b/meta-luv/recipes-kernel/linux/linux-yocto-efi-test_4.5.bb
@@ -77,6 +77,7 @@ SRC_URI_append_x86 = "file://defconfig \
file://ndctl.cfg \
file://network.cfg \
file://network-devices.cfg \
+ file://linux_quirks.cfg \
"
# Add the defconfig from v4.5 kernel and the configuration x86-64 fragments
@@ -90,6 +91,7 @@ SRC_URI_append_x86-64 = "file://defconfig \
file://ndctl.cfg \
file://network.cfg \
file://network-devices.cfg \
+ file://linux_quirks.cfg \
"
# Add the defconfig from v4.5 kernel and the configuration arm64 fragments
--
2.1.4
6 years, 1 month
[PATCH] grub: efidisk: respect block_io_protocol buffer alignment
by Ricardo Neri
This a backport of:
commit 51f375d688529b7c1819ba40188ee52b9333887c
Author: Leif Lindholm <leif.lindholm(a)linaro.org>
Date: Sat Feb 27 13:44:59 2016 +0100
efidisk: Respect block_io_protocol buffer alignment
from the grub development tree. Paraphrasing Leif's words, the
grub_efi_block_io_media contains the io_align field, which describes
the minimum alignment required for buffers used in data transfers
with device. Lief's approach is to create a temporary buffer for
the data transfers that meets the alignment requireements of the
device.
Recent updates to firmware implementations, including Tianocore,
enforce this alignment (i.e. EFI_INVALID_PARAMETER is returned on
unaligned buffers) as described in the section 12.9 of the UEFI
specification. There may be situations in which we may not be able
even to boot if the alignment of our read buffers do not meet the
requirements of the underlying disk drivers.
Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
---
...espect-block_io_protocol-buffer-alignment.patch | 135 +++++++++++++++++++++
meta-luv/recipes-bsp/grub/grub-efi_2.00.bbappend | 1 +
2 files changed, 136 insertions(+)
create mode 100644 meta-luv/recipes-bsp/grub/files/0015-efidisk-Respect-block_io_protocol-buffer-alignment.patch
diff --git a/meta-luv/recipes-bsp/grub/files/0015-efidisk-Respect-block_io_protocol-buffer-alignment.patch b/meta-luv/recipes-bsp/grub/files/0015-efidisk-Respect-block_io_protocol-buffer-alignment.patch
new file mode 100644
index 0000000..47f53ae
--- /dev/null
+++ b/meta-luv/recipes-bsp/grub/files/0015-efidisk-Respect-block_io_protocol-buffer-alignment.patch
@@ -0,0 +1,135 @@
+From 20bd730fe7184635f5cbd57a6f5af91421ce1754 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
+Date: Tue, 24 May 2016 08:33:58 -0700
+Subject: [PATCH] efidisk: Respect block_io_protocol buffer alignment
+
+This a backport of:
+
+commit 51f375d688529b7c1819ba40188ee52b9333887c
+Author: Leif Lindholm <leif.lindholm(a)linaro.org>
+Date: Sat Feb 27 13:44:59 2016 +0100
+
+ efidisk: Respect block_io_protocol buffer alignment
+
+from the grub development tree. Paraphrasing Leif's words, the
+grub_efi_block_io_media contains the io_align field, which describes
+the minimum alignment required for buffers used in data transfers
+with device. Lief's approach is to create a temporary buffer for
+the data transfers that meets the alignment requireements of the
+device.
+
+Recent updates to firmware implementations, including Tianocore,
+enforce this alignment (i.e. EFI_INVALID_PARAMETER is returned on
+unaligned buffers). Thus, it is necessary to backport this fix to
+our grub.
+
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
+---
+ grub-core/disk/efi/efidisk.c | 59 +++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 53 insertions(+), 6 deletions(-)
+
+diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
+index d9d788c..07f1eab 100644
+--- a/grub-core/disk/efi/efidisk.c
++++ b/grub-core/disk/efi/efidisk.c
+@@ -515,8 +515,15 @@ grub_efidisk_open (const char *name, struct grub_disk *disk)
+ m = d->block_io->media;
+ /* FIXME: Probably it is better to store the block size in the disk,
+ and total sectors should be replaced with total blocks. */
+- grub_dprintf ("efidisk", "m = %p, last block = %llx, block size = %x\n",
+- m, (unsigned long long) m->last_block, m->block_size);
++ grub_dprintf ("efidisk",
++ "m = %p, last block = %llx, block size = %x, io align = %x\n",
++ m, (unsigned long long) m->last_block, m->block_size,
++ m->io_align);
++
++ /* Ensure required buffer alignment is a power of two (or is zero). */
++ if (m->io_align & (m->io_align - 1))
++ return grub_error (GRUB_ERR_IO, "invalid buffer alignment %d", m->io_align);
++
+ disk->total_sectors = m->last_block + 1;
+ if (m->block_size & (m->block_size - 1) || !m->block_size)
+ return grub_error (GRUB_ERR_IO, "invalid sector size %d",
+@@ -546,6 +553,8 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
+ struct grub_efidisk_data *d;
+ grub_efi_block_io_t *bio;
+ grub_efi_status_t status;
++ grub_size_t io_align, num_bytes;
++ char *aligned_buf = 0;
+
+ d = disk->data;
+ bio = d->block_io;
+@@ -554,10 +563,30 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
+ "reading 0x%lx sectors at the sector 0x%llx from %s\n",
+ (unsigned long) size, (unsigned long long) sector, disk->name);
+
++ /* Set alignment to 1 if 0 specified */
++ io_align = bio->media->io_align ? bio->media->io_align : 1;
++ num_bytes = size << disk->log_sector_size;
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ {
++ aligned_buf = grub_memalign (io_align, num_bytes);
++ if (! aligned_buf)
++ return GRUB_ERR_OUT_OF_MEMORY;
++ }
++ else
++ aligned_buf = buf;
++
+ status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
+ (grub_efi_uint64_t) sector,
+- (grub_efi_uintn_t) size << disk->log_sector_size,
+- buf);
++ (grub_efi_uintn_t) num_bytes,
++ aligned_buf);
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ {
++ grub_memcpy (buf, aligned_buf, num_bytes);
++ grub_free (aligned_buf);
++ }
++
+ if (status != GRUB_EFI_SUCCESS)
+ return grub_error (GRUB_ERR_READ_ERROR,
+ N_("failure reading sector 0x%llx from `%s'"),
+@@ -575,6 +604,8 @@ grub_efidisk_write (struct grub_disk *disk, grub_disk_addr_t sector,
+ struct grub_efidisk_data *d;
+ grub_efi_block_io_t *bio;
+ grub_efi_status_t status;
++ grub_size_t io_align, num_bytes;
++ char *aligned_buf = 0;
+
+ d = disk->data;
+ bio = d->block_io;
+@@ -583,10 +614,26 @@ grub_efidisk_write (struct grub_disk *disk, grub_disk_addr_t sector,
+ "writing 0x%lx sectors at the sector 0x%llx to %s\n",
+ (unsigned long) size, (unsigned long long) sector, disk->name);
+
++ /* Set alignment to 1 if 0 specified */
++ io_align = bio->media->io_align ? bio->media->io_align : 1;
++ num_bytes = size << disk->log_sector_size;
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ {
++ aligned_buf = grub_memalign (io_align, num_bytes);
++ if (! aligned_buf)
++ return GRUB_ERR_OUT_OF_MEMORY;
++ grub_memcpy (aligned_buf, buf, num_bytes);
++ }
++
+ status = efi_call_5 (bio->write_blocks, bio, bio->media->media_id,
+ (grub_efi_uint64_t) sector,
+- (grub_efi_uintn_t) size << disk->log_sector_size,
+- (void *) buf);
++ (grub_efi_uintn_t) num_bytes,
++ aligned_buf ? aligned_buf : (void *)buf);
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ grub_free (aligned_buf);
++
+ if (status != GRUB_EFI_SUCCESS)
+ return grub_error (GRUB_ERR_WRITE_ERROR,
+ N_("failure writing sector 0x%llx to `%s'"),
+--
+2.8.1
+
diff --git a/meta-luv/recipes-bsp/grub/grub-efi_2.00.bbappend b/meta-luv/recipes-bsp/grub/grub-efi_2.00.bbappend
index 0f2c5c9..3cd43da 100644
--- a/meta-luv/recipes-bsp/grub/grub-efi_2.00.bbappend
+++ b/meta-luv/recipes-bsp/grub/grub-efi_2.00.bbappend
@@ -27,6 +27,7 @@ SRC_URI += "file://0001-pe32.h-add-header-structures-for-TE-and-DOS-executab.pat
file://0012-grub-core-loader-add-support-for-memdisks.patch \
file://0013-grub-core-loader-pass-current-disk-device-to-loaded-.patch \
file://0014-grub-util-set-prefix-to-EFI-BOOT-when-booting-f.patch \
+ file://0015-efidisk-Respect-block_io_protocol-buffer-alignment.patch \
"
GRUB_BUILDIN = "boot linux ext2 fat serial part_msdos part_gpt \
--
2.8.1
6 years, 1 month
[PATCH] luv-efi: Update AArch64 filename convention
by Naresh Bhat
The patch does the following,
1. Add a logic to decide GRUB_IMAGE name in grub_git recipe.
2. According to UEFI Specification section "3.5.1.1 Removable Media Boot Behavior"
To generate a file name when none is present in the FilePath, the firmware must
append a default file name in the form \EFI\BOOT\BOOT{machine type short-name}.EFI
where machine type short-name defines a PE32+ image format architecture. Each file
only contains one UEFI image type, and a system may support booting from one or
more images types. Table 12 lists the UEFI image types.
Table 12 UEFI Image Types
Architecture | File Name Convention |PE Executable Machine Name*
....
......
AArch32 | BOOTARM.EFI | 0x01c2
AArch64 | BOOTAA64.EFI | 0xAA64
Note: * The PE Executable machine type is contained in the machine field of the COFF
file header as defined in the Microsoft Portable Executable and Common Object File Format
Specification, Revision 6.0
Media may support multiple architectures by simply having a
\EFI\BOOT\BOOT{machine type short-name}.EFI file of each possible machine type.
v1 Changes:
[1] https://lists.01.org/pipermail/luv/2016-May/001097.html
v2 Changes:
[1] https://lists.01.org/pipermail/luv/2016-May/001109.html
Signed-off-by: Naresh Bhat <naresh.bhat(a)linaro.org>
---
meta-luv/classes/luv-efi.bbclass | 6 +++---
meta/classes/grub-efi.bbclass | 2 +-
meta/recipes-bsp/grub/grub_git.bb | 3 ++-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/meta-luv/classes/luv-efi.bbclass b/meta-luv/classes/luv-efi.bbclass
index 9a78462..47bc32d 100644
--- a/meta-luv/classes/luv-efi.bbclass
+++ b/meta-luv/classes/luv-efi.bbclass
@@ -48,8 +48,8 @@ efi_populate() {
# Install grub2 in EFI directory
if [ "${TARGET_ARCH}" = "aarch64" ]; then
- install -m 0644 ${DEPLOY_DIR_IMAGE}/grubaa64.efi ${DEST}${EFIDIR}
- echo "grubaa64.efi" > ${DEST}${EFIDIR}/startup.nsh
+ install -m 0644 ${DEPLOY_DIR_IMAGE}/bootaa64.efi ${DEST}${EFIDIR}
+ echo "bootaa64.efi" > ${DEST}${EFIDIR}/startup.nsh
# TODO: need conditional signing; e.g., if (DISTRO_FEATURES contains secure_boot)
# shim bootloader does not seem to work with i386. Thus we don't use it for 32-bit
@@ -129,7 +129,7 @@ efi_iso_populate() {
cp -r $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
if [ "${TARGET_ARCH}" = "aarch64" ] ; then
- echo "grubaa64.efi" > ${EFIIMGDIR}/startup.nsh
+ echo "bootaa64.efi" > ${EFIIMGDIR}/startup.nsh
cp $iso_dir/Image ${EFIIMGDIR}
fi
if echo "${TARGET_ARCH}" | grep -q "i.86" || [ "${TARGET_ARCH}" = "x86_64" ]; then
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index bbb3e65..05521f1 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -41,7 +41,7 @@ efi_populate() {
GRUB_IMAGE="bootx64.efi"
;;
aarch64 )
- GRUB_IMAGE="grubaa64.efi"
+ GRUB_IMAGE="bootaa64.efi"
;;
esac
diff --git a/meta/recipes-bsp/grub/grub_git.bb b/meta/recipes-bsp/grub/grub_git.bb
index 721c92d..3c4131f 100644
--- a/meta/recipes-bsp/grub/grub_git.bb
+++ b/meta/recipes-bsp/grub/grub_git.bb
@@ -28,6 +28,8 @@ GRUBPLATFORM_arm = "uboot"
GRUBPLATFORM_aarch64 = "efi"
GRUBPLATFORM ??= "pc"
+GRUB_IMAGE_aarch64 = "bootaa64.efi"
+
EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} --disable-grub-mkfont --program-prefix="" \
--enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no"
@@ -54,7 +56,6 @@ do_install_append_class-target() {
}
GRUB_TARGET_aarch64 = "arm64"
-GRUB_IMAGE_aarch64 = "grubaa64.efi"
do_mkimage_class-native() {
:
--
1.7.9.5
6 years, 1 month
[PATCH] bits: grub: efidisk: respect block_io_protocol buffer alignment
by Ricardo Neri
This a backport of:
commit 51f375d688529b7c1819ba40188ee52b9333887c
Author: Leif Lindholm <leif.lindholm(a)linaro.org>
Date: Sat Feb 27 13:44:59 2016 +0100
efidisk: Respect block_io_protocol buffer alignment
from the grub development tree. Paraphrasing Leif's words, the
grub_efi_block_io_media contains the io_align field, which describes
the minimum alignment required for buffers used in data transfers
with device. Lief's approach is to create a temporary buffer for
the data transfers that meets the alignment requireements of the
device.
Recent updates to firmware implementations, including Tianocore,
enforce this alignment (i.e. EFI_INVALID_PARAMETER is returned on
unaligned buffers) described in the section 12.9 of the UEFI
specification.
This is especially critical when it is not trivial to ensure the
alignment of the data buffer (e.g, we need to write data starting
at an offset of the buffer). Such, scenario occurs when writing
testing results. If the alignment is not correct, the following
issue is observed:
Traceback (most recent call last):
File "", line 1, in
File "/boot/python/init.py", line 246, in init
redirect.write_logfile_cpio("/boot/bitsrd", "home/root/bits-log.txt")
File "/boot/python/redirect.py", line 95, in write_logfile_cpio
_bits.disk_write(f, sector, offset,
logdata[bytes_written:bytes_written+leng
th])
IOError: [Errno 15] GRUB error 15
Further instrumentation of efidisk shows that the firmware issues
a EFI_INVALID_PARAMETER.
This is to fix https://github.com/01org/luv-yocto/issues/73.
Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
---
...espect-block_io_protocol-buffer-alignment.patch | 135 +++++++++++++++++++++
meta-luv/recipes-bsp/bits/bits_git.bb | 1 +
2 files changed, 136 insertions(+)
create mode 100644 meta-luv/recipes-bsp/bits/bits/GRUB-efidisk-Respect-block_io_protocol-buffer-alignment.patch
diff --git a/meta-luv/recipes-bsp/bits/bits/GRUB-efidisk-Respect-block_io_protocol-buffer-alignment.patch b/meta-luv/recipes-bsp/bits/bits/GRUB-efidisk-Respect-block_io_protocol-buffer-alignment.patch
new file mode 100644
index 0000000..bdcb2c3
--- /dev/null
+++ b/meta-luv/recipes-bsp/bits/bits/GRUB-efidisk-Respect-block_io_protocol-buffer-alignment.patch
@@ -0,0 +1,135 @@
+From 20bd730fe7184635f5cbd57a6f5af91421ce1754 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
+Date: Tue, 24 May 2016 08:33:58 -0700
+Subject: [PATCH] efidisk: Respect block_io_protocol buffer alignment
+
+This a backport of:
+
+commit 51f375d688529b7c1819ba40188ee52b9333887c
+Author: Leif Lindholm <leif.lindholm(a)linaro.org>
+Date: Sat Feb 27 13:44:59 2016 +0100
+
+ efidisk: Respect block_io_protocol buffer alignment
+
+from the grub development tree. Paraphrasing Leif's words, the
+grub_efi_block_io_media contains the io_align field, which describes
+the minimum alignment required for buffers used in data transfers
+with device. Lief's approach is to create a temporary buffer for
+the data transfers that meets the alignment requireements of the
+device.
+
+Recent updates to firmware implementations, including Tianocore,
+enforce this alignment (i.e. EFI_INVALID_PARAMETER is returned on
+unaligned buffers). Thus, it is necessary to backport this fix to
+our grub.
+
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
+---
+ grub-core/disk/efi/efidisk.c | 59 +++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 53 insertions(+), 6 deletions(-)
+
+diff --git a/deps/grub/grub-core/disk/efi/efidisk.c b/deps/grub/grub-core/disk/efi/efidisk.c
+index d9d788c..07f1eab 100644
+--- a/deps/grub/grub-core/disk/efi/efidisk.c
++++ b/deps/grub/grub-core/disk/efi/efidisk.c
+@@ -515,8 +515,15 @@ grub_efidisk_open (const char *name, struct grub_disk *disk)
+ m = d->block_io->media;
+ /* FIXME: Probably it is better to store the block size in the disk,
+ and total sectors should be replaced with total blocks. */
+- grub_dprintf ("efidisk", "m = %p, last block = %llx, block size = %x\n",
+- m, (unsigned long long) m->last_block, m->block_size);
++ grub_dprintf ("efidisk",
++ "m = %p, last block = %llx, block size = %x, io align = %x\n",
++ m, (unsigned long long) m->last_block, m->block_size,
++ m->io_align);
++
++ /* Ensure required buffer alignment is a power of two (or is zero). */
++ if (m->io_align & (m->io_align - 1))
++ return grub_error (GRUB_ERR_IO, "invalid buffer alignment %d", m->io_align);
++
+ disk->total_sectors = m->last_block + 1;
+ if (m->block_size & (m->block_size - 1) || !m->block_size)
+ return grub_error (GRUB_ERR_IO, "invalid sector size %d",
+@@ -546,6 +553,8 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
+ struct grub_efidisk_data *d;
+ grub_efi_block_io_t *bio;
+ grub_efi_status_t status;
++ grub_size_t io_align, num_bytes;
++ char *aligned_buf = 0;
+
+ d = disk->data;
+ bio = d->block_io;
+@@ -554,10 +563,30 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
+ "reading 0x%lx sectors at the sector 0x%llx from %s\n",
+ (unsigned long) size, (unsigned long long) sector, disk->name);
+
++ /* Set alignment to 1 if 0 specified */
++ io_align = bio->media->io_align ? bio->media->io_align : 1;
++ num_bytes = size << disk->log_sector_size;
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ {
++ aligned_buf = grub_memalign (io_align, num_bytes);
++ if (! aligned_buf)
++ return GRUB_ERR_OUT_OF_MEMORY;
++ }
++ else
++ aligned_buf = buf;
++
+ status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
+ (grub_efi_uint64_t) sector,
+- (grub_efi_uintn_t) size << disk->log_sector_size,
+- buf);
++ (grub_efi_uintn_t) num_bytes,
++ aligned_buf);
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ {
++ grub_memcpy (buf, aligned_buf, num_bytes);
++ grub_free (aligned_buf);
++ }
++
+ if (status != GRUB_EFI_SUCCESS)
+ return grub_error (GRUB_ERR_READ_ERROR,
+ N_("failure reading sector 0x%llx from `%s'"),
+@@ -575,6 +604,8 @@ grub_efidisk_write (struct grub_disk *disk, grub_disk_addr_t sector,
+ struct grub_efidisk_data *d;
+ grub_efi_block_io_t *bio;
+ grub_efi_status_t status;
++ grub_size_t io_align, num_bytes;
++ char *aligned_buf = 0;
+
+ d = disk->data;
+ bio = d->block_io;
+@@ -583,10 +614,26 @@ grub_efidisk_write (struct grub_disk *disk, grub_disk_addr_t sector,
+ "writing 0x%lx sectors at the sector 0x%llx to %s\n",
+ (unsigned long) size, (unsigned long long) sector, disk->name);
+
++ /* Set alignment to 1 if 0 specified */
++ io_align = bio->media->io_align ? bio->media->io_align : 1;
++ num_bytes = size << disk->log_sector_size;
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ {
++ aligned_buf = grub_memalign (io_align, num_bytes);
++ if (! aligned_buf)
++ return GRUB_ERR_OUT_OF_MEMORY;
++ grub_memcpy (aligned_buf, buf, num_bytes);
++ }
++
+ status = efi_call_5 (bio->write_blocks, bio, bio->media->media_id,
+ (grub_efi_uint64_t) sector,
+- (grub_efi_uintn_t) size << disk->log_sector_size,
+- (void *) buf);
++ (grub_efi_uintn_t) num_bytes,
++ aligned_buf ? aligned_buf : (void *)buf);
++
++ if ((grub_addr_t) buf & (io_align - 1))
++ grub_free (aligned_buf);
++
+ if (status != GRUB_EFI_SUCCESS)
+ return grub_error (GRUB_ERR_WRITE_ERROR,
+ N_("failure writing sector 0x%llx to `%s'"),
+--
+2.8.1
+
diff --git a/meta-luv/recipes-bsp/bits/bits_git.bb b/meta-luv/recipes-bsp/bits/bits_git.bb
index 96acddd..a12cfb7 100644
--- a/meta-luv/recipes-bsp/bits/bits_git.bb
+++ b/meta-luv/recipes-bsp/bits/bits_git.bb
@@ -41,6 +41,7 @@ SRC_URI = "gitsm://github.com/biosbits/bits.git;protocol=http \
file://BITS-save-log-to-a-cpio-archive.patch \
file://GRUB-core-handle-loader-options.patch \
file://BITS-GRUB-prepare-to-use-a-memdisk.patch \
+ file://GRUB-efidisk-Respect-block_io_protocol-buffer-alignment.patch \
file://luv-test-bits \
file://luv-parser-bits \
file://0001-only-output-to-log.patch;apply=no \
--
2.8.1
6 years, 1 month
[PATCH] ndctl: back-port implementation of optional documentation
by Ricardo Neri
We are using ndctl v50. However, this version does not feature conditional
builds of the documentation. Thus, backport the patch by Dan Williams
that implements such feature. This patch can be dropped once we move
to a more recent version of ndctl.
Cc: Megha Dey <megha.dey(a)intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
---
...dctl-add-disable-docs-option-to-configure.patch | 50 ++++++++++++++++++++++
meta-luv/recipes-core/ndctl/ndctl_git.bb | 1 +
2 files changed, 51 insertions(+)
create mode 100644 meta-luv/recipes-core/ndctl/ndctl/0002-ndctl-add-disable-docs-option-to-configure.patch
diff --git a/meta-luv/recipes-core/ndctl/ndctl/0002-ndctl-add-disable-docs-option-to-configure.patch b/meta-luv/recipes-core/ndctl/ndctl/0002-ndctl-add-disable-docs-option-to-configure.patch
new file mode 100644
index 0000000..c62365b
--- /dev/null
+++ b/meta-luv/recipes-core/ndctl/ndctl/0002-ndctl-add-disable-docs-option-to-configure.patch
@@ -0,0 +1,50 @@
+From 3aceba33a5c4c1cfff8ef0ae3f34db123e9fe3e2 Mon Sep 17 00:00:00 2001
+From: Dan Williams <dan.j.williams(a)intel.com>
+Date: Thu, 10 Mar 2016 07:48:35 -0800
+Subject: [PATCH] ndctl: add '--disable-docs' option to configure
+
+For environments that want to build without the documentation add an
+option to omit the Documentation/ sub-directory.
+
+Reported-by: Arjan van de Ven <arjan(a)linux.intel.com>
+Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
+---
+ Makefile.am | 2 ++
+ configure.ac | 9 +++++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/Makefile.am b/Makefile.am
+index ce97a15..8458277 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,5 +1,7 @@
+ EXTRA_DIST =
++if ENABLE_DOCS
+ SUBDIRS = . Documentation
++endif
+ CLEANFILES =
+ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+ AM_MAKEFLAGS = --no-print-directory
+diff --git a/configure.ac b/configure.ac
+index 9506e8e..96a02d9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -58,6 +58,15 @@ AS_IF([test "x$enable_logging" = "xyes"], [
+ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
+ ])
+
++AC_ARG_ENABLE([docs],
++ AS_HELP_STRING([--disable-docs],
++ [disable documentation build @<:@default=enabled@:>@]),
++ [], enable_docs=yes)
++AS_IF([test "x$enable_docs" = "xyes"], [
++ AC_DEFINE(ENABLE_DOCS, [1], [Documentation / man pages.])
++])
++AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" = "xyes"])
++
+ AC_ARG_ENABLE([debug],
+ AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
+ [], [enable_debug=no])
+--
+2.8.2
+
diff --git a/meta-luv/recipes-core/ndctl/ndctl_git.bb b/meta-luv/recipes-core/ndctl/ndctl_git.bb
index b9c39cb..74b00fa 100644
--- a/meta-luv/recipes-core/ndctl/ndctl_git.bb
+++ b/meta-luv/recipes-core/ndctl/ndctl_git.bb
@@ -21,6 +21,7 @@ inherit module-base
SRC_URI += "git://github.com/pmem/ndctl.git"
SRC_URI += "file://0001-ndctl-fix-build-on-systems-where-bin-sh-is-not-a-lin.patch"
+SRC_URI += "file://0002-ndctl-add-disable-docs-option-to-configure.patch"
SRC_URI += "file://luv-parser-ndctl"
SRC_URI += "file://ndctl_runner"
SRCREV = "d3fdcf9ac24d3f57968d166a1c240b2f5e44aab8"
--
2.8.1
6 years, 1 month
[PATCH] efivarfs: add runtime dependency on e2fsprogs
by Ricardo Neri
Since Linux v4.5, the efivarfs that are not well-known standardized
variables are created as immutable files. This is to prevent the
accidental removal of such files, that is known to brick certain
machines with buggy firmware. Only the efivarfs files in a whitelist
could be removed. Deletion happens by removing the immutable attribute
using chattr [1].
Chattr is distributed via the e2fsprogs package.
[1]. https://lkml.org/lkml/2016/2/12/148
Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
---
meta-luv/recipes-core/efivarfs/efivarfs-test.bb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta-luv/recipes-core/efivarfs/efivarfs-test.bb b/meta-luv/recipes-core/efivarfs/efivarfs-test.bb
index 15857fb..3ecb7d5 100644
--- a/meta-luv/recipes-core/efivarfs/efivarfs-test.bb
+++ b/meta-luv/recipes-core/efivarfs/efivarfs-test.bb
@@ -16,6 +16,8 @@ SRCREV="${AUTOREV}"
inherit autotools luv-test
S = "${STAGING_KERNEL_DIR}"
+RDEPENDS_${PN} += "e2fsprogs"
+
do_fetch[noexec] = "1"
do_unpack[depends] += "virtual/kernel:do_unpack"
do_patch[depends] += "virtual/kernel:do_shared_workdir"
--
2.8.1
6 years, 1 month
[PATCH] fwts: bump to V16.05.01
by Ricardo Neri
Update FWTS to version V16.05.01.
Signed-off-by: Ricardo Neri <ricardo.neri-calderon(a)linux.intel.com>
---
meta-luv/recipes-core/fwts/fwts_git.bb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta-luv/recipes-core/fwts/fwts_git.bb b/meta-luv/recipes-core/fwts/fwts_git.bb
index 389542a..2a5f2ef 100644
--- a/meta-luv/recipes-core/fwts/fwts_git.bb
+++ b/meta-luv/recipes-core/fwts/fwts_git.bb
@@ -4,9 +4,9 @@ HOMEPAGE = "https://wiki.ubuntu.com/Kernel/Reference/fwts"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://src/main.c;beginline=1;endline=16;md5=31da590f3e9f3bd34dcdb9e4db568519"
-PV = "V16.03.00+git${SRCPV}"
+PV = "V16.05.01+git${SRCPV}"
-SRCREV = "474521b576220f1ce658de7912305d260f8104b1"
+SRCREV = "d643cf87952746aad4fc0030518b1fd095ad0aa2"
SRC_URI = "git://kernel.ubuntu.com/hwe/fwts.git \
file://luv-parser-fwts \
"
--
2.8.1
6 years, 1 month