This is a collections of old (and maybe obsolete by now) FAQ items. We still keep them, as they might still be useful for some people.
- 1 How do I set up testbios?
- 2 How do I burn a DoC?
- 3 How do I put a filesystem on DoC?
- 4 How do I turn off embedded sis630 devices?
How do I set up testbios?
From firstname.lastname@example.org Wed Oct 6 10:23:10 2004 Date: Tue, 5 Oct 2004 15:19:24 -0400 From: Dave Aubin To: email@example.com Subject: RE: Testbios help with nvidia 6800Gt and simple how to I've taken the time to put together a simple testbios faq. I hope it is helpful. Feedback and additions are welcome. Thanks, Dave
Testbios (vgabios) Faq
Date: 10/5/2004 Author(s): David Aubin firstname.lastname@example.org
Purpose: Testbios is an i386 emulator that sits on top of userspace linux. It's primary purpose is to provide program video rom's in to the cached memory area.
Where to obtain testbios
Testbios(vgabios) can be retrieved from the linuxbios/freebios source tree: 
You must have installed pci-utils
How to build testbios
- cd freebios/util/vgabios
- Edit ./Makefile and fill in the correct values for your environment (I build on a 64 AMD so my makefile looks like this)
Begin ./Makefile for x64:
CC = gcc ARCH := $(shell uname -m | sed -e s,i86,i386,) INCLUDE = -I ../pciutils-2.1.11 CFLAGS = -Wall -Ix86emu/include -O2 -g $(INCLUDE) INTOBJS = int10.o int15.o int16.o int1a.o inte6.o OBJECTS = testbios.o helper_exec.o helper_mem.o $(INTOBJS) LDFLAGS = -static-libgcc -static LIBS = x86emu/src/x86emu/libx86emu.a ../pciutils-2.1.11/lib/libpci.a # user space pci is the only option right now. OBJECTS += pci-userspace.o ifeq ($(shell if test "$(ARCH)" == "x86_64" ; then echo 1; fi), 1) CFLAGS +=-m32 -march=i386 endif all: testbios testbios: $(OBJECTS) $(LIBS) $(CC) $(CFLAGS) -o testbios $(OBJECTS) $(LDFLAGS) $(LIBS) helper_exec.o: helper_exec.c test.h x86emu/src/x86emu/libx86emu.a: $(MAKE) -C x86emu/src/x86emu/ -f makefile.linux clean: $(MAKE) -C x86emu/src/x86emu/ -f makefile.linux clean rm -f *.o *~ testbios distclean: clean $(MAKE) -C x86emu/src/x86emu/ -f makefile.linux clean
- Edit ~vgabios/x86emu/src/x86emu/makefile.linux and fill in the correct values for your environment (I build on a 64 AMD so my makefile looks like this)
############################################################################# # # Realmode X86 Emulator Library # # Copyright (C) 1996-1999 SciTech Software, Inc. # # ======================================================================== # # Permission to use, copy, modify, distribute, and sell this software and # its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permission notice appear in # supporting documentation, and that the name of the authors not be used # in advertising or publicity pertaining to distribution of the software # without specific, written prior permission. The authors makes no # representations about the suitability of this software for any purpose. # It is provided "as is" without express or implied warranty. # # THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF # USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # # ======================================================================== # # Descripton: Linux specific makefile for the x86emu library. # ############################################################################# TARGETLIB = libx86emu.a OBJS=\ debug.o \ decode.o \ fpu.o \ ops.o \ ops2.o \ prim_ops.o \ sys.o $(TARGETLIB): $(OBJS) ar rv $(TARGETLIB) $(OBJS) INCS = -I. -Ix86emu -I../../include CFLAGS += -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG -DDEBUG ARCH := $(shell uname -m | sed -e s,i86,i386,) ifeq ($(shell if test "$(ARCH)" == "x86_64" ; then echo 1; fi), 1) CFLAGS +=-m32 -march=i386 endif .c.o: # gcc -m32 -march=i386 -g -O -Wall -c $(CFLAGS) $(INCS) $*.c gcc -g -O -Wall -c $(CFLAGS) $(INCS) $*.c .cpp.o: # gcc -m32 -march=i386 -c $(CFLAGS) $(INCS) $*.cpp gcc -c $(CFLAGS) $(INCS) $*.cpp clean: rm -f *.a *.o validate: validate.o libx86emu.a gcc -o validate validate.o -lx86emu -L.
- Once built you could have a 32bit testbios executable made. Depending on your embedded environment you might want to have it built shared as the above example makes it static. Just remove -static-libgcc -static from the LDFLAGS on ./Makefile if you wish to have it built shared.
How to retrieve a good video bios
Note: if you are following these instructions to build LinuxBIOS for your motherboard, this is only necessary if you have a motherboard with an embedded VGA card. If your VGA is an add-on card, LinuxBIOS will find and run the ROM by itself.
Anton Borisov has released a number of tools under the GPL (v2) to extract the VGA BIOS from the BIOS ROM images provided by the supplier of your motherboard.
You can download them here:
Award BIOS: http://kaos.ru/biosgfx/download/awardeco-0.2.src.tar.gz AMI BIOS: http://www.kaos.ru/biosgfx/download/AmiDeco_0.31e.src.tar.gz Insyde BIOS: http://www.kaos.ru/biosgfx/download/InsyDeco_0.3.src.tar.gz Phoenix BIOS: http://www.kaos.ru/biosgfx/download/PhoenixDeco_0.33.src.tar.gz
See the Tyan S2881 Build Tutorial for more information on how to use these tools.
Alternatively, there are sites that have video bios roms on their website. Google is your friend, as always.
In some cases, you should also be able to retrieve your own video bios while running linux. Note however that this does NOT always work. In the case of the Tyan s2881, for instance, this method will generate a 32KB VGA ROM image that is invalid - the real VGA ROM image is 36K long, but the last 4K is not available in RAM, and thus can not be extracted with the following method.
- Boot up a machine with a commercial bios (not linux bios) with the video card you wish to work under linux bios.
You can see where your vga bios starts and how much space it takes by issuing
cat /proc/iomem | grep "Video ROM"
- To extract the bios, enter this command on the command line:
dd if=/dev/mem of=vgabios.bin skip=1536 count=128
Alternatively, you could use:
dd if=/dev/mem of=vgabios.bin bs=1k skip=768 count=64
This assumes you card's bios is cached in 0xc0000, and is 64K long. If your bios starts at 0xc0000 and ends at 0xc7fff it is only 32K long, and you need this command:
dd if=/dev/mem of=vgabios.bin bs=1k skip=768 count=32
- dd Explained (man dd to learn more):
- if is the location to retrieve from.
- of is the output file (your rom image)
- bs is the block size (the default is 512 bytes)
- skip jumps n blocks in the source data
- count is how many blocks you wish to read
- dd Explained (man dd to learn more):
- You now have a video bios image
How to use testbios
- Currently testbios only works from user space linux (10/4/04)
- Example from a linux command line or script enter the following to get your video bios programmed:
./testbios -d 0x90 -s 65536 --abseg /dev/mem ./vgabios.bin
- Testbios explained
- -s how much of the video bios is there
- --abseg where would you like to write this (/dev/mem default)
- -d device busdevfun in packed from
- How to get pci busdevfn in packed notation
- look for your video card
2 (00 << 3) | 00 = 0x200
0 (12 << 3) | 0 = 0x90
- -t dump
- -c codesegment Where do you want to start, default is 0xc0000
- -b base Where do you want base to be default is 0xc000
- -i instruction pointer usually left off as the default
- filename of video bios
- Testbios explained
Followup to Testbios FAQ
How do I burn a DoC?
A DoC (Disk on Chip) is a storage device aiming at serving as both boot-ROM and background storage (CF disk) to save circuit board space and pin-count, e.g. in a digital camera.
Currently, only the DoC Millennium is supported. See the documentation.
How do I put a filesystem on DoC?
OK, here is a little HOWTO on how to set up MTD with a file system.
This is a m810lmr, booting out of DoC. I am going to reserve the first 2M for kernel. So the layout will be the first 2M for linuxbios and kernel, and 6M for a file system. Kernel is 2.4.17, with linux-2.4.17-sis.patch from linuxbios source tree, and config-2.4.17-sis from the linuxbios source tree. Mainboard is the pcchips m810lmr.
modprobe doc2001 modprobe docprobe dmesg
DiskOnChip Millennium found at address 0xFFFC8000 Flash chip found: Manufacturer ID: 98, Chip ID: E6 (Toshiba TC58V64AFT/DC) 1 flash chips found. Total DiskOnChip size: 8 MiB mtd: Giving out device 0 to DiskOnChip Millennium Ignoring DiskOnChip Millennium at 0xFFFCA000 - already configured Ignoring DiskOnChip Millennium at 0xFFFCC000 - already configured Ignoring DiskOnChip Millennium at 0xFFFCE000 - already configured Ignoring DiskOnChip Millennium at 0xFFFD0000 - already configured Ignoring DiskOnChip Millennium at 0xFFFD2000 - already configured Ignoring DiskOnChip Millennium at 0xFFFD4000 - already configured Ignoring DiskOnChip Millennium at 0xFFFD6000 - already configured (etc..) Now I need MTD utilities. So I: cvs -d :pserver:email@example.com:/home/cvs login CVS password: (password is anoncvs) Then: cvs -d :pserver:firstname.lastname@example.org:/home/cvs co mtd
Forget the drivers and such, you don't need them. What you need is the tools.
cd mtd/tools make
Go ahead and copy the executables somewhere handy, you'll need them.
Now we need to make the last 6M into a "disk". We need to format it. The tool is nftl_format, so:
[root@carly util]# ./nftl_format $Id: nftl_format.c,v 1.17 2001/08/29 14:28:48 dwmw2 Exp $ Usage: ./nftl_format [ ] [root@carly util]# expr 2048 \* 1024 2097152 [root@carly util]# expr 6 \* 1024 \* 1024 6291456 [root@carly util]# ./nftl_format /dev/mtd0 2097152 6291456 $Id: nftl_format.c,v 1.17 2001/08/29 14:28:48 dwmw2 Exp $ Phase 1. Checking and erasing Erase Zones from 0x00200000 to 0x00800000 Phase 2.a Writing NFTL Media Header and Bad Unit Table Phase 2.b Writing Spare NFTL Media Header and Spare Bad Unit Table Phase 3. Writing Unit Control Information to each Erase Unit
we now have a formatted disk in there. We can now partition it.
[root@carly util]# modprobe nftl
dmesg shows LOTS of errors, since this was never partitioned ...
Also, if you don't have /dev/nftla,
[root@carly util]# mknod /dev/nftla b 93 0
Don't use the script just yet, it makes /dev/nftla as b 93 16, which is the wrong unit #.
now fdisk /dev/nftla
[root@carly util]# fdisk /dev/nftlA Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1, default 1): Using default value 1 Command (m for help): p Disk /dev/nftlA: 1 heads, 12224 sectors, 1 cylinders Units = cylinders of 12224 * 512 bytes Device Boot Start End Blocks Id System /dev/nftlA1 1 1 6111+ 83 Linux Partition 1 has different physical/logical endings: phys=(768, 0, 0) logical=(0, 0, 12224) Partition 1 does not end on cylinder boundary: phys=(768, 0, 0) should be (768, 0, 12224) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks. [root@carly util]# mknod /dev/nftlA1 b 93 1 [root@carly util]# mke2fs /dev/nftlA1 mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09 Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 1528 inodes, 6111 blocks 305 blocks (4.99%) reserved for the super user First data block=1 1 block group 8192 blocks per group, 8192 fragments per group 1528 inodes per group Writing inode tables: done Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@carly util]# mount /dev/nftlA1 /mnt [root@carly util]# cd /mnt [root@carly mnt]# df . Filesystem 1k-blocks Used Available Use% Mounted on /dev/nftlA1 5915 13 5597 1% /mnt [root@carly mnt]#
and so you now have an ext2 file system on the DoC.
(Above is from Ron Minnich)
How do I turn off embedded sis630 devices?
From email@example.com Mon Mar 25 08:54:07 2002 Date: Mon, 25 Mar 2002 22:07:54 +0800 From: Andrew Ip To: Kei Furuuchi Cc: firstname.lastname@example.org Subject: Re: How to turn off unused pci device. Hi, > I have pcchips m758lmr which has audio chip besides sis630. > those functions in sis630 are not used in the motherboard. > But, the functions keep coming up. How do I turn off those? The following is from Nikolai Valdych previous message. Hope this help. -Andrew -- Andrew Ip Email: email@example.com Actualy, it was pretty simple 0x7c00 - All devices enabled, You play with first 4 bits only. Cos there are 4 devices, so you have any combination of 4 bits. Set bit to 1 to turn off the device, bit 0 to enable it. This is the device list: Multimedia Audio controler Modem controler Ethernet sis930 controler USB controler. For example, to turn off Ethernet + USB it would be: 0x7c0c -> 1100 in binary (first 4 bits) To turn off Multimedia audio : 0x7c01 -> 0001 in binary and so on... maybe there are more detail, but this is enogh for me, Ollie, again thanks! nikolai p.s. though my modem is not yet working..... damn driver......