From: Dave Young <dyoung@redhat.com>
To: Simon Horman <horms@verge.net.au>
Cc: kexec@lists.infradead.org
Subject: [PATCH kexec-tools] x86: use old screen_info if needed
Date: Sun, 28 Jan 2018 13:52:31 +0800 [thread overview]
Message-ID: <20180128055231.GA1744@dhcp-128-65.nay.redhat.com> (raw)
With modern drm/kms graphic driver kexec-tools does not setup screen_info
correctly so one will only see screen output after those drm drivers
reinitializing after rebooting. Copying the old screen info from original
boot_params will help during my test, although it could not work for some
potential cases, but it is not worse than before. This has been used in
the kernel kexec_file_load.
Signed-off-by: Dave Young <dyoung@redhat.com>
---
kexec/arch/i386/x86-linux-setup.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
--- kexec-tools.orig/kexec/arch/i386/x86-linux-setup.c
+++ kexec-tools/kexec/arch/i386/x86-linux-setup.c
@@ -27,6 +27,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
+#include <linux/screen_info.h>
#include <unistd.h>
#include <dirent.h>
#include <mntent.h>
@@ -122,7 +123,7 @@ void setup_linux_bootloader_parameters_h
cmdline_ptr[cmdline_len - 1] = '\0';
}
-int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
+static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
{
struct fb_fix_screeninfo fix;
struct fb_var_screeninfo var;
@@ -826,6 +827,8 @@ out:
void setup_linux_system_parameters(struct kexec_info *info,
struct x86_linux_param_header *real_mode)
{
+ int err;
+
/* get subarch from running kernel */
setup_subarch(real_mode);
if (bzImage_support_efi_boot && !arch_options.noefi)
@@ -841,8 +844,22 @@ void setup_linux_system_parameters(struc
real_mode->orig_video_ega_bx = 0;
real_mode->orig_video_isVGA = 1;
real_mode->orig_video_points = 16;
- setup_linux_vesafb(real_mode);
+ /* setup vesa fb if possible, or just use original screen_info */
+ err = setup_linux_vesafb(real_mode);
+ if (err) {
+ uint16_t cl_magic, cl_offset;
+
+ /* save and restore the old cmdline param if needed */
+ cl_magic = real_mode->cl_magic;
+ cl_offset = real_mode->cl_offset;
+
+ err = get_bootparam(real_mode, 0, sizeof(struct screen_info));
+ if (!err) {
+ real_mode->cl_magic = cl_magic;
+ real_mode->cl_offset = cl_offset;
+ }
+ }
/* Fill in the memsize later */
real_mode->ext_mem_k = 0;
real_mode->alt_mem_k = 0;
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next reply other threads:[~2018-01-28 5:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-28 5:52 Dave Young [this message]
2018-01-29 7:21 ` [PATCH kexec-tools] x86: use old screen_info if needed Simon Horman
2018-01-29 7:59 ` Dave Young
2018-01-29 9:04 ` Simon Horman
2018-01-29 9:16 ` Dave Young
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=20180128055231.GA1744@dhcp-128-65.nay.redhat.com \
--to=dyoung@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).