Linux boot - stop the kernel switching to a new framebuffer mode clearing output

5,775

It seems that finally I've reached a reasonable framebuffer configuration. These are the relevant settings inside my kernel .config:

CONFIG_AGP=y
CONFIG_AGP_INTEL=y
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
CONFIG_FIRMWARE_EDID=y
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_VESA=y
CONFIG_VGA_CONSOLE=y
CONFIG_VGACON_SOFT_SCROLLBACK=y
CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=640
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_LOGO=y
CONFIG_LOGO_LINUX_MONO=y
CONFIG_LOGO_LINUX_VGA16=y
CONFIG_LOGO_LINUX_CLUT224=y

and this is the diff between the old and the new framebuffer configuration:

#> diff oldcfg.txt newcfg.txt
--- oldcfg.txt  2012-10-01 17:30:01.000000000 +0200
+++ newcfg.txt  2012-10-01 17:29:43.000000000 +0200
@@ -2,20 +2,14 @@
 CONFIG_AGP_INTEL=y
 CONFIG_VGA_ARB=y
 CONFIG_VGA_ARB_MAX_GPUS=16
-CONFIG_DRM=y
-CONFIG_DRM_KMS_HELPER=y
-CONFIG_DRM_I915=y
-CONFIG_DRM_I915_KMS=y
 CONFIG_VIDEO_OUTPUT_CONTROL=y
 CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
 CONFIG_FB_BOOT_VESA_SUPPORT=y
 CONFIG_FB_CFB_FILLRECT=y
 CONFIG_FB_CFB_COPYAREA=y
 CONFIG_FB_CFB_IMAGEBLIT=y
-CONFIG_FB_MODE_HELPERS=y
 CONFIG_FB_VESA=y
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_VGA_CONSOLE=y
 CONFIG_VGACON_SOFT_SCROLLBACK=y
 CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=640

This configuration produces a Knoppix-like boot output. I still don't understand who or what clears the screen just before the login prompt appears, but I'm quite satisfied for now. I'll update this answer if I'll be able to pinpoint the culprit.

EDIT: found the (two) culpright(s).

After hours of googling, I found the solution in this thread and this question. This procedure works for Ubuntu 12.04.1 LTS as also described here, but it should not differ too much for other distributions.

First, add console=tty1 to your GRUB_CMDLINE_LINUX (I also suggest to add noplymouth to inhibit plymouth and its useless splashscreen).

#> sudo vi /etc/default/grub

GRUB_CMDLINE_LINUX="console=tty1 noplymouth"

This forces the kernel log to be printed on tty1 instead of tty7 and avoid the tty switch before the login prompt.

Then just go into /etc/init and edit one or more of tty1.conf, tty2.conf, tty3.conf, tty4.conf, tty5.conf, tty6.conf or console.conf. I edited them all adding --noclear option to the getty command. For example, editing tty1.conf:

#> sudo vi /etc/init/tty1.conf

you'll have to replace:

respawn
exec /sbin/getty -8 38400 tty1

with:

respawn
exec /sbin/getty -8 38400 --noclear tty1

That's all, now your system should boot in a single tty without clearing it.

Share:
5,775

Related videos on Youtube

Avio
Author by

Avio

Updated on September 18, 2022

Comments

  • Avio
    Avio almost 2 years

    I'm working on an embedded system (based onUbuntu 12.04 LTS) and I'm customizing its kernel. I'm having some problem with upstart, mountall and plymouth. Nothing unsolvable I suppose, but the real problem is that I can't diagnose properly what's going on because the kernel (or maybe plymouth) changes the video mode in the middle of the boot process. This completely wipes entire lines of log and prevents any debugging of kernel misconfigurations.

    My Grub2 config seems to be ok with:

    GRUB_CMDLINE_LINUX=""
    GRUB_CMDLINE_LINUX_DEFAULT="acpi=force noplymouth"
    
    GRUB_GFXMODE=1024x768x32
    GRUB_GFXPAYLOAD_LINUX=keep
    

    Here is some relevant output of lspci:

    00:00.0 Host bridge: Intel Corporation Mobile 945GSE Express Memory Controller Hub (rev 03)
    00:02.0 VGA compatible controller: Intel Corporation Mobile 945GSE Express Integrated Graphics Controller (rev 03)
    00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
    

    And here is the relevant portion of my kernel configuration:

    CONFIG_AGP=y
    CONFIG_AGP_INTEL=y
    CONFIG_VGA_ARB=y
    CONFIG_VGA_ARB_MAX_GPUS=16
    CONFIG_DRM=y
    CONFIG_DRM_KMS_HELPER=y
    CONFIG_DRM_I915=y
    CONFIG_DRM_I915_KMS=y
    CONFIG_VIDEO_OUTPUT_CONTROL=y
    CONFIG_FB=y
    CONFIG_FB_BOOT_VESA_SUPPORT=y
    CONFIG_FB_CFB_FILLRECT=y
    CONFIG_FB_CFB_COPYAREA=y
    CONFIG_FB_CFB_IMAGEBLIT=y
    CONFIG_FB_MODE_HELPERS=y
    CONFIG_FB_VESA=y
    CONFIG_BACKLIGHT_LCD_SUPPORT=y
    CONFIG_BACKLIGHT_CLASS_DEVICE=y
    CONFIG_VGA_CONSOLE=y
    CONFIG_VGACON_SOFT_SCROLLBACK=y
    CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=640
    CONFIG_DUMMY_CONSOLE=y
    CONFIG_FRAMEBUFFER_CONSOLE=y
    CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
    CONFIG_FONT_8x8=y
    CONFIG_FONT_8x16=y
    CONFIG_LOGO=y
    CONFIG_LOGO_LINUX_MONO=y
    CONFIG_LOGO_LINUX_VGA16=y
    CONFIG_LOGO_LINUX_CLUT224=y
    

    Every other custom/stock kernel boot fine with that Grub2 config. What I would like to have is a single flow of messages on a single console (retaining one screen resolution) from the bootup logo till the login prompt. Does anybody know what I have to tweak to achieve this?