Board:tyan/s2891: Difference between revisions
Line 6: | Line 6: | ||
http://www.ioss.com.tw/web/English/WheretoBuy.html | http://www.ioss.com.tw/web/English/WheretoBuy.html | ||
Unfortunately the largest BiosSavior of the PMC type is only 512Kbyte | Unfortunately the largest BiosSavior of the PMC type is only 512Kbyte; the proprietary bios is 1024Kbyte large. You can build a LinuxBIOS 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 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. | 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. |
Revision as of 20:01, 20 June 2007
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. |
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 LinuxBIOS 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 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).
Hardware
The S2891 comes with a 8Mbit BIOS chip (SST 49LF080A). This is sufficient to have a fully functional LinuxBIOS with FILO payload, as described below.
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.
Building LinuxBIOS
Download LinuxBIOS (http://linuxbios.org/index.php/Download_LinuxBIOS).
If you want VGA support, a few changes are required in the linuxbios source tree. Edit this file:
src/mainboard/tyan/s2891/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/s2891 tree.
cd targets ./buildtarget tyan/s2891
Modify tyan/s2891/Config.lb; change payload setting to point to your filo.elf file
If you don't need VGA, you will need to modify tyan/s2891/Config.lb. Comment out the line:
option ROM_SIZE = 1024*1024-48*1024
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 = 1024*1024-36*1024
NOTE: if you are planning to put the image in the built-in BiosSavior chip (which is only 512Kbyte), use this ROM_SIZE:
option ROM_SIZE = 512*1024-36*1024
Build the image:
cd tyan/s2891/s2891 make
If you see compilation errors, make sure you have GCC's stack protector disabled. See the stack protector page to deal with that.
VGA bios
Skip this section if you don't need VGA support in your LinuxBIOS.
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:
While booted with your proprietary BIOS, you can see where your vga bios starts and how much space it takes by issuingcat /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 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
Once you have the image, you can display its contents like this:
./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 -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.
So, now that we have the proper VGA bios image (36K long), we need to concatenate the VGA bios with the linuxbios image
cat OPROM1.rom 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.