Updated patch for DTB loading
This commit is contained in:
parent
bda7eb94be
commit
d91245dd1c
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
Name: uboot-tools
|
Name: uboot-tools
|
||||||
Version: 2024.04
|
Version: 2024.04
|
||||||
Release: 0.6%{?candidate:.%{candidate}}%{?dist}
|
Release: 0.7%{?candidate:.%{candidate}}%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Summary: U-Boot utilities
|
Summary: U-Boot utilities
|
||||||
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
|
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
|
||||||
|
@ -190,6 +190,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Mar 21 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 1:2024.04-0.7.rc4
|
||||||
|
- Updated patch for DTB loading
|
||||||
|
|
||||||
* Fri Mar 15 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 1:2024.04-0.6.rc4
|
* Fri Mar 15 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 1:2024.04-0.6.rc4
|
||||||
- Updated fix for FDT load
|
- Updated fix for FDT load
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
From 751b1c4ec581f3546c49e4d59485306601fe6e2d Mon Sep 17 00:00:00 2001
|
From 8abb44f89aefd25cda27c54c08b68b3a60bea7c3 Mon Sep 17 00:00:00 2001
|
||||||
From: Peter Robinson <pbrobinson@gmail.com>
|
From: Peter Robinson <pbrobinson@gmail.com>
|
||||||
Date: Fri, 15 Mar 2024 16:42:23 +0000
|
Date: Thu, 21 Mar 2024 13:43:24 +0000
|
||||||
Subject: [PATCH] initial find_fdt_location for finding the DT on disk
|
Subject: [PATCH] initial find_fdt_location for finding the DT on disk
|
||||||
|
|
||||||
The old distro boot looked for a DT on the first boot partition
|
The old distro boot looked for a DT on the first boot partition
|
||||||
|
@ -16,11 +16,11 @@ so that devices will continue to work as they did previously.
|
||||||
|
|
||||||
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
||||||
---
|
---
|
||||||
cmd/bootefi.c | 1 +
|
cmd/bootefi.c | 1 +
|
||||||
cmd/bootmenu.c | 5 +++
|
cmd/bootmenu.c | 5 ++
|
||||||
include/efi_loader.h | 2 +
|
include/efi_loader.h | 2 +
|
||||||
lib/efi_loader/efi_helper.c | 83 ++++++++++++++++++++++++++++++++++++-
|
lib/efi_loader/efi_helper.c | 105 +++++++++++++++++++++++++++++++++++-
|
||||||
4 files changed, 90 insertions(+), 1 deletion(-)
|
4 files changed, 112 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
|
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
|
||||||
index 9cf9027bf40..8b6194a8702 100644
|
index 9cf9027bf40..8b6194a8702 100644
|
||||||
|
@ -64,7 +64,7 @@ index 7daca0afba2..a969378ff2f 100644
|
||||||
int efi_init_early(void);
|
int efi_init_early(void);
|
||||||
/* Initialize efi execution environment */
|
/* Initialize efi execution environment */
|
||||||
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
|
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
|
||||||
index 5dd9cc876e4..8d51c9570b7 100644
|
index 5dd9cc876e4..a33ec39ff74 100644
|
||||||
--- a/lib/efi_loader/efi_helper.c
|
--- a/lib/efi_loader/efi_helper.c
|
||||||
+++ b/lib/efi_loader/efi_helper.c
|
+++ b/lib/efi_loader/efi_helper.c
|
||||||
@@ -12,6 +12,7 @@
|
@@ -12,6 +12,7 @@
|
||||||
|
@ -75,7 +75,7 @@ index 5dd9cc876e4..8d51c9570b7 100644
|
||||||
#include <efi_api.h>
|
#include <efi_api.h>
|
||||||
#include <efi_load_initrd.h>
|
#include <efi_load_initrd.h>
|
||||||
#include <efi_loader.h>
|
#include <efi_loader.h>
|
||||||
@@ -24,6 +25,77 @@
|
@@ -24,6 +25,99 @@
|
||||||
const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
|
const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ index 5dd9cc876e4..8d51c9570b7 100644
|
||||||
+ int MAX_PART = 8;
|
+ int MAX_PART = 8;
|
||||||
+ int part;
|
+ int part;
|
||||||
+ struct disk_partition info;
|
+ struct disk_partition info;
|
||||||
|
+ int fdtext;
|
||||||
+ int ret;
|
+ int ret;
|
||||||
+ int retfdt;
|
+ int retfdt;
|
||||||
+ int retload;
|
+ int retload;
|
||||||
|
@ -115,7 +116,9 @@ index 5dd9cc876e4..8d51c9570b7 100644
|
||||||
+ log_debug("FFL: part num: %d\n", part);
|
+ log_debug("FFL: part num: %d\n", part);
|
||||||
+ ret = part_get_info(desc, part, &info);
|
+ ret = part_get_info(desc, part, &info);
|
||||||
+ /* if we have partition check it for DT */
|
+ /* if we have partition check it for DT */
|
||||||
+ if (ret) {
|
+ if (ret < 0) {
|
||||||
|
+ log_debug("FFL: no partition\n");
|
||||||
|
+ } else {
|
||||||
+ log_debug("FFL: we have a partition\n");
|
+ log_debug("FFL: we have a partition\n");
|
||||||
+ /* we should have a case/for prefix in =/ /dtb/ /dtb/current/ */
|
+ /* we should have a case/for prefix in =/ /dtb/ /dtb/current/ */
|
||||||
+ /* but for now we hard code if for Fedora */
|
+ /* but for now we hard code if for Fedora */
|
||||||
|
@ -123,22 +126,41 @@ index 5dd9cc876e4..8d51c9570b7 100644
|
||||||
+ snprintf(fdt_fullpath, sizeof(fdt_fullpath), "%s/%s", prefix, fdt_filename);
|
+ snprintf(fdt_fullpath, sizeof(fdt_fullpath), "%s/%s", prefix, fdt_filename);
|
||||||
+ log_debug("FFL: full name: %s\n", fdt_fullpath);
|
+ log_debug("FFL: full name: %s\n", fdt_fullpath);
|
||||||
+ /* search for DT on partition and either find and exit or continue */
|
+ /* search for DT on partition and either find and exit or continue */
|
||||||
+ retfdt = fs_size(fdt_fullpath, &fdtsize);
|
+ if (fs_set_blk_dev_with_part(desc, part) == 0){
|
||||||
+ if (retfdt) {
|
+ log_debug("FFL: set block part pass\n");
|
||||||
+ /* we have a fdt!*/
|
+ fdtext = fs_exists(fdt_fullpath);
|
||||||
+ log_debug("FFL: we have found a DT on disk\n");
|
+ if (fdtext) {
|
||||||
+ pbraddr = (ulong)(env_get("fdt_addr"));
|
+ /* we have a fdt!*/
|
||||||
+ retload = fs_read(fdt_fullpath, pbraddr, 0, 0, &len_read);
|
+ if (fs_set_blk_dev_with_part(desc, part) == 0){
|
||||||
+ if (retload) {
|
+ retfdt = fs_size(fdt_fullpath, &fdtsize);
|
||||||
+ log_debug("FFL: we have a loaded DT, size %ld we can return\n", sizeof(len_read));
|
+ if (retfdt == 0) {
|
||||||
+ log_info("Found DTB: %s\n", fdt_filename);
|
+ log_debug("FFL: we have found a DT on disk, size %lld\n", fdtsize);
|
||||||
+ const char *fdt_opt;
|
+ /* Get the main fdt and map it */
|
||||||
+ fdt_opt = env_get("fdt_addr");
|
+ const char *fdt_pbr;
|
||||||
+ return fdt_opt;
|
+ fdt_pbr = env_get("fdt_addr_r");
|
||||||
|
+ pbraddr = hextoul(fdt_pbr, NULL);
|
||||||
|
+ log_debug("FFL: fdr addr: %s\n", fdt_pbr);
|
||||||
|
+ if (fs_set_blk_dev_with_part(desc, part) == 0){
|
||||||
|
+ retload = fs_read(fdt_fullpath, pbraddr, 0, fdtsize, &len_read);
|
||||||
|
+ if (retload == 0) {
|
||||||
|
+ log_debug("FFL: we have a loaded DT, size %lld we can return\n", fdtsize);
|
||||||
|
+ log_info("Found DTB: %s\n", fdt_filename);
|
||||||
|
+ return fdt_pbr;
|
||||||
|
+ } else {
|
||||||
|
+ log_debug("FFL: DT load failed\n");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ log_debug("FFL: we DON'T have a DT with size\n");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* we don't have a fdt!*/
|
||||||
|
+ log_debug("FFL: we DON'T have a DT\n");
|
||||||
+ }
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ log_debug("FFL: set block part FAIL\n");
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
|
||||||
+ log_debug("FFL: no partition\n");
|
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -153,14 +175,14 @@ index 5dd9cc876e4..8d51c9570b7 100644
|
||||||
/**
|
/**
|
||||||
* efi_create_current_boot_var() - Return Boot#### name were #### is replaced by
|
* efi_create_current_boot_var() - Return Boot#### name were #### is replaced by
|
||||||
* the value of BootCurrent
|
* the value of BootCurrent
|
||||||
@@ -432,11 +504,20 @@ efi_status_t efi_install_fdt(void *fdt)
|
@@ -432,11 +526,20 @@ efi_status_t efi_install_fdt(void *fdt)
|
||||||
/* Look for device tree that is already installed */
|
/* Look for device tree that is already installed */
|
||||||
if (efi_get_configuration_table(&efi_guid_fdt))
|
if (efi_get_configuration_table(&efi_guid_fdt))
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
+ /* Check if there is device tree loaded from disk */
|
+ /* Check if there is device tree loaded from disk */
|
||||||
+ fdt_opt = find_fdt_location();
|
+ fdt_opt = find_fdt_location();
|
||||||
+ if (fdt_opt)
|
+ if (fdt_opt)
|
||||||
+ log_debug("Found DTB: insert file name here\n");
|
+ log_debug("Found DTB on disk\n");
|
||||||
/* Check if there is a hardware device tree */
|
/* Check if there is a hardware device tree */
|
||||||
- fdt_opt = env_get("fdt_addr");
|
- fdt_opt = env_get("fdt_addr");
|
||||||
+ if (!fdt_opt) {
|
+ if (!fdt_opt) {
|
||||||
|
|
Loading…
Reference in New Issue