Since coreboot v4 you can configure VGA initialization in Kconfig. For older versions of coreboot check the history of this page.

−

You need to enable two CONFIG options in your Mainboard Option.lb

+

First do:

<source lang="bash">

<source lang="bash">

−

# VGA Console

+

$ make menuconfig

−

option CONFIG_CONSOLE_VGA=1

−

option CONFIG_PCI_ROM_RUN=1

</source>

</source>

−

'''CONFIG_PCI_ROM_RUN''' will use the embedded x86 emulator to run the BIOS image in the expansion ROM of a PCI device.

+

Then go

−

'''CONFIG_CONSOLE_VGA''' will redirect console messages to the VGA screen once VGA card is initialized.

+

Chipset --->

+

[*] Setup bridges on path to VGA adapter

+

[*] Run VGA option ROMs

+

Option ROM execution type (Native mode) --->

−

For add-on (PCI/PCIe/PCI-X/AGP) VGA cards, you don't have to do anything else besides these two CONFIG options.

+

Alternatively you can choose the "Secure mode" to run the VGA option rom in a contained environment.

−

If your mainboard has an on-board VGA chip and you insert another VGA add-on card, the add-on

−

VGA card will be used instead of the on-board VGA chip.

−

== On-board Video Devices ==

+

If you have no on-board graphics, you are done configuring coreboot at this point. You may exit configuration, and run make to get your VGA enabled coreboot image.

−

If you want to use the onboard VGA chip, you have to add the following options in addition to the CONFIG options described above.

+

=== On-board Video Devices ===

−

=== Mainboard Configuration ===

+

If you run coreboot on a system with on-board graphics, you have to embed a VGA on the top level, enter the file name of your option rom and the PCI ID of the associated graphics device in the form <vendor_id>,<device_id>:

−

1. In the mainboard's Config.lb (./src/mainboard/<mfg>/<board>/Config.lb) You need to specify the device number for your on-board VGA and the address that the video bios will show up at in the system.

+

VGA BIOS --->

+

[*] Add a VGA BIOS image

+

(oprom-0.rom) VGA BIOS path and filename

+

(8086,27a2) VGA device PCI IDs

−

<source lang = bash>

+

That's it, exit configuration, and run make to get your VGA enabled coreboot image.

−

device pci 9.0 on # PCI

−

chip drivers/pci/onboard

−

device pci 9.0 on end

−

register "rom_address" = "0xfff80000" #512k image

−

#register "rom_address" = "0xfff00000" #1M image

−

end

−

end

−

</source>

−

Replace the 9.0 with the dev.fn of your vga device. You can find this number by doing a 'lspci' from the board booted under linux.

+

== How to retrieve a good video bios ==

−

Please make sure the device number is correct. Otherwise the config code can not compute the proper ROM address.

+

=== RECOMMENDED: Extracting from your vendor bios image ===

−

==== How to compute the "rom_address" value ====

+

The recommended method is to take your mainboard vendor's BIOS image and extract the VGA BIOS using a tool called [[bios_extract]].

Now you can check the option roms (oprom_?.rom) with the tool romheaders which is part of the [http://openbios.info/FCode_Suite FCode Suite]:

−

=== Target Configuration ===

+

$ romheaders oprom_0.rom

+

+

Image 1:

+

PCI Expansion ROM Header:

+

Signature: 0x55aa (Ok)

+

CPU unique data: 0x48 0xeb 0x7b 0x01 0x76 0x00 0x00 0x00

+

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

+

Pointer to PCI Data Structure: 0x017c

+

+

PCI Data Structure:

+

Signature: 0x50434952 'PCIR' (Ok)

+

Vendor ID: 0x1002

+

Device ID: 0x4752

+

Vital Product Data: 0x0000

+

PCI Data Structure Length: 0x0018 (24 bytes)

+

PCI Data Structure Revision: 0x00

+

Class Code: 0x030000 (VGA Display controller)

+

Image Length: 0x0048 blocks (36864 bytes)

+

Revision Level of Code/Data: 0x0421

+

Code Type: 0x00 (Intel x86)

+

Last-Image Flag: 0x80 (last image in rom)

+

Reserved: 0x0000

+

+

Platform specific data for x86 compliant option rom:

+

Initialization Size: 0x48 (36864 bytes)

+

Entry point for INIT function: 0x80

−

2. You still need to modify your target 'Config.lb' to reserve space for the additional video bios. Reduce the size of your coreboot image by the size of the video bios. You will prepend the video bios to the coreboot image in step 3.

There are sites that have video bios roms on their website. (I know of this one for nvidia cards: [http://whitebunny.demon.nl/hardware/chipset_nvidia.html])

−

romimage "normal"

−

# 48K for SCSI FW or ATI ROM

−

option ROM_SIZE = 475136

−

</source>

−

or if you only have a "fallback" boot then use the "fallback" section instead.

+

For Intel onboard graphics you can download the vbios(vga bios) from Intel's download section. The vbios is included with some versions of the graphics driver. The summary will say something like "NOTE:These materials are intended for use by developers.Includes VBIOS". The actual vbios file is the *.dat file included with the graphics driver.

−

In the above example the bios chip is 512Kb part. The video bios is 48Kb. So (512*1024)-(48*1024) = 475136.

+

=== Extracting from the system (if everything else fails) ===

−

=== Creating an Image ===

+

However you might be able to retrieve your on-board video bios with Linux as well.

−

−

3. Finally, prepend your video bios to the coreboot.rom

+

* Boot up a machine with a commercial bios (not coreboot) with the video card you wish to work under coreboot.

+

* You can see where and how much your card's bios is using by doing a

+

<source lang="bash">cat /proc/iomem | grep 'Video ROM'</source>

+

* From the command line enter:<br /><source lang="bash">dd if=/dev/mem of=vgabios.bin bs=1k count=64 skip=768</source> This assumes you card's bios is cached at 0xc0000, and is 64K long.

You need to make sure the final_coreboot.rom size is the size of your ROM chip. Normally 256kb, 512kb, or 1024Kb.

−

−

dd is helpfull to get your <videobios.bin> when booted under the factory BIOS.

−

−

−

= VGA initialization in coreboot v3 =

−

−

In coreboot v3 you have to set your PCI option ROM execution method under the '''Device''' menu. The default is x86emu. To get a smaller (and slightly more insecure) version, you can switch to vm86. If you don't want option rom execution, set it to Disabled.

−

−

== On-board devices ==

−

−

To add option roms for on-board video cards to your coreboot image, you can just add the image using lar:

−

−

<source lang="bash">

−

lar -C lzma -a coreboot.rom vgabios.rom:pciXXXX,YYYY.rom

−

</source>

−

−

In the above example, vgabios.rom is the name of your option rom on disk. XXXX is the PCI vendor ID of your on-board video adapter and YYYY is its PCI device ID.

−

−

= How to retrieve a good video bios =

−

−

== Extracting from your vendor bios image ==

−

−

The recommended method is to take your mainboard vendor's BIOS image and extract the VGA BIOS using a tool called awardeco/amideco/phnxdeco. This is the most reliable way:

−

* You are guaranteed to get an image that fits to your onboard VGA

−

* Even if your VGA BIOS uses self-modifying code you get a correct image

−

−

== Downloading ==

−

−

There are sites that have video bios roms on their website. (I know of this one for nvidia cards: [http://whitebunny.demon.nl/hardware/chipset_nvidia.html])

−

−

== Extracting from the system ==

−

−

However you should be able to retrieve your own video bios as well with linux.

−

* Boot up a machine with a commercial bios (not coreboot) with the video card you wish to work under coreboot.

−

* From the command line enter:<br /><code>dd if=/dev/mem of=vgabios.bin skip=1536 count=128 or <br />dd if=/dev/mem of=vgabios.bin bs=1k count=64 skip=768<br />This assumes you card's bios is cached at 0xc0000, and is 64K long. You<br />can see where and how much your card's bios is using by<br />doing a cat iomem | grep "Video ROM"<br /></code>

Alternatively you can choose the "Secure mode" to run the VGA option rom in a contained environment.

If you have no on-board graphics, you are done configuring coreboot at this point. You may exit configuration, and run make to get your VGA enabled coreboot image.

On-board Video Devices

If you run coreboot on a system with on-board graphics, you have to embed a VGA on the top level, enter the file name of your option rom and the PCI ID of the associated graphics device in the form <vendor_id>,<device_id>:

Downloading

There are sites that have video bios roms on their website. (I know of this one for nvidia cards: [1])

For Intel onboard graphics you can download the vbios(vga bios) from Intel's download section. The vbios is included with some versions of the graphics driver. The summary will say something like "NOTE:These materials are intended for use by developers.Includes VBIOS". The actual vbios file is the *.dat file included with the graphics driver.

Extracting from the system (if everything else fails)

However you might be able to retrieve your on-board video bios with Linux as well.

Boot up a machine with a commercial bios (not coreboot) with the video card you wish to work under coreboot.

You can see where and how much your card's bios is using by doing a

cat/proc/iomem |grep'Video ROM'

From the command line enter:

ddif=/dev/mem of=vgabios.bin bs=1k count=64skip=768

This assumes you card's bios is cached at 0xc0000, and is 64K long.

ddif=/dev/mem of=video.bios.bin.4 bs=65536count=1skip=12

This works for many of the VIA Epia boards.
Alternatively you can automatically generate it using this nice script from Peter Stuge: