Pull request for efi-2021-04-rc3

Bug fixes:
 
 * Let EFI simple file protocol access last block of partition
 * Correct conversion of multi-part device paths in
   EFI_DEVICE_PATH_TO_TEXT_PROTOCOL.ConvertDevicePathToText()
 
 Documentation:
 
 * booti and qfw man-pages
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmAyK8YACgkQxIHbvCwF
 GsQgSA//UXeBPxeHaI0ZgCTgq37GMQiz20BsEHN4V7OXJK28HCJPCKWlze+Y8BcT
 bwRwfQmP+mBy5PdC2ayy3OxkTVJVBx0O1wobWXUhxDTGejMHMy9K5qdwRgqsXZpV
 W8/eT8039UpFvS27OAwEJSUkgKj/A1UjUOcO4VpLDvCyBhEUoxAwrXuRBy6my/54
 cpq1DtaZpyaXN0gqMTCAlnEi6jEQjvq1dJyfN8/EkMqnaRhkuofx2qFony6TohZM
 k53rBwiV1nW5lJOuq64kZMnCjpcGvE8QLr5f+4VVY0+rV67SrDZoxYewy6snVtj1
 p4i+IaDAgJ6QBexW2Smym1enW44kyIhOYbISANAfXo+Q2rY0e5LhcK1hlDIZWT5D
 u6oq9J6ROZb9qZYhb4yh6g1vuIvNhYN3hN2NQ6WcBDu3zMEZe3rPbkCIbjT0NQzX
 aKh4GkRivRsMXxNy9Zx20h5SrPF8gfmPULGPzVDY/rZXin1+M1bUZtZGH7GSWyOr
 x9RHfXIyki0KHkK4tOuAljs8A7/p+HrJj/46ynC2OfxLqo+kf0EkfoWk1sSEqOE/
 cDSM3iKjV/l3I8mbJd/Y7I3PpulrHmzuJHIDGlcmaZ8gjTCy7ny1mdd7qDafKmnc
 Oj7uHO/hVgLLH9XVMZKzIg9QWzKT2qXWhuAWAeDfe4AZA/FgM48=
 =P6/T
 -----END PGP SIGNATURE-----

Merge tag 'efi-2021-04-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-04-rc3

Bug fixes:

* Let EFI simple file protocol access last block of partition
* Correct conversion of multi-part device paths in
  EFI_DEVICE_PATH_TO_TEXT_PROTOCOL.ConvertDevicePathToText()

Documentation:

* booti and qfw man-pages
This commit is contained in:
Tom Rini 2021-02-21 11:17:30 -05:00
commit bbc0fcc302
9 changed files with 302 additions and 23 deletions

View File

@ -259,10 +259,10 @@ kernel_addr_r:
kernel_comp_addr_r:
Optional. This is only required if user wants to boot Linux from a compressed
Image(.gz, .bz2, .lzma, .lzo) using booti command. It represents the location
in RAM where the compressed Image will be decompressed temporarily. Once the
decompression is complete, decompressed data will be moved kernel_addr_r for
booting.
Image(.gz, .bz2, .lzma, .lzo) using the booti command. It represents the
location in RAM where the compressed Image will be decompressed temporarily.
Once the decompression is complete, the decompressed data will be moved to
kernel_addr_r for booting.
kernel_comp_size:
Optional. This is only required if user wants to boot Linux from a compressed

View File

@ -147,9 +147,9 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = 'The Linux Kernel'
copyright = 'The kernel development community'
author = 'The kernel development community'
project = 'Das U-Boot'
copyright = 'The U-Boot development community'
author = 'The U-Boot development community'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -260,7 +260,7 @@ except ImportError:
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
html_logo = '../tools/logos/u-boot_logo.svg'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@ -340,7 +340,7 @@ html_use_smartypants = False
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'TheLinuxKerneldoc'
htmlhelp_basename = 'TheUBootdoc'
# -- Options for LaTeX output ---------------------------------------------
@ -470,6 +470,8 @@ if major == 1 and minor < 6:
# author, documentclass [howto, manual, or own class]).
# Sorted in alphabetical order
latex_documents = [
('index', 'u-boot-hacker-manual.tex', 'U-Boot Hacker Manual',
'The U-Boot development community', 'manual'),
]
# Add all other index files from Documentation/ subdirectories
@ -483,8 +485,8 @@ for fn in os.listdir('.'):
break
if not has:
latex_documents.append((doc, fn + '.tex',
'Linux %s Documentation' % fn.capitalize(),
'The kernel development community',
'U-Boot %s Documentation' % fn.capitalize(),
'The U-Boot development community',
'manual'))
# The name of an image file (relative to this directory) to place at the top of
@ -513,7 +515,7 @@ for fn in os.listdir('.'):
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'thelinuxkernel', 'The Linux Kernel Documentation',
(master_doc, 'dasuboot', 'The U-Boot Documentation',
[author], 1)
]
@ -527,8 +529,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'TheLinuxKernel', 'The Linux Kernel Documentation',
author, 'TheLinuxKernel', 'One line description of project.',
(master_doc, 'DasUBoot', 'The U-Boot Documentation',
author, 'DasUBoot', 'One line description of project.',
'Miscellaneous'),
]
@ -626,7 +628,7 @@ epub_exclude_files = ['search.html']
# multiple PDF files here actually tries to get the cross-referencing right
# *between* PDF files.
pdf_documents = [
('kernel-documentation', u'Kernel', u'Kernel', u'J. Random Bozo'),
('uboot-documentation', u'U-Boot', u'U-Boot', u'J. Random Bozo'),
]
# kernel-doc extension configuration for running Sphinx directly (e.g. by Read

114
doc/usage/booti.rst Normal file
View File

@ -0,0 +1,114 @@
.. SPDX-License-Identifier: GPL-2.0+:
booti command
=============
Synopsis
--------
::
booti [<addr> [<initrd>[:<size>]] [<fdt>]]
Description
-----------
The booti command is used to boot a Linux kernel in flat or compressed
'Image' format. Which compressed formats are supported is configurable.
addr
address of kernel image, defaults to CONFIG_SYS_LOAD_ADDR.
initrd
address of the initial RAM disk. Use '-' to boot a kernel with a device
tree but without an initial RAM disk.
size
size of the initial RAM disk. This parameter must be specified for raw
initial RAM disks.
fdt
address of the device tree.
To support compressed Image files the following environment variables must be
set:
kernel_comp_addr_r
start of memory area used for decompression
kernel_comp_size
size of the compressed file. The value has to be at least the size of
loaded image for decompression to succeed. For the booti command the
maximum decompressed size is 10 times this value.
Example
-------
This is the boot log of an Odroid C2 board:
::
=> load mmc 0:1 $fdt_addr_r dtb-5.10.0-3-arm64
27530 bytes read in 7 ms (3.7 MiB/s)
=> load mmc 0:1 $kernel_addr_r vmlinuz-5.10.0-3-arm64
26990448 bytes read in 1175 ms (21.9 MiB/s)
=> load mmc 0:1 $ramdisk_addr_r initrd.img-5.10.0-3-arm64
27421776 bytes read in 1209 ms (21.6 MiB/s)
=> booti $kernel_addr_r $ramdisk_addr_r:$filesize $fdt_addr_r
Moving Image from 0x8080000 to 0x8200000, end=9c60000
## Flattened Device Tree blob at 08008000
Booting using the fdt blob at 0x8008000
Loading Ramdisk to 7a52a000, end 7bf50c50 ... OK
Loading Device Tree to 000000007a520000, end 000000007a529b89 ... OK
Starting kernel ...
The kernel can be compressed with gzip:
.. code-block:: bash
cd /boot
gzip -k vmlinuz-5.10.0-3-arm64
Here is the boot log for the compressed kernel:
::
=> setenv kernel_comp_addr_r 0x50000000
=> setenv kernel_comp_size 0x04000000
=> load mmc 0:1 $fdt_addr_r dtb-5.10.0-3-arm64
27530 bytes read in 6 ms (4.4 MiB/s)
=> load mmc 0:1 $kernel_addr_r vmlinuz-5.10.0-3-arm64.gz
9267730 bytes read in 402 ms (22 MiB/s)
=> load mmc 0:1 $ramdisk_addr_r initrd.img-5.10.0-3-arm64
27421776 bytes read in 1181 ms (22.1 MiB/s)
=> booti $kernel_addr_r $ramdisk_addr_r:$filesize $fdt_addr_r
Uncompressing Kernel Image
Moving Image from 0x8080000 to 0x8200000, end=9c60000
## Flattened Device Tree blob at 08008000
Booting using the fdt blob at 0x8008000
Loading Ramdisk to 7a52a000, end 7bf50c50 ... OK
Loading Device Tree to 000000007a520000, end 000000007a529b89 ... OK
Starting kernel ...
Configuration
-------------
The booti command is only available if CONFIG_CMD_BOOTI=y.
Which compression types are supported depends on:
* CONFIG_BZIP2
* CONFIG_GZIP
* CONFIG_LZ4
* CONFIG_LZMA
* CONFIG_LZO
* CONFIG_ZSTD
Return value
------------
Normally this command does not return. If an error occurs, the return value $?
is set to 1 (false). If the operating system returns to U-Boot, the system is
reset.

View File

@ -15,6 +15,7 @@ Shell commands
base
bootefi
booti
bootmenu
button
conitrace
@ -27,5 +28,6 @@ Shell commands
loady
mbr
pstore
qfw
sbi
true

89
doc/usage/qfw.rst Normal file
View File

@ -0,0 +1,89 @@
.. SPDX-License-Identifier: GPL-2.0+
qfw command
===========
Synopsis
--------
::
qfw list
qfw cpus
qfw load [kernel_addr [initrd_addr]]
Description
-----------
The *qfw* command is used to retrieve information form the QEMU firmware.
The *qfw list* sub-command displays the QEMU firmware files.
The *qfw cpus* sub-command displays the available CPUs.
The *qfw load* command is used to load a kernel and an initial RAM disk.
kernel_addr
address to which the file specified by the -kernel parameter of QEMU shall
be loaded. Defaults to environment variable *loadaddr* and further to
the value of *CONFIG_LOADADDR*.
initrd_addr
address to which the file specified by the -initrd parameter of QEMU shall
be loaded. Defaults to environment variable *ramdiskaddr* and further to
the value of *CONFIG_RAMDISK_ADDR*.
Examples
--------
QEMU firmware files are listed via the *qfw list* command:
::
=> qfw list
etc/boot-fail-wait
etc/smbios/smbios-tables
etc/smbios/smbios-anchor
etc/e820
genroms/kvmvapic.bin
genroms/linuxboot.bin
etc/system-states
etc/acpi/tables
etc/table-loader
etc/tpm/log
etc/acpi/rsdp
bootorder
The available CPUs can be shown via the *qfw cpus* command:
::
=> qfw cpu
2 cpu(s) online
The *-kernel* and *-initrd* parameters allow to specify a kernel and an
initial RAM disk for QEMU:
.. code-block:: bash
$ qemu-system-x86_64 -machine pc-i440fx-2.5 -bios u-boot.rom -m 1G \
-nographic -kernel vmlinuz -initrd initrd
Now the kernel and the initial RAM disk can be loaded to the U-Boot memory via
the *qfw load* command and booted thereafter.
::
=> qfw load ${kernel_addr_r} ${ramdisk_addr_r}
loading kernel to address 0000000001000000 size 5048f0 initrd 0000000004000000 size 3c94891
=> zboot 1000000 5048f0 4000000 3c94891
Valid Boot Flag
Magic signature found
Linux kernel version 4.19.0-14-amd64 (debian-kernel@lists.debian.org) #1 SMP Debian 4.19.171-2 (2021-01-30)
Building boot_params at 0x00090000
Loading bzImage at address 100000 (5260160 bytes)
Configuration
-------------
The qfw command is only available if CONFIG_CMD_QFW=y.

View File

@ -369,11 +369,18 @@ static uint16_t EFIAPI *efi_convert_device_path_to_text(
if (!device_path)
goto out;
while (device_path &&
str + MAX_NODE_LEN < buffer + MAX_PATH_LEN) {
*str++ = '/';
str = efi_convert_single_device_node_to_text(str, device_path);
device_path = efi_dp_next(device_path);
while (device_path && str + MAX_NODE_LEN < buffer + MAX_PATH_LEN) {
if (device_path->type == DEVICE_PATH_TYPE_END) {
if (device_path->sub_type !=
DEVICE_PATH_SUB_TYPE_INSTANCE_END)
break;
*str++ = ',';
} else {
*str++ = '/';
str = efi_convert_single_device_node_to_text(
str, device_path);
}
*(u8 **)&device_path += device_path->length;
}
text = efi_str_to_u16(buffer);

View File

@ -148,7 +148,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this,
(uintptr_t)buffer & (this->media->io_align - 1))
return EFI_INVALID_PARAMETER;
if (lba * this->media->block_size + buffer_size >
this->media->last_block * this->media->block_size)
(this->media->last_block + 1) * this->media->block_size)
return EFI_INVALID_PARAMETER;
#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
@ -216,7 +216,7 @@ static efi_status_t EFIAPI efi_disk_write_blocks(struct efi_block_io *this,
(uintptr_t)buffer & (this->media->io_align - 1))
return EFI_INVALID_PARAMETER;
if (lba * this->media->block_size + buffer_size >
this->media->last_block * this->media->block_size)
(this->media->last_block + 1) * this->media->block_size)
return EFI_INVALID_PARAMETER;
#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER

View File

@ -8,7 +8,7 @@
asflags-y += -DHOST_ARCH="$(HOST_ARCH)"
ccflags-y += -DHOST_ARCH="$(HOST_ARCH)"
CFLAGS_dtbdump_exit.o := $(CFLAGS_EFI) -Os -ffreestanding
CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding
CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI)
CFLAGS_efi_selftest_miniapp_exit.o := $(CFLAGS_EFI) -Os -ffreestanding
CFLAGS_REMOVE_efi_selftest_miniapp_exit.o := $(CFLAGS_NON_EFI)

View File

@ -45,6 +45,55 @@ static u8 *dp1;
static u8 *dp2;
static u8 *dp3;
static struct {
struct efi_device_path_sd_mmc_path sd1;
struct efi_device_path sep1;
struct efi_device_path_sd_mmc_path sd2;
struct efi_device_path sep2;
struct efi_device_path_sd_mmc_path sd3;
struct efi_device_path end;
} multi_part_dp = {
{
{
DEVICE_PATH_TYPE_MESSAGING_DEVICE,
DEVICE_PATH_SUB_TYPE_MSG_SD,
sizeof(struct efi_device_path_sd_mmc_path),
},
0,
},
{
DEVICE_PATH_TYPE_END,
DEVICE_PATH_SUB_TYPE_INSTANCE_END,
sizeof(struct efi_device_path),
},
{
{
DEVICE_PATH_TYPE_MESSAGING_DEVICE,
DEVICE_PATH_SUB_TYPE_MSG_SD,
sizeof(struct efi_device_path_sd_mmc_path),
},
1,
},
{
DEVICE_PATH_TYPE_END,
DEVICE_PATH_SUB_TYPE_INSTANCE_END,
sizeof(struct efi_device_path),
},
{
{
DEVICE_PATH_TYPE_MESSAGING_DEVICE,
DEVICE_PATH_SUB_TYPE_MSG_SD,
sizeof(struct efi_device_path_sd_mmc_path),
},
2,
},
{
DEVICE_PATH_TYPE_END,
DEVICE_PATH_SUB_TYPE_END,
sizeof(struct efi_device_path),
},
};
struct efi_device_path_to_text_protocol *device_path_to_text;
/*
@ -340,6 +389,22 @@ static int execute(void)
return EFI_ST_FAILURE;
}
string = device_path_to_text->convert_device_path_to_text(
(struct efi_device_path *)&multi_part_dp, true, false);
if (efi_st_strcmp_16_8(
string,
"/SD(0),/SD(1),/SD(2)")
) {
efi_st_printf("multi_part_dp: %ps\n", string);
efi_st_error("Incorrect text from ConvertDevicePathToText\n");
return EFI_ST_FAILURE;
}
ret = boottime->free_pool(string);
if (ret != EFI_SUCCESS) {
efi_st_error("FreePool failed\n");
return EFI_ST_FAILURE;
}
/* Test ConvertDeviceNodeToText */
string = device_path_to_text->convert_device_node_to_text(
(struct efi_device_path *)&dp_node, true, false);