Board:tyan/s2882

From coreboot
Jump to navigation Jump to search

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

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 S2882 board has a 4Mbit PLCC chip. This is the list of BiosSavior vendors:

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

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

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

Payload

LinuxBIOS 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, SATA drive, USB stick or CDROM, you can use FILO.

Building the payload

In order to boot from a SATA disk, we use FILO.

Once you've downloaded FILO, you will need to put a file 'Config' in its root tree. An example can be found in the distribution, called 'defconfig'.

You can configure FILO to load Grub. Here's my Config, which does that:

 # Use grub instead of autoboot?
 USE_GRUB = 1
 # Grub menu.lst path
 MENULST_FILE = "hda1:/grub/menu.lst"
 # Driver for hard disk, CompactFlash, and CD-ROM on IDE bus
 IDE_DISK = 1
 # Add a short delay when polling status registers
 # (required on some broken SATA controllers)
 IDE_DISK_POLL_DELAY = 1
 # Driver for USB Storage
 USB_DISK = 1
 # VGA text console
 VGA_CONSOLE = 1
 PC_KEYBOARD = 1
 # Enable the serial console
 SERIAL_CONSOLE = 1
 # Serial console; real external serial port
 SERIAL_IOBASE = 0x3f8
 SERIAL_SPEED = 115200
 # Filesystems
 FSYS_EXT2FS = 1
 FSYS_ISO9660 = 1
 # Support for boot disk image in bootable CD-ROM (El Torito)
 ELTORITO = 1
 # PCI support
 SUPPORT_PCI = 1
 # Enable this to scan PCI busses above bus 0
 # AMD64 based boards do need this.
 PCI_BRUTE_SCAN = 1
 # Loader for standard Linux kernel image, a.k.a. /vmlinuz
 LINUX_LOADER = 1

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

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

Now execute 'make', which will generate a filo.elf file that will be your payload. You will need to refer to this file to build LinuxBIOS as explained below, because it gets included in the LinuxBIOS ROM image.

Note: if you are not using all the SATA ports on your motherboard, make sure that you have a drive connected to the *first* sata port, otherwise Filo won't be able to boot - it won't see any drives!

Building LinuxBIOS

Download LinuxBIOS (http://linuxbios.org/index.php/Download_LinuxBIOS). You need subversion revision 2251 or higher. Note that revisions 2288 through 2295 are known bad, do not use those.

If you want VGA support, a few changes are required in the linuxbios source tree. Edit this file:

 src/mainboard/tyan/s2882/Options.lb

You'll need to enable the following two lines:

 #VGA Console
 default CONFIG_CONSOLE_VGA=1
 default CONFIG_PCI_ROM_RUN=1

Whether you want VGA or not, build a tyan/s2882 tree.

 cd targets
 ./buildtarget tyan/s2882

Modify tyan/s2882/Config.lb; change payload setting to point to your filo.elf file

If you don't need VGA, you will need to modify tyan/s2882/Config.lb. Comment out the line:

 option ROM_SIZE = 475136

If you do need VGA, modify the ROM_SIZE line to the following, because our VGA bios is only 36KB, not 48K:

 option ROM_SIZE = 487424

Now make the image:

 cd tyan/s2882/s2882
 make

VGA bios

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

The s2882 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:

 While booted with your proprietary BIOS, you can see where your vga bios starts 
 and how much space it takes by issuing
   cat /proc/iomem | grep "Video ROM"
 Then get a copy of your vga bios.
   dd if=/dev/mem of=vgabios.bin bs=1k count=32 skip=768
 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 - and other option ROMs, in fact - from the BIOS images that Tyan offers on its website.

You can download the tool for AMI here:

 http://www.kaos.ru/biosgfx/download/AmiDeco_0.31e.src.tar.gz

Then download the latest Bios for the s2882 from the TYAN website:

 http://www.tyan.com/support/html/b_s2882.html

Once you have the image, you can display its contents like this:

 ./amideco 2882v309.rom -l

That should show output like:

 �-=AmiBIOSDeco, version 0.31e (Linux)=-�
 FileLength      : 80000 (524288 bytes)
 FileName        : 2882v309.rom
       AMIBIOS information:
 Version         : 0800
 Packed Data     : 5A2B0 (369328 bytes)
 Start           : DF83C
 Packed Offset   : 5F83C
 Offset          : 80000
 Released        : 26 July 2006
 DirName         : 2882v309.---
 +------------------------------------------------------------------------------+
 | Class.Instance (Name)        Packed --->  Expanded      Compression   Offset |
 +------------------------------------------------------------------------------+
  08 01 (        Interface)    00798 ( 01944) => 00798 ( 01944)      5F83Ch
  04 02 (     Setup Client)    03F40 ( 16192) => 069A2 ( 27042)  +   5B8E8h
  0C 03 (           ROM-ID)    00008 ( 00008) => 00008 ( 00008)      5B8CCh
  0E 04 (         OEM Logo)    00B4D ( 02893) => 4B436 (308278)  +   5AD68h
  1A 05 (       Small Logo)    00532 ( 01330) => 026A2 ( 09890)  +   5A820h
  18 06 (ADM (Display MGR))    01741 ( 05953) => 04019 ( 16409)  +   590C8h
  19 07 (         ADM Font)    0059C ( 01436) => 01304 ( 04868)  +   58B18h
  1B 08 (             SLAB)    2580F (153615) => 4D619 (316953)  +   332F4h
  21 09 (    Multilanguage)    03AAF ( 15023) => 081AF ( 33199)  +   2F830h
  20 10 (    PCI AddOn ROM)    05B84 ( 23428) => 09000 ( 36864)  +   29C98h
  20 11 (    PCI AddOn ROM)    06416 ( 25622) => 0C800 ( 51200)  +   2386Ch
  20 12 (    PCI AddOn ROM)    02DFC ( 11772) => 04800 ( 18432)  +   20A5Ch
  20 13 (    PCI AddOn ROM)    0D5EA ( 54762) => 0E000 ( 57344)  +   1345Ch
  20 14 (    PCI AddOn ROM)    05678 ( 22136) => 09000 ( 36864)  +   0DDD0h
  11 15 (     P6 Microcode)    2062004 (33955844) => 00039 ( 00057)  +   0B5B4h
  2E 16 (         User ROM)    047B3 ( 18355) => 07800 ( 30720)  +   06DECh
  06 17 (         DMI Data)    003E0 ( 00992) => 00A43 ( 02627)  +   069F8h
  2F 18 (  User-Defined ;))    00C30 ( 03120) => 025C5 ( 09669)  +   05DB4h
  80 19 (  User-Defined ;))    00044 ( 00068) => 00044 ( 00068)      05D58h
 Total Sections  : 19

Now extract all these parts:

 ./amideco 2882v309.rom -x

Note: if you are using version 0.31e of Amideco, it will complain that it can not read the data structure of the rom entirely. Just ignore that error, it extracts the necessary files:

 -rw-r--r-- 1 ward ward  27042 2006-09-11 15:49 amibody.04
 -rw-r--r-- 1 ward ward   1944 2006-09-11 15:49 amibody.08
 -rw-r--r-- 1 ward ward      8 2006-09-11 15:49 amibody.0c
 -rw-r--r-- 1 ward ward 308278 2006-09-11 15:49 amibody.0e
 -rw-r--r-- 1 ward ward      0 2006-09-11 15:49 amibody.11
 -rw-r--r-- 1 ward ward  16409 2006-09-11 15:49 amibody.18
 -rw-r--r-- 1 ward ward   4868 2006-09-11 15:49 amibody.19
 -rw-r--r-- 1 ward ward   9890 2006-09-11 15:49 amibody.1a
 -rw-r--r-- 1 ward ward 316953 2006-09-11 15:49 amibody.1b
 -rw-r--r-- 1 ward ward  33199 2006-09-11 15:49 amibody.21
 -rw-r--r-- 1 ward ward  36864 2006-09-11 15:49 amipci_00.20
 -rw-r--r-- 1 ward ward  51200 2006-09-11 15:49 amipci_01.20
 -rw-r--r-- 1 ward ward  18432 2006-09-11 15:49 amipci_02.20
 -rw-r--r-- 1 ward ward  57344 2006-09-11 15:49 amipci_03.20
 -rw-r--r-- 1 ward ward  36864 2006-09-11 15:49 amipci_04.20

We know that our VGA BIOS is 36K long. Only 2 files fit the bill: amipci_00.20 and amipci_04.20. If you run 'strings' on both files, you'll see that the former is the VGA BIOS, and the latter is the Option ROM for the Broadcom network card.

So, now that we have the proper VGA bios image (36K long), we need to concatenate the VGA bios with the linuxbios image

 cat amipci_00.20 linuxbios.rom > final_linuxbios.rom

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 LinuxBIOSv2/util/flashrom
  ./flashrom -v -w path/to/your/linuxbios.rom

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

Booting LinuxBIOS

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

Since we set up serial output in the LinuxBIOS 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 - LinuxBIOS 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.