UbuntuFramebuffer Study Notes

Source: Internet
Author: User
I. Environment Setup 1. run Framebuffer directly on Ubuntu. By default, Ubuntu directly enters the X Window. To use Framebuffer, You need to modify the kernel boot parameters: $ sudogedit/etc/default/grub find GRUB_CMDLINE_LINUX_DEFAULT = "quietsplash" and change it to GRUB_CMDLINE_LINUX_DEFAULT = "q

I. Environment Construction

1. Run Framebuffer directly on Ubuntu

By default, Ubuntu directly enters XWindowsIf you want to use Framebuffer,

You need to modify the kernel boot parameters:

$ Sudo gedit/etc/default/grub

Search

GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash"

Change it

GRUB_CMDLINE_LINUX_DEFAULT = "quiet splash text vga = 0x311"

Text indicates entering the text mode, while vga = 0x311 indicates using the Framebuffer display driver,

0x311 is a parameter indicating the color depth and resolution.

| 640x480 800x600 1024x768 1280x1024

---- + -------------------------------------

256 | 0x301 0x303 0x305 0x307

32 k | 0x310 0x313 0x316 0x319

64 k | 0x311 0x314 0x317 0x31A

16 M | 0x312 0x315 0x318 0x31B

If you use the vga = 0x311 parameter, you must use the vesafb module mentioned later and remove the blacklist,

Otherwise, you cannot enter the system. You need to enable the optical disc to delete the vga parameter to restore it.

$ Sudo update-grub

Write to/boot/grub. cfg

$ Sudo gedit/etc/initramfs-tools/modules

Add: vesafb

$ Sudo gedit/etc/modprobe. d/blacklist-framebuffer.conf

Use # To comment out the following lines

# Blacklist vesafb

$ Sudo update-initramfs-u

(Generate a new initrd)

Then restart the machine to enter the Framebuffer

If you want to switch back to X11, you can enter:

$ Startx

Sometimes the boot parameters of/boot/grub. cfg are incorrect, leading to system failure,

You can use a CD boot system to mount the hard disk and then directly modify the/boot/grub. cfg file.

In this way, you can skip the update-grub step. Then restore the original boot parameters to the X Window

2. Use qemu virtual Linux

You need to compile the Linux kernel and busybox.

Libncurses-dev and qemu are also required.

Because qemu can directly load the kernel and initrd, specify the boot parameters,

Therefore, you do not need to modify the grub configuration.

(1) Compile the kernel and install qemu

$ Tar xjf linux-2.6.39.2.tar.bz2

$ Cd linux-2.6.39.2/

$ Make help

$ Make i386_defconf

$ Sudo apt-get install libncurses-dev

$ Make menuconfig

$ Make

$ Sudo apt-get install qemu

$ Qemu -- help

$ Qemu-kernel arch/x86/boot/bzImage

$ Qemu-kernel arch/x86/boot/bzImage-append "noapic"

Sometimes the kernel crashes like this:

MP-BIOS BUG 8254 timer not connected

Trying to set up timer as Virtual Wire IRQ

Therefore, you must add the-append "noapic" parameter.

(2) modify the Kernel configuration and re-compile the kernel.

Note that different kernel versions have different configurations,

Change the Kernel configuration as follows (switch to * with spaces instead of M ):

$ Make menuconfig

Device Drivers --->

Graphics support --->

-*-Support for frame buffer devices --->

[*] Vesa vga graphics support

Because VESA supports color-depth display.

It is not selected by default and can only be a black/white console.

Input device support --->

[*] Provide legacy/dev/psaux device

Some libraries, such as SDL, search for/dev/input/mice and/dev/psaux when identifying USB interfaces with the mouse,

I found that the compiled kernel does not have the former, so I used this option to create a/dev/psaux device.

File systems --->

[*] Miscellaneous filesystems --->

<*> Compressed ROM file system support (cramfs)

I personally like cramfs, but it is not necessary. You can use this switch to compile the cramfs driver,

Test whether initramfs is normal

General setup --->

[*] Support initial ramdisks compressed using gzip

[*] Embedded system

By default, the configuration of the i86 kernel does not support gzip compressed cpio format initrd, so you need to manually open it.

Finally, re-compile the kernel:

$ Make

(3) Compile busybox

$ Tar xjf busybox-1.18.5.tar.bz2

$ Cd busybox-1.18.5/

$ Make defconfig

$ Make menuconfig

The settings are modified as follows:

Busybox Settings --->

Build Options --->

[*] Build BusyBox as a static binary (no shared libs)

$ Make

$ Make install

The default file is installed in the _ install directory of the current directory.

(4) Make the cpio package gzip compressed initrd

$ Cd ../busybox-1.18.5/_ install/

$ Mkdir proc sys dev etc/init. d tmp root usr lib

$ Gedit etc/init. d/rcS

#! /Bin/sh

Mount-t proc none/proc

Mount-t sysfs none/sys

/Sbin/mdev-s

$ Chmod + x etc/init. d/rcS

$ Cd.../linux-2.6.39.2/

$ Gedit prerun. sh

#! /Bin/sh

Cd ../busybox-1.18.5/_ install

Find. | cpio-o -- format = newc>.../rootfs. img

Cd ..

Gzip-c rootfs. img> rootfs.img.gz

Cd ../linux-2.6.39.2/

$. Prerun. sh

$ Gedit run. sh

#! /Bin/sh

Qemu-kernel. /arch/i386/boot/bzImage-initrd .. /busybox-1.18.5/rootfs.img.gz-append "root =/dev/ram rdinit =/sbin/init vga = 0x312 noapic"

Note that rdinit = is used here. If init = is used, it becomes initramfs (the kernel will report that the appropriate file system cannot be found)

For the vga = parameter settings, see the previous section (determine the color depth and resolution)

$. Run. sh

Compile the program, and then package rootfs.img.gz with prerun.shwritten by ghost, and run. sh to run qemu.

If the program is a dynamic link and requires a specific dynamic library,

You can copy the dependent dynamic library to the _ install/libdirectory and package it to rootfs.img.gz.

(5) The effect of qemu entry is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.