Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smbios3 in asahi u-boot config #150

Open
ktrinh-anduril opened this issue Jan 4, 2025 · 3 comments
Open

smbios3 in asahi u-boot config #150

ktrinh-anduril opened this issue Jan 4, 2025 · 3 comments

Comments

@ktrinh-anduril
Copy link

Hi, I notice from past commit message that u-boot SMBIOS generation is disabled in u-boot defconfig since u-boot didn't support 64-bit SMBIOS3 table back then but since this commit, it looks like SMBIOS2 was replaced with SMBIOS3. So would it be possible to re-enable the SMBIOS generation in u-boot defconfig?

Also, thank you for the awesome projects!

@ktrinh-anduril
Copy link
Author

in addition, we might have to adjust the device tree to include the u-boot,sysinfo-smbios node so that the table gets populated properly, I will try this on my Mac and see if this works out and report back

@ktrinh-anduril
Copy link
Author

okay I think I have things working, extra device tree isn't needed but I did need to have a pull serial number from m1n1 device-tree and set the "serial#" env variable on u-boot side so that smbios can pick it up properly

diff --git c/arch/arm/mach-apple/board.c i/arch/arm/mach-apple/board.c
index 59f536b0d3..7cd825f351 100644
--- c/arch/arm/mach-apple/board.c
+++ i/arch/arm/mach-apple/board.c
@@ -845,6 +845,8 @@ char *env_fat_get_dev_part(void)
 int board_late_init(void)
 {
 	struct lmb lmb;
+    int root_node_offset;
+    const char* serial_number;
 	u32 status = 0;

 	status |= env_set("storage_interface",
@@ -865,6 +867,21 @@ int board_late_init(void)
 	status |= env_set_hex("kernel_comp_size", KERNEL_COMP_SIZE);
 	status |= env_set_hex("scriptaddr", lmb_alloc(&lmb, SZ_4M, SZ_2M));
 	status |= env_set_hex("pxefile_addr_r", lmb_alloc(&lmb, SZ_4M, SZ_2M));
+
+    root_node_offset = fdt_path_offset((const void*) fw_dtb_pointer, "/");
+	if (root_node_offset < 0) {
+		log_warning("late_init: fdt_path_offset() for root_node_offset returned %s\n", fdt_strerror(root_node_offset));
+        status = 1;
+	} else {
+        serial_number = fdt_getprop((const void*) fw_dtb_pointer, root_node_offset, "serial-number", NULL);
+        if(serial_number) {
+            status |= env_set("serial#", serial_number);
+            log_info("late_init: serial number is %s\n", serial_number);
+        } else {
+            log_warning("late_init: Failed to get serial number from device tree\n");
+            status = 1;
+        }
+    }

 	if (status)
 		log_warning("late_init: Failed to set run time variables\n");

@ktrinh-anduril
Copy link
Author

made a PR: AsahiLinux/u-boot#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant