[PATCH v3 02/12] buildid: Stash away kernels build ID on init

Jessica Yu jeyu at kernel.org
Thu Apr 8 13:05:33 BST 2021


+++ Stephen Boyd [30/03/21 20:05 -0700]:
[snipped]
>diff --git a/lib/buildid.c b/lib/buildid.c
>index 010ab0674cb9..b939bbc59233 100644
>--- a/lib/buildid.c
>+++ b/lib/buildid.c
>@@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0
>
> #include <linux/buildid.h>
>+#include <linux/cache.h>
> #include <linux/elf.h>
> #include <linux/kernel.h>
> #include <linux/pagemap.h>
>@@ -171,3 +172,19 @@ int build_id_parse_buf(const void *buf, unsigned char *build_id, u32 buf_size)
> {
> 	return parse_build_id_buf(build_id, NULL, buf, buf_size);
> }
>+
>+unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX] __ro_after_init;
>+
>+/**
>+ * init_vmlinux_build_id - Get the running kernel's build ID
>+ *
>+ * Return: Running kernel's build ID
>+ */

Hm, init_vmlinux_build_id() doesn't return anything, so this comment is
not accurate - maybe "Get the running kernel's build ID and store it in
vmlinux_build_id"?

>+void __init init_vmlinux_build_id(void)
>+{
>+	extern const void __start_notes __weak;
>+	extern const void __stop_notes __weak;
>+	unsigned int size = &__stop_notes - &__start_notes;
>+
>+	build_id_parse_buf(&__start_notes, vmlinux_build_id, size);
>+}



More information about the kexec mailing list