mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
Pull request efi-2025-01-rc1-2
Documentation: * Add document describing Ethernet boot on AM62x SoC * Fix typo in blkmap command example UEFI: * Avoid #ifdef in efi_setup.c * Reduce message noisiness if ESP is missing * Remove ERROR:, WARNING: prefixes in messages * Use blk_create_devicef() in block device driver Others: * Let CONFIG_CMD_WGET depend on CONFIG_CMD_NET -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmcSnMgACgkQhO4vgnE3 U0upVA/+L1jXBSSXnR8FnvI40SbACxYFx5MFHEkEyNn5D9wwc2ptzH6zWCamzFkG /mH5vaHrjV89WU8EkLFUepCiYz5053KnoK3NlnBNL6mISQcB6YHi2ZNfjWOTwIn9 z12DrXJcs1gNIOxTMI3AdQ9UespsC4XytBgsm0zpzh1ZpBKnqcaX4p0iU/TBFibi rZ9yk+iXp04lfJiz1rPaBMQY7HlByCdlM4o6JwQkqW8RS5ozsuKYzZdrMrNO/ksN 9Cuqwqrst58JcZXZ4zdnaTCqCAqBfo3h6iiPN6+skn0XGgTC7KWHoLffW/z5cqUy 2PgyEASlpyB6Q0VX6+tRRj06ZWpSGudp92hNY5kb7ZXyU+boEwrkWZZNCf2HU+KF sifu7KMU2yOPTcA2qHIYEJ8gI7Zg9Xpzz9lrtm8a0XUbvOnobzIp7tkDUo27q0/B YLEf24BoBEmbFTEvTXbI5Xehq1TGWao0UfAAm6vtZIhZp42Efc0EYVUiZz8zw8mf x+GEhP08yT3sMSZXKtxT50w4UTVyfRStwHNQ+f217Q96ndNuj+LNFwpURBwWlQ5E 59WoM235coc9vwynFspaaPSVuYzpDOuaYtEJRmksslhSj/c4w/sDiROXaOGvBs3S ZVH4ObLjnl2x3ngA1x1EVeDCrMt5ujvmKJIEiBHFmFsY707rRAQ= =F6+Y -----END PGP SIGNATURE----- Merge tag 'efi-2025-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request efi-2025-01-rc1-2 CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/22810 Documentation: * Add document describing Ethernet boot on AM62x SoC * Fix typo in blkmap command example UEFI: * Avoid #ifdef in efi_setup.c * Reduce message noisiness if ESP is missing * Remove ERROR:, WARNING: prefixes in messages * Use blk_create_devicef() in block device driver Others: * Let CONFIG_CMD_WGET depend on CONFIG_CMD_NET
This commit is contained in:
commit
fa0ed06a74
8 changed files with 236 additions and 40 deletions
|
@ -2117,6 +2117,7 @@ config CMD_TFTPBOOT
|
|||
|
||||
config CMD_WGET
|
||||
bool "wget"
|
||||
depends on CMD_NET
|
||||
default y if SANDBOX
|
||||
select PROT_TCP if NET
|
||||
select PROT_TCP_LWIP if NET_LWIP
|
||||
|
|
|
@ -305,6 +305,10 @@ https://www.ti.com/lit/pdf/spruiv7 under the `Boot Mode Pins` section.
|
|||
- 00000000
|
||||
- 11001010
|
||||
|
||||
* - Ethernet
|
||||
- 00110000
|
||||
- 11000100
|
||||
|
||||
For SW2 and SW1, the switch state in the "ON" position = 1.
|
||||
|
||||
DFU based boot
|
||||
|
@ -330,6 +334,198 @@ When using dfu-util the following commands can be used to boot to a U-Boot shell
|
|||
|
||||
.. am62x_evm_rst_include_end_dfu_boot
|
||||
|
||||
Ethernet based boot
|
||||
-------------------
|
||||
|
||||
To boot the board via Ethernet, configure the BOOT MODE pins for Ethernet boot.
|
||||
|
||||
On powering on the device, ROM uses the Ethernet Port corresponding to CPSW3G's MAC
|
||||
Port 1 to transmit "TI K3 Bootp Boot".
|
||||
|
||||
The TFTP server and DHCP server on the receiver device need to be configured such
|
||||
that VCI string "TI K3 Bootp Boot" maps to the file `tiboot3.bin` and the TFTP
|
||||
server should be capable of transferring it to the device.
|
||||
|
||||
**Configuring DHCP server includes following steps:**
|
||||
|
||||
* Install DHCP server:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo apt install isc-dhcp-server
|
||||
|
||||
* Disable services before configuring:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo systemctl disable --now isc-dhcp-server.service isc-dhcp-server6.service
|
||||
|
||||
* DHCP server setup
|
||||
|
||||
Run the ip link or ifconfig command to find the name of your network interface:
|
||||
|
||||
Example
|
||||
|
||||
.. code-block::
|
||||
|
||||
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
||||
inet 172.24.145.229 netmask 255.255.254.0 broadcast 172.24.145.255
|
||||
inet6 fe80::bbd5:34c8:3d4c:5de4 prefixlen 64 scopeid 0x20<link>
|
||||
ether c0:18:03:bd:b1:a6 txqueuelen 1000 (Ethernet)
|
||||
RX packets 2733979 bytes 1904440459 (1.9 GB)
|
||||
RX errors 0 dropped 3850 overruns 0 frame 0
|
||||
TX packets 796807 bytes 84534764 (84.5 MB)
|
||||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
||||
device interrupt 16 memory 0xe2200000-e2220000
|
||||
|
||||
enxf8e43b8cffe8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
||||
ether f8:e4:3b:8c:ff:e8 txqueuelen 1000 (Ethernet)
|
||||
RX packets 95 bytes 31160 (31.1 KB)
|
||||
RX errors 0 dropped 0 overruns 0 frame 0
|
||||
TX packets 89 bytes 17445 (17.4 KB)
|
||||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
||||
|
||||
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
|
||||
inet 127.0.0.1 netmask 255.0.0.0
|
||||
inet6 ::1 prefixlen 128 scopeid 0x10<host>
|
||||
loop txqueuelen 1000 (Local Loopback)
|
||||
RX packets 85238 bytes 7244462 (7.2 MB)
|
||||
RX errors 0 dropped 0 overruns 0 frame 0
|
||||
TX packets 85238 bytes 7244462 (7.2 MB)
|
||||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
||||
|
||||
Suppose we are using enxf8e43b8cffe8 interface, one end of it is connected to host PC
|
||||
and other to board.
|
||||
|
||||
* Do the following changes in /etc/dhcp/dhcpd.conf in host PC.
|
||||
|
||||
.. code-block::
|
||||
|
||||
subnet 192.168.0.0 netmask 255.255.254.0
|
||||
{
|
||||
range dynamic-bootp 192.168.0.2 192.168.0.5;
|
||||
if substring (option vendor-class-identifier, 0, 16) = "TI K3 Bootp Boot"
|
||||
{
|
||||
filename "tiboot3.bin";
|
||||
} elsif substring (option vendor-class-identifier, 0, 20) = "AM62X U-Boot R5 SPL"
|
||||
{
|
||||
filename "tispl.bin";
|
||||
} elsif substring (option vendor-class-identifier, 0, 21) = "AM62X U-Boot A53 SPL"
|
||||
{
|
||||
filename "u-boot.img";
|
||||
}
|
||||
default-lease-time 60000;
|
||||
max-lease-time 720000;
|
||||
next-server 192.168.0.1;
|
||||
}
|
||||
|
||||
* Do following changes in /etc/default/isc-dhcp-server
|
||||
|
||||
.. code-block::
|
||||
|
||||
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
|
||||
INTERFACESv4="enxf8e43b8cffe8"
|
||||
INTERFACESv6=""
|
||||
|
||||
* For your interface change ip address and netmask to next-server and your netmask
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo ifconfig enxf8e43b8cffe8 192.168.0.1 netmask 255.255.254.0
|
||||
|
||||
* Enable DHCP
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo systemctl enable --now isc-dhcp-server
|
||||
|
||||
* To see if there is any configuration error or if dhcp is running run
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo service isc-dhcp-server status
|
||||
# If it shows error then something is wrong with configuration
|
||||
|
||||
**For TFTP setup follow below steps:**
|
||||
|
||||
* Install TFTP server:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo apt install tftpd-hpa
|
||||
|
||||
tftpd-hpa package should be installed.
|
||||
|
||||
Now, check whether the tftpd-hpa service is running with the following command:
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo systemctl status tftpd-hpa
|
||||
|
||||
* Configuring TFTP server:
|
||||
|
||||
The default configuration file of tftpd-hpa server is /etc/default/tftpd-hpa.
|
||||
If you want to configure the TFTP server, then you have to modify this configuration
|
||||
file and restart the tftpd-hpa service afterword.
|
||||
|
||||
To modify the /etc/default/tftpd-hpa configuration file, run the following command
|
||||
|
||||
.. prompt:: bash $
|
||||
|
||||
sudo vim /etc/default/tftpd-hpa
|
||||
|
||||
Configuration file may contain following configuration options by default:
|
||||
|
||||
.. code-block::
|
||||
|
||||
# /etc/default/tftpd-hpa
|
||||
|
||||
TFTP_USERNAME="tftp"
|
||||
TFTP_DIRECTORY="/var/lib/tftpboot"
|
||||
TFTP_ADDRESS=":69"
|
||||
TFTP_OPTIONS="--secure"
|
||||
|
||||
Now change the **TFTP_DIRECTORY** to **/tftp** and add the **--create** option to the
|
||||
**TFTP_OPTIONS**. Without the **--create** option, you won't be able to create or upload
|
||||
new files to the TFTP server. You will only be able to update existing files.
|
||||
|
||||
After above changes /etc/default/tftpd-hpa file would look like this:
|
||||
|
||||
.. code-block::
|
||||
|
||||
# /etc/default/tftpd-hpa
|
||||
|
||||
TFTP_USERNAME="tftp"
|
||||
TFTP_DIRECTORY="/tftp"
|
||||
TFTP_ADDRESS=":69"
|
||||
TFTP_OPTIONS="--secure --create"
|
||||
|
||||
Since we have configured tftp directory as /tftp, put tiboot3.bin, tispl.bin
|
||||
and u-boot.img after building it using sdk or manually cloning all the repos.
|
||||
|
||||
To build binaries use following defconfig files:
|
||||
|
||||
.. code-block::
|
||||
|
||||
am62x_evm_r5_ethboot_defconfig
|
||||
am62x_evm_a53_ethboot_defconfig
|
||||
|
||||
`tiboot3.bin` is expected to be built from `am62x_evm_r5_ethboot_defconfig` and
|
||||
`tispl.bin` and `u-boot.img` are expected to be built from
|
||||
`am62x_evm_a53_ethboot_defconfig`.
|
||||
|
||||
Images should get fetched in following sequence as a part of boot procedure:
|
||||
|
||||
.. code-block::
|
||||
|
||||
tiboot3.bin => tispl.bin => u-boot.img
|
||||
|
||||
ROM loads and executes `tiboot3.bin` provided by the TFTP server.
|
||||
|
||||
Next, based on NET_VCI_STRING string mentioned in respective defconfig file `tiboot3.bin`
|
||||
fetches `tispl.bin` and then `tispl.bin` fetches `u-boot.img` from TFTP server which
|
||||
completes Ethernet boot on the device.
|
||||
|
||||
Debugging U-Boot
|
||||
----------------
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ downloaded file, in blocks:
|
|||
::
|
||||
|
||||
setexpr fileblks ${filesize} + 0x1ff
|
||||
setexpr fileblks ${filesize} / 0x200
|
||||
setexpr fileblks ${fileblks} / 0x200
|
||||
|
||||
Then we can add a mapping to the start of our device, backed by the
|
||||
memory at `${loadaddr}`:
|
||||
|
|
|
@ -133,15 +133,13 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface)
|
|||
sprintf(name, "efiblk#%d", devnum);
|
||||
|
||||
/* Create driver model udevice for the EFI block io device */
|
||||
if (blk_create_device(parent, "efi_blk", name, UCLASS_EFI_LOADER,
|
||||
devnum, io->media->block_size,
|
||||
(lbaint_t)io->media->last_block, &bdev)) {
|
||||
if (blk_create_devicef(parent, "efi_blk", name, UCLASS_EFI_LOADER,
|
||||
devnum, io->media->block_size,
|
||||
(lbaint_t)io->media->last_block, &bdev)) {
|
||||
ret = EFI_OUT_OF_RESOURCES;
|
||||
free(name);
|
||||
goto err;
|
||||
}
|
||||
/* Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak */
|
||||
device_set_name_alloced(bdev);
|
||||
|
||||
plat = dev_get_plat(bdev);
|
||||
plat->handle = handle;
|
||||
|
|
|
@ -412,7 +412,7 @@ static efi_status_t copy_fdt(void **fdtp)
|
|||
EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
|
||||
&new_fdt_addr);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("ERROR: Failed to reserve space for FDT\n");
|
||||
log_err("Failed to reserve space for FDT\n");
|
||||
goto done;
|
||||
}
|
||||
new_fdt = (void *)(uintptr_t)new_fdt_addr;
|
||||
|
@ -468,7 +468,7 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
* but not both.
|
||||
*/
|
||||
if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) && fdt)
|
||||
log_warning("WARNING: Can't have ACPI table and device tree - ignoring DT.\n");
|
||||
log_warning("Can't have ACPI table and device tree - ignoring DT.\n");
|
||||
|
||||
if (fdt == EFI_FDT_USE_INTERNAL) {
|
||||
const char *fdt_opt;
|
||||
|
@ -483,13 +483,13 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
if (!fdt_opt) {
|
||||
fdt_opt = env_get("fdtcontroladdr");
|
||||
if (!fdt_opt) {
|
||||
log_err("ERROR: need device tree\n");
|
||||
log_err("need device tree\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
fdt_addr = hextoul(fdt_opt, NULL);
|
||||
if (!fdt_addr) {
|
||||
log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
|
||||
log_err("invalid $fdt_addr or $fdtcontroladdr\n");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
fdt = map_sysmem(fdt_addr, 0);
|
||||
|
@ -497,7 +497,7 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
|
||||
/* Install device tree */
|
||||
if (fdt_check_header(fdt)) {
|
||||
log_err("ERROR: invalid device tree\n");
|
||||
log_err("invalid device tree\n");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
|
@ -510,12 +510,12 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
/* Prepare device tree for payload */
|
||||
ret = copy_fdt(&fdt);
|
||||
if (ret) {
|
||||
log_err("ERROR: out of memory\n");
|
||||
log_err("out of memory\n");
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (image_setup_libfdt(&img, fdt, false)) {
|
||||
log_err("ERROR: failed to process device tree\n");
|
||||
log_err("failed to process device tree\n");
|
||||
return EFI_LOAD_ERROR;
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {
|
||||
ret = efi_tcg2_measure_dtb(fdt);
|
||||
if (ret == EFI_SECURITY_VIOLATION) {
|
||||
log_err("ERROR: failed to measure DTB\n");
|
||||
log_err("failed to measure DTB\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ efi_status_t efi_install_fdt(void *fdt)
|
|||
/* Install device tree as UEFI table */
|
||||
ret = efi_install_configuration_table(&efi_guid_fdt, fdt);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("ERROR: failed to install device tree\n");
|
||||
log_err("failed to install device tree\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
|
|||
*/
|
||||
ret = efi_set_watchdog(300);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
log_err("ERROR: Failed to set watchdog timer\n");
|
||||
log_err("failed to set watchdog timer\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -652,7 +652,7 @@ void *efi_alloc(size_t size)
|
|||
|
||||
if (efi_allocate_pool(EFI_BOOT_SERVICES_DATA, size, &buf) !=
|
||||
EFI_SUCCESS) {
|
||||
log_err("out of memory");
|
||||
log_err("out of memory\n");
|
||||
return NULL;
|
||||
}
|
||||
memset(buf, 0, size);
|
||||
|
|
|
@ -86,7 +86,6 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EFI_SECURE_BOOT
|
||||
/**
|
||||
* efi_init_secure_boot - initialize secure boot state
|
||||
*
|
||||
|
@ -112,12 +111,6 @@ static efi_status_t efi_init_secure_boot(void)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static efi_status_t efi_init_secure_boot(void)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
#endif /* CONFIG_EFI_SECURE_BOOT */
|
||||
|
||||
/**
|
||||
* efi_init_capsule - initialize capsule update state
|
||||
|
@ -302,9 +295,11 @@ efi_status_t efi_init_obj_list(void)
|
|||
}
|
||||
|
||||
/* Secure boot */
|
||||
ret = efi_init_secure_boot();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) {
|
||||
ret = efi_init_secure_boot();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Indicate supported runtime services */
|
||||
ret = efi_init_runtime_supported();
|
||||
|
@ -322,11 +317,11 @@ efi_status_t efi_init_obj_list(void)
|
|||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
}
|
||||
#ifdef CONFIG_NETDEVICES
|
||||
ret = efi_net_register();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
#endif
|
||||
if (IS_ENABLED(CONFIG_NETDEVICES)) {
|
||||
ret = efi_net_register();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
}
|
||||
if (IS_ENABLED(CONFIG_ACPI)) {
|
||||
ret = efi_acpi_register();
|
||||
if (ret != EFI_SUCCESS)
|
||||
|
|
|
@ -37,18 +37,16 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void)
|
|||
char part_str[PART_STR_LEN];
|
||||
int r;
|
||||
|
||||
if (efi_system_partition.uclass_id == UCLASS_INVALID) {
|
||||
log_err("No EFI system partition\n");
|
||||
if (efi_system_partition.uclass_id == UCLASS_INVALID)
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
snprintf(part_str, PART_STR_LEN, "%x:%x",
|
||||
efi_system_partition.devnum, efi_system_partition.part);
|
||||
r = fs_set_blk_dev(blk_get_uclass_name(efi_system_partition.uclass_id),
|
||||
part_str, FS_TYPE_ANY);
|
||||
if (r) {
|
||||
log_err("Cannot read EFI system partition\n");
|
||||
if (r)
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -67,14 +65,21 @@ efi_status_t efi_var_to_file(void)
|
|||
loff_t len;
|
||||
loff_t actlen;
|
||||
int r;
|
||||
static bool once;
|
||||
|
||||
ret = efi_var_collect(&buf, &len, EFI_VARIABLE_NON_VOLATILE);
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto error;
|
||||
|
||||
ret = efi_set_blk_dev_to_system_partition();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto error;
|
||||
if (ret != EFI_SUCCESS) {
|
||||
if (!once) {
|
||||
log_warning("Cannot persist EFI variables without system partition\n");
|
||||
once = true;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
once = false;
|
||||
|
||||
r = fs_write(EFI_VAR_FILE_NAME, map_to_sysmem(buf), 0, len, &actlen);
|
||||
if (r || len != actlen)
|
||||
|
@ -83,6 +88,7 @@ efi_status_t efi_var_to_file(void)
|
|||
error:
|
||||
if (ret != EFI_SUCCESS)
|
||||
log_err("Failed to persist EFI variables\n");
|
||||
out:
|
||||
free(buf);
|
||||
return ret;
|
||||
#else
|
||||
|
|
Loading…
Add table
Reference in a new issue