Board:tyan/s2891: Difference between revisions

From coreboot
Jump to navigation Jump to search
Line 198: Line 198:
Skip this section if you don't need VGA support in your coreboot.
Skip this section if you don't need VGA support in your coreboot.


The S2891 VGA BIOS is 36K long. The last 4KB are not available in RAM after boot (with the proprietary BIOS), however, so we can ''not'' use this method to extract the VGA BIOS:
Download the latest proprietary BIOS for the S2891 from the Tyan website:
 
  While booted with your proprietary BIOS, you can see where your vga bios starts
  and how much space it takes by issuing
    <code>cat /proc/iomem | grep "Video ROM"</code>
  Then get a copy of your vga bios.
    <code>dd if=/dev/mem of=vgabios.bin bs=1k count=32 skip=768</code>
  Our vga bios is 32K. Verify that the image is correct - it should start with 55 AA,
  and contain strings that indicate it's your VGA bios. You should be able to clearly
  make out 'ATI RAGE' etc.
 
So this does not work - the last 4K is missing. Thankfully, Anton Borisov has some tools that can extract the VGA BIOS &mdash; and other option ROMs, in fact &mdash; from the BIOS images that Tyan offers on its website.
 
You can download the tool for Phoenix here:
 
  http://www.kaos.ru/biosgfx/download/PhoenixDeco_0.33.src.tar.gz
 
Then download the latest proprietary BIOS for the S2891 from the Tyan website:


   http://www.tyan.com/support_download_bios.aspx?model=S.S2891
   http://www.tyan.com/support_download_bios.aspx?model=S.S2891


Once you have the image, you can display its contents like this:
Follow the description on [[VGA support]]. But first you have to cut away the flash description of the BIOS image:
 
  ./phnxdeco 2891202T.wph -ls
 
That should show output like:
 
  -=PhoenixDeco, version 0.33 (Linux)=-
 
  Filelength      : 100756 (1050454 bytes)
  Filename        : ../2891202T.wph
  PhoenixBIOS hook found at      : F6FB0
  System Information at          : F6FFE
  BootBlock      : 7000 bytes
  BankSize        : 1024 KB
  Version        : DEVEL042
  Start          : F8BB5
  Offset          : F0000
  BCP Modules    : 80
  BCPFCP          : FCA73
  FCP 1st module  : 9DD5 (F9DD5)
  Released        : 30 November 2006 at 11:19:23
  /* Copyrighted Information */
          NAPI
  /* ----------------------- */
 
  ================================== MODULE MAP =================================
  Class Code
  . Instance
  . .
  C I    LEVEL      START      END    LENGTH  RATIO  LINK TO  FILEOFFSET
  ----  -----    ---------  ---------  ------  -----  ---------  ----------
  G  0    NONE    FFFF 8BB5  FFFF 8FFF    430    100%  FFFF 8048    F8BB5h
  D  0  LZINT    FFFF 8048  FFFF 8BB4    B52    70%  FFFF 7FDB    F8048h
  A  1  LZINT    FFFF 7FDB  FFFF 8047    52    70%  FFFF 7FBC    F7FDBh
  *  0    NONE    FFFF 7FBC  FFFF 7FDA      4    100%  FFFF 7BA3    F7FBCh
  B  0  LZINT    FFFF 7BA3  FFFF 7FBB    3FE      3%  FFFF 0E05    F7BA3h
  X  0    NONE    FFFF 0E05  FFFF 7BA1  6D82    100%  FFFE C525    F0E05h
  S  0  LZINT    FFFE C525  FFFF 0E04  48C5    46%  FFFE 8601    EC525h
  E  0  LZINT    FFFE 8601  FFFE C524  3F09    41%  FFFE 65D5    E8601h
  C  0    NONE    FFFE 65D5  FFFE 85FF  2010    100%  FFFE 0005    E65D5h
  X  1    NONE    FFFE 0005  FFFE 644F  6430    100%  FFFD A653    E0005h
  T  0  LZINT    FFFD A653  FFFE 0004  5997    42%  FFFD 365C    DA653h
  R  0  LZINT    FFFD 365C  FFFD A652  6FDC    58%  FFFC DAC1    D365Ch
  R  1  LZINT    FFFC DAC1  FFFD 365B  5B80    63%  FFFB 9ED0    CDAC1h
  R  2  LZINT    FFFB 9ED0  FFFC DAC0  13BD6    61%  FFFA 73D5    B9ED0h
  R  3  LZINT    FFFA 73D5  FFFB 9ECF  12AE0    98%  FFF9 48E0    A73D5h
  R  4  LZINT    FFF9 48E0  FFFA 73D4  12ADA    98%  FFF8 B14D    948E0h
  R  5  LZINT    FFF8 B14D  FFF9 48DF  9778    59%  FFF8 9830    8B14Dh
  L  0  LZINT    FFF8 9830  FFF8 B14C  1902      0%  FFF8 825D    89830h
  M  0  LZINT    FFF8 825D  FFF8 982F  15B8    64%  FFF8 5C92    8825Dh
  Q  0  LZINT    FFF8 5C92  FFF8 825C  25B0    41%  FFF7 F3D7    85C92h
  H  0    NONE    FFF7 F3D7  FFF8 5C91  68A0    100%  FFF7 DDF1    7F3D7h
  A  0  LZINT    FFF7 DDF1  FFF7 F3D6  15CB    38%  FFF7 766B    7DDF1h
  B  1  LZINT    FFF7 766B  FFF7 8D91  170C    25%  FFF6 F699    7766Bh
  B  2  LZINT    FFF6 F699  FFF7 766A  7FB7    73%  FFF6 5694    6F699h
  B  3  LZINT    FFF6 5694  FFF6 F698  9FEA    67%  FFF5 A1F3    65694h
  B  4  LZINT    FFF5 A1F3  FFF6 5693  B486    71%  FFF5 917A    5A1F3h
  B  5  LZINT    FFF5 917A  FFF5 A1F2  105E    68%  FFF5 8477    5917Ah
  B  6  LZINT    FFF5 8477  FFF5 9179    CE8    67%  0000 0000    58477h
  Total Sections: 28
 
Now extract all these parts:
 
  ./phnxdeco 2891202T.wph -xs
 
That will create a number of new files:


  -rw-r--r-- 1 ward ward  14643 2007-06-20 15:16 ACPI0.rom
  dd if=2891V203.wph of=2891V203.rom bs=1m count=1
  -rw-r--r-- 1 ward ward    116 2007-06-20 15:16 ACPI1.rom
  -rw-r--r-- 1 ward ward  28672 2007-06-20 15:16 bb.rom
  -rw-r--r-- 1 ward ward  33913 2007-06-20 15:16 BIOSCOD0.rom
  -rw-r--r-- 1 ward ward  22987 2007-06-20 15:16 BIOSCOD1.rom
  -rw-r--r-- 1 ward ward  44635 2007-06-20 15:16 BIOSCOD2.rom
  -rw-r--r-- 1 ward ward  60875 2007-06-20 15:16 BIOSCOD3.rom
  -rw-r--r-- 1 ward ward  64891 2007-06-20 15:16 BIOSCOD4.rom
  -rw-r--r-- 1 ward ward  6123 2007-06-20 15:16 BIOSCOD5.rom
  -rw-r--r-- 1 ward ward  4907 2007-06-20 15:16 BIOSCOD6.rom
  -rw-r--r-- 1 ward ward  1099 2007-06-20 15:16 DECOMPC0.rom
  -rw-r--r-- 1 ward ward  4128 2007-06-20 15:16 DISPLAY0.rom
  -rw-r--r-- 1 ward ward 787512 2007-06-20 15:16 LOGO0.rom
  -rw-r--r-- 1 ward ward  8576 2007-06-20 15:16 MISER0.rom
  -rw-r--r-- 1 ward ward  49152 2007-06-20 15:16 OPROM0.rom
  -rw-r--r-- 1 ward ward  36864 2007-06-20 15:16 OPROM1.rom
  -rw-r--r-- 1 ward ward 131072 2007-06-20 15:16 OPROM2.rom
  -rw-r--r-- 1 ward ward  77824 2007-06-20 15:16 OPROM3.rom
  -rw-r--r-- 1 ward ward  77824 2007-06-20 15:16 OPROM4.rom
  -rw-r--r-- 1 ward ward  65536 2007-06-20 15:16 OPROM5.rom
  -rw-r--r-- 1 ward ward  28061 2007-06-20 15:16 ROMEXEC0.rom
  -rw-r--r-- 1 ward ward  25675 2007-06-20 15:16 ROMEXEC1.rom
  -rw-r--r-- 1 ward ward  1234 2007-06-20 15:16 rom.scr
  -rw-r--r-- 1 ward ward  39110 2007-06-20 15:16 SETUP0.rom
  -rw-r--r-- 1 ward ward  40396 2007-06-20 15:16 STRINGS0.rom
  -rw-r--r-- 1 ward ward      4 2007-06-20 15:16 TCPA_*0.rom
  -rw-r--r-- 1 ward ward 26784 2007-06-20 15:16 TCPA_H0.rom
  -rw-r--r-- 1 ward ward  23136 2007-06-20 15:16 TCPA_Q0.rom
  -rw-r--r-- 1 ward ward  53472 2007-06-20 15:16 TEMPLAT0.rom
  -rw-r--r-- 1 ward ward  8208 2007-06-20 15:16 UPDATE0.rom


After a bit of fun with 'strings', we can deduce that the OPROM1.rom file contains our VGA BIOS.
At the time of writing this chapter you need to apply the following patch to bios_extract in order to make it work with the Tyan S2891 image:


So, now that we have the proper VGA BIOS image (36K long), we need to concatenate the VGA BIOS with the coreboot image
diff --git a/bios_extract.c b/bios_extract.c
index cd87ee8..c045307 100644
--- a/bios_extract.c
+++ b/bios_extract.c
@@ -90,8 +90,9 @@ static struct {
      {"AMIEBBLK", "AMIBIOSC", AMI95Extract},
      {"Award BootBlock", "= Award Decompression Bios =", AwardExtract},
      {"Phoenix FirstBIOS", "BCPSEGMENT", PhoenixExtract},
+    {"Phoenix ServerBIOS", "BCPSEGMENT", PhoenixExtract},
      {"PhoenixBIOS 4.0", "BCPSEGMENT", PhoenixExtract},
-    {"Phoenix TrustedCore", "BCPSEGMENT", PhoenixTrustedExtract},
+    {"Phoenix TrustedCore", "BCPSEGMENT", PhoenixExtract},
      {NULL, NULL, NULL},
  };


  cat OPROM1.rom tyan-s2891.rom > final_coreboot.rom
The file you are looking for is oprom_1.rom (at least in version 2.03 of the vendor bios)


===Burning the BIOS===
===Burning the BIOS===

Revision as of 17:40, 29 April 2010

Status

Device/functionality Status Comments
CPU Works
RAM Works
IDE ?
IDE using CF-to-IDE adapter ?
SATA WIP There are issues with disk detection on the CK804 chipset. This is being investigated.
USB ?
On-board ethernet Works
PCI add-on cards ?
PCI Express add-on cards ?
Floppy ?
Serial port (COM1) Works Serial console for coreboot and Linux is fully operational.
PS/2 keyboard Works
PS/2 mouse ?
Mainboard sensors/fans ?
CPU frequency scaling / powersave modes ? Probably won't work as long as there's no ACPI implementation for this board(?)
Flashrom Works

Before you begin

Do yourself a favor, and get a BiosSavior before you begin. There are different models, make sure you order the one you need. It depends on the size and type of the ROM chip on your board. Our S2891 board has an 8Mbit PLCC chip. This is the list of BiosSavior vendors:

 http://www.ioss.com.tw/web/English/WheretoBuy.html

Unfortunately the largest BiosSavior of the PMC type is only 512Kbyte; the proprietary BIOS is 1024Kbyte large. You can build a coreboot image in 512Kbyte, so this should not be a problem; you may want to buy a couple of extra 1Mbyte PLCC chips to save a copy of the original BIOS, and put it somewhere safe.

While coreboot replaces the functions of the proprietary BIOS, it does not replace the VGA BIOS. If you want VGA on your corebooted machine (not strictly necessary for servers), you will need to extract the VGA BIOS and concatenate it with the coreboot image, before burning it to your ROM. See below for details.

This wiki page is maintained by Ward Vandewege (ward at gnu dot org).

Hardware

The S2891 comes with a 8Mbit BIOS chip (SST 49LF080A). This is sufficient to have a fully functional coreboot with FILO or LAB payload, as described below.

Payload

coreboot requires a payload to boot an operating system.

If you want to boot from the network, you will need to use Etherboot.

If you want to boot from an IDE drive, USB stick or CDROM, you can use FILO.

Booting from SATA is a bit harder; the CK804 chipset on this board does not support a legacy IDE mode, so FILO and Etherboot can not boot directly from SATA.

In order to boot from SATA, we need to use 'linux-as-a-bootloader' (LAB) as a payload. You will need a 1MB ROM chip (thankfully the S2891 comes with a 1MB ROM chip) for this payload. It consists of a (stripped down) kernel + busybox, which can then be used to kexec a kernel from disk. If your disks are playing up, you will still have a busybox environment on boot, which could be useful for debugging.

Building the payload

You can build a coreboot image with a kconfig-style configuration tool (buildrom) if you want to use FILO or LAB. This is by far the easiest way to build a ROM image.

Buildrom

Check out buildrom:

 svn co svn://coreboot.org/buildrom

Now configure buildrom:

 cd buildrom/buildrom-devel
 make menuconfig

Configure to your liking. If you use the LAB payload, make sure to exclude the kexec binary and boot menu from the initramfs, otherwise your image will be too big. Please note that currently only the FILO and LAB payloads have been tested. The other payloads likely require some more work before they will be useable. Patches are welcome, of course.

 make

If all goes well, you should now have a ROM image file

 deploy/tyan-s2891.rom

This image will be exactly 988KB large, leaving 36KB for the VGA BIOS.

FILO payload

Skip this section if you use the LAB payload.

When using FILO in GRUB emulation mode, it's important to get a few details right in your GRUB boot stanza. This is what mine looks like:

 title   Ubuntu LB, kernel 2.6.21-rc3
 root    (hd4,0)
 kernel    /boot/vmlinuz-2.6.21-rc3 root=/dev/sda1 ro console=tty0 console=ttyS0,115200
 savedefault
 boot

Note the root device — FILO sees the first SATA device as hd4.

In order to get serial output from GRUB, you will also need to add something like this to your menu.lst:

 # serial port 0
 serial --unit=0 --speed=115200
 terminal --timeout=15 serial console

LAB payload

Skip this section if you use the FILO payload.

The LAB payload expects a file /lab.conf on /dev/sda1 with contents like this:

 CMDLINE="root=/dev/sda1 ro console=tty0 console=ttyS0,115200"
 KERNEL="/vmlinuz-2.6.22.1"
 INITRD=""
 VT="1"

This is the kernel that you will be running after boot. It will be kexec'ed by the kernel that is burned into your ROM chip.

You will also need a statically linked copy of kexec, which the LAB payload expects to reside at

 /sbin/kexec

If you are on a Debian-based system, you can easily recompile your kexec package to be statically linked by following these instructions:

 cd /usr/src
 apt-get source kexec-tools
 export LDFLAGS="-static"

Now edit kexec-tools-1.101-kdump10/kexec-tools-1.101/kexec/Makefile, change line 53 to

 $(CC) $(LDFLAGS) $(KCFLAGS) -o $@ $(KEXEC_OBJS) $(UTIL_LIB) $(LIBS)

(you're adding the LDFLAGS variable)

 cd kexec-tools-1.101-kdump10 
 dpkg-buildpackage -rfakeroot -b
 cd ..
 dpkg -i kexec-tools_1.101-kdump10-2ubuntu2_i386.deb

Adjust the package name as necessary for your distribution. You can tell if your copy of kexec is statically linked by running 'file' on it:

 file /sbin/kexec 

If all is well, you will see something like this:

 /sbin/kexec: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, statically linked, for GNU/Linux 2.2.0, stripped

The binary will also be considerably larger than its dynamically linked cousin.

Note that you must build a 32-bit version of kexec, because buildrom puts a 32 bit kernel into the ROM image. A 32-bit kexec can kexec into a 64 bit kernel, so if your system is 64 bit this will work just fine.

The LAB code currently expects lab.conf and kexec to live in / on /dev/sda1.

VGA BIOS

Skip this section if you don't need VGA support in your coreboot.

Download the latest proprietary BIOS for the S2891 from the Tyan website:

 http://www.tyan.com/support_download_bios.aspx?model=S.S2891

Follow the description on VGA support. But first you have to cut away the flash description of the BIOS image:

dd if=2891V203.wph of=2891V203.rom bs=1m count=1

At the time of writing this chapter you need to apply the following patch to bios_extract in order to make it work with the Tyan S2891 image:

diff --git a/bios_extract.c b/bios_extract.c
index cd87ee8..c045307 100644
--- a/bios_extract.c
+++ b/bios_extract.c
@@ -90,8 +90,9 @@ static struct {
     {"AMIEBBLK", "AMIBIOSC", AMI95Extract},
     {"Award BootBlock", "= Award Decompression Bios =", AwardExtract},
     {"Phoenix FirstBIOS", "BCPSEGMENT", PhoenixExtract},
+    {"Phoenix ServerBIOS", "BCPSEGMENT", PhoenixExtract},
     {"PhoenixBIOS 4.0", "BCPSEGMENT", PhoenixExtract},
-    {"Phoenix TrustedCore", "BCPSEGMENT", PhoenixTrustedExtract},
+    {"Phoenix TrustedCore", "BCPSEGMENT", PhoenixExtract},
     {NULL, NULL, NULL},
 };

The file you are looking for is oprom_1.rom (at least in version 2.03 of the vendor bios)

Burning the BIOS

Make sure your BiosSavior is set to the 'RD1' position (not to 'ORG'!), so that you can always revert to the original BIOS.

On the target machine:

  cd coreboot-v2/util/flashrom
  ./flashrom -v -w path/to/your/final_coreboot.rom

If you want VGA support, make sure you burn the final_coreboot.rom image!

Booting coreboot

You now need to 'halt' the machine. A soft reset won't work the first time you boot from the proprietary BIOS into coreboot.

Since we set up serial output in the coreboot configuration files above, you will want to hook up a serial console (or a copy of minicom or the like) to see what the box is doing while starting up. Keep your eyes on the screen after hitting the power button - coreboot will be up and running way before you expect it!

If you have problems, don't despair. Power down the box, switch the BiosSavior to 'ORG' and boot in the proprietary BIOS. Just don't forget to switch the BiosSavior back to the 'RD1' position before flashing the BIOS!

See what went wrong, and subscribe and post to the friendly and helpful mailing list if you can't figure it out by yourself.

GNU head This work is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.