commit:     9f21085d6393371fd90f3f0debb87fdd5df8c5ef
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  7 09:45:45 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Thu Jul  8 00:08:18 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f21085d

kernel-install.eclass: print uname() info after test

Closes: https://github.com/gentoo/gentoo/pull/21549
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 eclass/kernel-install.eclass | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 4914a756281..e6b9cbe45c0 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -184,13 +184,26 @@ kernel-install_create_init() {
 
        cat <<-_EOF_ >"${T}/init.c" || die
                #include <stdio.h>
+               #include <sys/utsname.h>
+
                int main() {
+                       struct utsname u;
+                       int ret = uname(&u);
+                       if (ret != 0) {
+                               printf("uname() failed, but that's fine\n");
+                       }
+                       else {
+                               // Booted: Linux 5.10.47 ppc64le #1 SMP Fri Jul 
2 12:55:24 PDT 2021
+                               printf("Booted: %s %s %s %s\n", u.sysname, 
u.release,
+                                               u.machine, u.version);
+                       }
+
                        printf("Hello, World!\n");
                        return 0;
                }
        _EOF_
 
-       $(tc-getBUILD_CC) -Os -static "${T}/init.c" -o "${output}" || die 
+       $(tc-getBUILD_CC) -Os -static "${T}/init.c" -o "${output}" || die
        $(tc-getBUILD_STRIP) "${output}" || die
 }
 

Reply via email to