From: Gerd Hoffmann <kraxel@suse.de>
To: Kalev Lember <kalev@smartlink.ee>
Cc: linux-kernel@vger.kernel.org
Subject: Re: kexec and framebuffer
Date: Mon, 17 Jul 2006 16:29:07 +0200 [thread overview]
Message-ID: <44BB9EB3.9020101@suse.de> (raw)
In-Reply-To: <44BB9A7A.4060100@smartlink.ee>
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
Hi,
> I am wondering what would be the preferred method to extract screen_info
> from running kernel. Should this be made available from sysfs or maybe a
> new system call be created?
Simply ask /dev/fb0?
Patch for kexec tools attached.
cheers,
Gerd
--
Gerd Hoffmann <kraxel@suse.de>
http://www.suse.de/~kraxel/julika-dora.jpeg
[-- Attachment #2: kexec-vesafb.diff --]
[-- Type: text/x-patch, Size: 2480 bytes --]
Index: kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c
===================================================================
--- kexec-tools-1.101.orig/kexec/arch/i386/x86-linux-setup.c 2006-03-03 10:51:31.000000000 +0100
+++ kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c 2006-03-10 14:02:20.000000000 +0100
@@ -24,6 +24,8 @@
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/fb.h>
#include <unistd.h>
#include <x86/x86-linux.h>
#include "../../kexec.h"
@@ -94,6 +96,56 @@ void setup_linux_bootloader_parameters(
cmdline_ptr[cmdline_len - 1] = '\0';
}
+int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
+{
+ struct fb_fix_screeninfo fix;
+ struct fb_var_screeninfo var;
+ int fd;
+
+ fd = open("/dev/fb0", O_RDONLY);
+ if (-1 == fd)
+ return -1;
+
+ if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, &fix))
+ goto out;
+ if (-1 == ioctl(fd, FBIOGET_VSCREENINFO, &var))
+ goto out;
+ if (0 != strcmp(fix.id, "vesafb"))
+ goto out;
+ close(fd);
+
+ real_mode->orig_video_isVGA = 0x23 /* VIDEO_TYPE_VLFB */;
+ real_mode->lfb_width = var.xres;
+ real_mode->lfb_height = var.yres;
+ real_mode->lfb_depth = var.bits_per_pixel;
+ real_mode->lfb_base = fix.smem_start;
+ real_mode->lfb_linelength = fix.line_length;
+ real_mode->vesapm_seg = 0;
+
+ /* fixme: better get size from /proc/iomem */
+ real_mode->lfb_size = (fix.smem_len + 65535) / 65536;
+ real_mode->pages = (fix.smem_len + 4095) / 4096;
+
+ if (var.bits_per_pixel > 8) {
+ real_mode->red_pos = var.red.offset;
+ real_mode->red_size = var.red.length;
+ real_mode->green_pos = var.green.offset;
+ real_mode->green_size = var.green.length;
+ real_mode->blue_pos = var.blue.offset;
+ real_mode->blue_size = var.blue.length;
+ real_mode->rsvd_pos = var.transp.offset;
+ real_mode->rsvd_size = var.transp.length;
+ }
+ fprintf(stderr, "%s: %dx%dx%d @ %lx +%lx\n", __FUNCTION__,
+ var.xres, var.yres, var.bits_per_pixel,
+ fix.smem_start, fix.smem_len);
+ return 0;
+
+ out:
+ close(fd);
+ return -1;
+}
+
void setup_linux_system_parameters(struct x86_linux_param_header *real_mode,
unsigned long kexec_flags)
{
@@ -111,6 +163,7 @@ 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);
/* Fill in the memsize later */
real_mode->ext_mem_k = 0;
next prev parent reply other threads:[~2006-07-17 14:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-17 14:11 kexec and framebuffer Kalev Lember
2006-07-17 14:29 ` Gerd Hoffmann [this message]
2006-07-20 20:42 ` Kalev Lember
2006-07-20 23:28 ` Antonino A. Daplas
2006-07-21 6:54 ` Gerd Hoffmann
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=44BB9EB3.9020101@suse.de \
--to=kraxel@suse.de \
--cc=kalev@smartlink.ee \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.