From: Petr Tesarik <PTesarik@suse.com>
To: Vasily Gorbik <gor@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Philipp Rudo <prudo@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Laura Abbott" <labbott@redhat.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
Raymund Will <rw@suse.com>
Subject: Re: [PATCH] s390: enable detection of kernel version from bzImage
Date: Tue, 16 Jul 2019 10:30:14 +0000 [thread overview]
Message-ID: <20190716123006.2d426ec8@ezekiel.suse.cz> (raw)
In-Reply-To: <patch.git-94e9726bbfe5.your-ad-here.call-01563228538-ext-5706@work.hours>
On Tue, 16 Jul 2019 00:12:19 +0200
Vasily Gorbik <gor@linux.ibm.com> wrote:
> Extend "parmarea" to include an offset of the version string, which is
> stored as 8-byte big endian value.
>
> To retrieve version string from bzImage reliably, one should check the
> presence of "S390EP" ascii string at 0x10008 (available since v3.2),
> then read the version string offset from 0x10428 (which has been 0
> since v3.2 up to now). The string is null terminated.
>
> Could be retrieved with the following "file" command magic (requires
> file v5.34):
> 8 string \x02\x00\x00\x18\x60\x00\x00\x50\x02\x00\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40\x40\x40\x40\x40 Linux S390
> >0x10008 string S390EP
> >>0x10428 bequad >0
> >>>(0x10428.Q) string >\0 \b, version %s
>
> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This looks great! Much cleaner than the original approach.
Thank you,
Petr T
> ---
> arch/s390/boot/Makefile | 2 +-
> arch/s390/boot/head.S | 1 +
> arch/s390/boot/version.c | 6 ++++++
> arch/s390/include/asm/setup.h | 4 +++-
> 4 files changed, 11 insertions(+), 2 deletions(-)
> create mode 100644 arch/s390/boot/version.c
>
> diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
> index 7cba96e7587b..4cf0bddb7d92 100644
> --- a/arch/s390/boot/Makefile
> +++ b/arch/s390/boot/Makefile
> @@ -36,7 +36,7 @@ CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
>
> obj-y := head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o
> obj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
> -obj-y += ctype.o text_dma.o
> +obj-y += version.o ctype.o text_dma.o
> obj-$(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) += uv.o
> obj-$(CONFIG_RELOCATABLE) += machine_kexec_reloc.o
> obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
> diff --git a/arch/s390/boot/head.S b/arch/s390/boot/head.S
> index 028aab03a9e7..2087bed6e60f 100644
> --- a/arch/s390/boot/head.S
> +++ b/arch/s390/boot/head.S
> @@ -361,6 +361,7 @@ ENTRY(startup_kdump)
> .quad 0 # INITRD_SIZE
> .quad 0 # OLDMEM_BASE
> .quad 0 # OLDMEM_SIZE
> + .quad kernel_version # points to kernel version string
>
> .org COMMAND_LINE
> .byte "root=/dev/ram0 ro"
> diff --git a/arch/s390/boot/version.c b/arch/s390/boot/version.c
> new file mode 100644
> index 000000000000..ea5e49651931
> --- /dev/null
> +++ b/arch/s390/boot/version.c
> @@ -0,0 +1,6 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <generated/utsrelease.h>
> +#include <generated/compile.h>
> +
> +const char kernel_version[] = UTS_RELEASE
> + " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " UTS_VERSION;
> diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
> index 925889d360c1..e5d28a475f76 100644
> --- a/arch/s390/include/asm/setup.h
> +++ b/arch/s390/include/asm/setup.h
> @@ -54,6 +54,7 @@
> #define INITRD_SIZE_OFFSET 0x10410
> #define OLDMEM_BASE_OFFSET 0x10418
> #define OLDMEM_SIZE_OFFSET 0x10420
> +#define KERNEL_VERSION_OFFSET 0x10428
> #define COMMAND_LINE_OFFSET 0x10480
>
> #ifndef __ASSEMBLY__
> @@ -74,7 +75,8 @@ struct parmarea {
> unsigned long initrd_size; /* 0x10410 */
> unsigned long oldmem_base; /* 0x10418 */
> unsigned long oldmem_size; /* 0x10420 */
> - char pad1[0x10480 - 0x10428]; /* 0x10428 - 0x10480 */
> + unsigned long kernel_version; /* 0x10428 */
> + char pad1[0x10480 - 0x10430]; /* 0x10430 - 0x10480 */
> char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */
> };
>
next prev parent reply other threads:[~2019-07-16 10:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 17:20 [PATCH 0/2] Add uncompressed Linux banner to s390 bzImage Petr Tesarik
2019-07-12 17:21 ` [PATCH 1/2] init: Separate banner from init_uts_ns Petr Tesarik
2019-07-12 17:21 ` [PATCH 2/2] s390: add Linux banner to the compressed image Petr Tesarik
2019-07-14 14:35 ` Vasily Gorbik
2019-07-14 15:52 ` Petr Tesarik
2019-07-15 22:05 ` Vasily Gorbik
2019-07-15 22:12 ` [PATCH] s390: enable detection of kernel version from bzImage Vasily Gorbik
2019-07-16 10:30 ` Petr Tesarik [this message]
2019-07-16 13:11 ` Vasily Gorbik
2019-07-16 15:10 ` Petr Tesarik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190716123006.2d426ec8@ezekiel.suse.cz \
--to=ptesarik@suse.com \
--cc=borntraeger@de.ibm.com \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=prudo@linux.ibm.com \
--cc=rw@suse.com \
--cc=tglx@linutronix.de \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®