Modified Bios for KVM/Qemu/Bochs Bios?

Discussion in 'Virtualization' started by Seb, Nov 9, 2009.

  1. kobuki

    kobuki MDL Novice

    Oct 24, 2009
    4
    0
    0
    Problem solved using an original OEM DVD of W7U x86.
     
  2. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,356
    2,026
    210
    #23 sebus, Mar 4, 2012
    Last edited by a moderator: Apr 20, 2017
    That is great, if one can run this command, for what I need there is no easy way to specify it (full web based "solution" - VERDE, so I would need to change their web scripts), so needed to mod the bios.bin

    Code:
    Mar-04 10:55:15 1-N  Executing:  /usr/lib/verde/bin/qemu-kvm -enable-kvm -L /usr/lib/verde/etc/pc-bios -rtc clock=vm,base=localtime,driftfix=slew -verdevmmio 10 -clock unix -usb -usbdevice tablet -monitor stdio -m 1024 -M pc-0.14 -cpu 'qemu64,-nx,model_id=VERDE Virtual CPU' -balloon none -tb-size 2 -drive if=none,id=ide1-cd0,media=cdrom,snapshot=off,aio=native -device ide-drive,drive=ide1-cd0,bus=ide.1,unit=0,ver=0.14.0 -boot c -vga qxl -device qxl -global qxl-vga.vram_size=33554432 -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -drive if=none,id=ide0-hd0,file=/home/mcadmin1/Win7x64/GUEST.IMG,cache=unsafe,aio=native,snapshot=off -device ide-drive,drive=ide0-hd0,bus=ide.0,unit=0,ver=0.14.0 -drive if=none,id=ide0-hd1,file=/home/mcadmin1/Win7x64/USER.IMG,cache=unsafe,aio=native,snapshot=off -device ide-drive,drive=ide0-hd1,bus=ide.0,unit=1,ver=0.14.0 -soundhw hda -net user,vlan=0 -net nic,model=virtio,vlan=0 -net nic,model=virtio,vlan=1,macaddr=52:54:84:00:00:0a -net tap,vlan=1,fd=3 -serial /dev/null -serial @6 -parallel none -redir tcp:-4::3389 -redir tcp:-9::48666 -spice tls-port=-8,password=temporary,image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,playback-compression=on,x509-key-file=/usr/lib/verde/etc/verde-server-key.pem,x509-cert-file=/usr/lib/verde/etc/verde-server-cert.pem,x509-cacert-file=/usr/lib/verde/etc/verde-ca-cert.pem -name 'VERDE 5.5 - Windows 7 64-bit' 
    
    sebus
     
  3. nexus76

    nexus76 MDL Addicted

    Jan 25, 2009
    788
    300
    30
    #24 nexus76, May 21, 2012
    Last edited by a moderator: Apr 20, 2017
    I'm getting the following output:

    Code:
    patch --dry-run -u -i slicpatch-seabios.patch
    patching file acpi.c
    Hunk #1 FAILED at 628.
    Hunk #2 FAILED at 635.
    Hunk #3 FAILED at 653.
    3 out of 3 hunks FAILED -- saving rejects to file acpi.c.rej
    
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. MrTAZ

    MrTAZ MDL Novice

    Dec 22, 2011
    2
    2
    0
    #25 MrTAZ, Jun 25, 2012
    Last edited by a moderator: Apr 20, 2017
    Just Seabios version pb, but, I don't remember Seabios version what I used.
    Normally, U can adjust line easly whith a text editor.
     
  5. mister999

    mister999 MDL Novice

    Feb 23, 2011
    2
    0
    0
    Can somebody give me ready(patched) slic bios for kvm?
     
  6. tarbal9

    tarbal9 MDL Novice

    Mar 20, 2010
    17
    3
    0
    Anybody got a patch for seabios 1.7.1 for dell slic 2.1 ? or seabios bios.bin with dell slic 2.1
     
  7. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,356
    2,026
    210
    Why not invest a bit of time & just do it yourself?

    The instructions are in port #17 & #22
     
  8. Dr.Sqaer

    Dr.Sqaer MDL Novice

    Feb 25, 2010
    2
    0
    0
    #29 Dr.Sqaer, Jan 18, 2013
    Last edited by a moderator: Apr 20, 2017
    I try latest patch, but it's not working with 1.7.1 BIOS could somebody explain why, and maybe make a some changes in source code of this patch?
    Please :worthy:

    Code:
    root@test /usr/src/seaslic # ./patch.sh
    
    ===========================================================================
    retrieve the latest seabios from upstream git repo.
    ===========================================================================
    
    Directory 'seabios.submodule' exists, but is neither empty nor a git repository
    HEAD is now at e36ae57 Merge pull request #1 from rpatterson/master
    
    ===========================================================================
    dump the slic from motherboard (root password required)
    ===========================================================================
    
    ./patch.sh: line 27: sudo: command not found
    
    ===========================================================================
    patching seabios...
    ===========================================================================
    
    patching file src/acpi.c
    Reversed (or previously applied) patch detected!  Assume -R? [n]
    Apply anyway? [n]
    Skipping patch.
    3 out of 3 hunks ignored -- saving rejects to file src/acpi.c.rej
    patching file src/ahci.c
    Hunk #1 FAILED at 408.
    Hunk #2 FAILED at 422.
    2 out of 2 hunks FAILED -- saving rejects to file src/ahci.c.rej
    patching file src/bregs.h
    Reversed (or previously applied) patch detected!  Assume -R? [n]
    Apply anyway? [n]
    Skipping patch.
    1 out of 1 hunk ignored -- saving rejects to file src/bregs.h.rej
    
    ===========================================================================
    compiling seabios...
    ===========================================================================
    
    ./patch.sh: line 44: make: command not found
    
    ===========================================================================
    your bios awaits....
    ===========================================================================
    
    ls: cannot access seabios.submodule/out/bios.bin: No such file or directory
    root@alliance /usr/src/seaslic #
    
     
  9. TheFrickler

    TheFrickler MDL Novice

    Aug 2, 2009
    10
    3
    0
    Your Linux installation is obviously missing the required tools and development packages, at least "sudo", "git", "make", probably more like "gcc-development", "xxd" and so on.
    You will need to install them first, but it is beyond the scope of this forum to help you with those basics.
     
  10. Dr.Sqaer

    Dr.Sqaer MDL Novice

    Feb 25, 2010
    2
    0
    0
    I installed everything what needed to compile source codes and get compiled BIOS.
    Tnx
     
  11. lustich

    lustich MDL Novice

    Dec 3, 2010
    16
    2
    0
    Hi! I tried following that instructions sebus posted, but it didn't work form the very first line on. I'm on proxmox, too, but it complains I'd have to add sources URI to sources.list for getting seabios build dependencies. How shall I know what to add to sources.list, with billions of possible links to directories, folders, gits and whatsever on the seabios site?


    Thank you!

    Edit:

    I don't have any idea if one "build-dependendy-repository" is the same thing as one "sources-repository".
     
  12. testen

    testen MDL Novice

    Aug 26, 2009
    4
    0
    0
    Seabios 1.7.2 seems to be released.

    Tested same acpi_slic.patch as used with 1.7.0 or 1.7.1 and it worked ok.

    It was easy update. Just load new source and copy old acpi_slic.patch and old acpi-slic.hex to src/ folder and run patch and make.
     
  13. testen

    testen MDL Novice

    Aug 26, 2009
    4
    0
    0
    Has anyone tested this method with dell slic 2.2 ?

    I like to give try for Windows 2012
     
  14. JimmyZ

    JimmyZ MDL Novice

    Jul 29, 2009
    9
    0
    0
    #36 JimmyZ, Mar 30, 2013
    Last edited by a moderator: Apr 20, 2017
    I tried MrTAZ's patch on seabios 1.7.2 and it works, but I can't quite understand the first part of the patch:
    Code:
    +                acpi_ext_table = acpi_ext_table+1;
    +                slic = acpi_ext_table;
    why +1?

    my guess: the normal acpitable data file doesn't have a header and seabios generate a header and append the data file after it, but the slic dump we provided does have a header so the +1 skip the generated header and use the header in the data file instead, which is exactly what we want, am I right?

    and I think this check
    Code:
    +    if (slic->signature == SLIC_SIGNATURE){
    is not necessary?
     
  15. JimmyZ

    JimmyZ MDL Novice

    Jul 29, 2009
    9
    0
    0
    I have fujitsu slic 2.2 and 2008r2 works, but I never tried 2012

    interestingly aida64 show slic version unknown
     
  16. boneco69

    boneco69 MDL Novice

    Feb 13, 2010
    16
    1
    0
    #38 boneco69, Aug 17, 2013
    Last edited by a moderator: Apr 20, 2017
    To patch/insert SLIC2.1 In FEDORA 19 (kvm) the source's from seabios doesn't work with windows FAIL because BSOD of "ACPI BIOS...(blahblah)" on boot.
    So by trial/error i found that i need to fetch seabios-1.7.2.2.tar.gz from seabios rpm source file (or fetch it from internet) and apply the patch.
    Because my base motherboard doesn't have SLIC2.1 table in it, i have to modify the patch file around the line 11:
    Code:
    # dump the slic table from the computer (note: requires root)
    #sudo xxd -i /sys/firmware/acpi/tables/SLIC | grep -v len | sed 's/unsigned char.*/static char SLIC[] = {/' > seabios.submodule/src/acpi-slic.hex
    
    to
    Code:
    xxd -i slic.bin | grep -v len | sed 's/unsigned char.*/static char SLIC[] = {/' > seabios.submodule/src/acpi-slic.hex
    
    Had to put slic.bin file also (of course)...

    Now i have kvm with SLIC in bios ok.
     
  17. mikelinux

    mikelinux MDL Novice

    Sep 6, 2013
    1
    8
    0
    #39 mikelinux, Sep 6, 2013
    Last edited by a moderator: Apr 20, 2017
    How to add SLIC 2.1 and SLP 1.0 to SeaBios bios for use in Qemu/KVM

    OK guys here is my attempt at a tutorial on how to add SLIC 2.1 and SLP 1.0 to the SeaBios source which can then be used in Qemu/KVM etc...


    Get and prepare the source code:

    1. Create a working directory:
    Code:
    mkdir biostemp
    2. Change to the working directory:
    Code:
    cd biostemp
    ​3. Get the latest seaslic code:
    Code:
    wget github.com/ghuntley/seaslic/archive/master.zip
    4. Extract the file:
    Code:
    unzip master.zip
    5. Get the seabios code:

    *I will use seabios 1.7.2 as the latest version was giving a AHCI error in Windows XP.
    Code:
    wget code.coreboot.org/p/seabios/downloads/get/seabios-1.7.2.tar.gz
    6. Extract the file:
    Code:
    tar -zxvf seabios-1.7.2.tar.gz
    7. Move the seabios source into the build directory:
    Code:
    mv seabios-1.7.2/* seaslic-master/seabios.submodule/
    8. Remove the remaining empty folder (optional):
    Code:
    rm -rf seabios-1.7.2

    Add the SLIC:

    OK for the first part you have 2 choices.

    To use the SLIC from the machine follow step 1a.

    1a. Use the SLIC from the machine (needs root password):

    Code:
    sudo xxd -i /sys/firmware/acpi/tables/SLIC | grep -v len | sed 's/unsigned char.*/static char SLIC[] = {/' > seaslic-master/seabios.submodule/src/acpi-slic.hex

    Or if you want to use the SLIC from a file follow step 1b.

    1b. Use the SLIC from a file:

    *In this example my SLIC file is
    SONY-VAIO_2.1.BIN, as I want the bios to have a Sony SLIC and the Sony SLIC is in the file SONY-VAIO_2.1.BIN.

    Code:
    xxd -i SONY-VAIO_2.1.BIN | grep -v len | sed 's/unsigned char.*/static char SLIC[] = {/' > seaslic-master/seabios.submodule/src/acpi-slic.hex

    2. Change to the seabios build directory:
    Code:
    cd seaslic-master/seabios.submodule
    3. Apply the SLIC patch to the source:
    Code:
    patch -p1 < ../seabios.patch


    Add the SLP 1.0 string:

    1. Open the file misc.c in a text editor (here I am using gedit)
    Code:
    gedit src/misc.c

    2. Find and make a note of your SLP string range in this list of physical address ranges:
    Code:
    Address Range  SLP OEM String
    
    0000 - FFFE    Acer TravelMate
    E000 - FFFF    AcerSystem
    0000 - E000    AcerSystem
    C000 - D000    Actebis:SAM#451B
    D000 - E000    Actebis:SAM#451B
    E000 - F000    Actebis:SAM#451B
    0000 - FFFF    alienware
    0000 - FFFE    americanfuture
    E700 - E804    AMOI Electronics CO.,Ltd
    C000 - FFFF    ASUS_FLASH
    FE00 - FFFF    BenQHub
    0000 - FFFF    BIOSLOCKFUNCTION ELITEGROUP
    0000 - FFFE    Compaq
    E840 - E850    Dell Computer
    E838 - E850    Dell Inc
    E827 - E848    Dell Quanta
    E076 - E086    Dell System
    49A9 - 49B9    Dell System
    E05E - E06E    Dell System
    0000 - FFFE    DIXONSXP
    0000 - FFFF    EMACHINES
    0000 - FFFF    emaxs
    0000 - FFFF    Equus Computer Systems
    0000 - FFFF    Equus
    0000 - FFFF    Founder PC
    0000 - FFFF    FSC SERVER
    0000 - FFFF    FSC SYSTEM
    0000 - FFFF    FUJITSU SIEMENS
    0000 - FFFF    FUJITSU
    E840 - E860    Gateway
    0A0B - 0B0B    Gateway
    0EF6 - 0FF6    Gateway
    2EBA - 2EDA    Gateway
    0DB3 - 0DD3    Gateway
    1036 - 1056    Gateway
    307F - 309F    Gateway
    28AC - 28CC    Gateway
    2B23 - 2B43    Gateway
    3D37 - 3D57    Gateway
    00F2 - 0112    Gateway
    DE11 - DE31    Gateway
    3AA6 - 3AC6    Gateway
    9577 - 9597    Gateway
    32F0 - 3310    Gateway
    330B - 332B    Gateway
    3110 - 3130    Gateway
    0000 - FFFF    GIGABYTE
    0000 - FFFF    GREATWALL
    0000 - FFF0    HaierComputer
    0000 - FFFF    HASEECOMPUTER
    0000 - FFFF    HEDYCOMPUTER
    0000 - FFFE    Hewlett
    0000 - FFFF    HIGRADED
    0000 - FFFF    HP PAVILION
    0000 - FFFF    IBM CORPORATION
    0000 - FFFF    iQon.ie
    0000 - FFFF    Lan Plus
    0000 - FFFF    LEGEND Dragon
    0000 - FFFF    LENOVO
    E000 - E200    LG Electronics
    E600 - E606    MEI_CF
    0000 - DFFF    MAXDATA
    0000 - FFFF    MEDIONNB
    0000 - FFFF    MEDIONPC
    E600 - E606    MEI_CF
    FF70 - FF80    MSI-2831-MS
    FF70 - FF80    MSI-PC
    E6D0 - E6E0    MSI-PenNote
    FF70 - FF80    MSI-PenNote
    0000 - FFF0    NEC Computers
    0000 - FFF0    NEC_Product
    0000 - FFF0    NECC_
    0000 - FFF0    NECC1
    0000 - FFF0    NEC-PC
    0000 - FFFF    OQO Inc/Zepto/(jja)
    0000 - FFFF    powerspec
    0000 - FFFF    PRIMERGY
    E710 - E810    $SAMSUNGPC
    0000 - FFFF    SIEMENS
    0000 - FFFF    SNC302EEH
    FF80 - FFF0    Sony Corporation
    DFC0 - E000    Sony Corporation
    E800 - E880    Sony Corporation
    0000 - FFFF    SYSFIC
    0000 - FFFF    TCL123
    C9A6 - CAAA    Tektronix
    E840 - E944    Tektronix
    BEC6 - BFCA    Tektronix
    0000 - FFFF    TOSHIBA
    0000 - FFFE    TravelMate
    0000 - FFFF    TRIGEM
    0000 - FFFF    TSINGHUA TONGFANG COMPUTER
    0000 - FFFF    vpr Matrix
    0000 - FFFF    WinBook

    If your manufacturer has multiple valid address ranges, as is the case with Sony in this example, then it is good practice to insert the SLP once in each valid range.

    3. Find the following code in the misc.c file (it is right at the end):
    Code:
    /****************************************************************
     * Misc fixed vars
     ****************************************************************/
    
    char BiosCopyright[] VAR16FIXED(0xff00) =
        "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team.";
    
    
    // BIOS build date
    
    char BiosDate[] VAR16FIXED(0xfff5) = "06/23/99";
    4. Insert the following line of text above the line beginning "char BiosCopyright", substituting the "0xFF80" for a value within the correct range of your manufacturer and substituting the "Sony Corporation" for the correct SLP string of your manufacturer:
    Code:
    char slp[] VAR16FIXED(0xFF80) = "Sony Corporation";
    *Example for Asus:
    Code:
    char slp[] VAR16FIXED(0xC000) = "ASUS_FLASH";
    5. The modified code should now look like:
    Code:
    /****************************************************************
     * Misc fixed vars
     ****************************************************************/
    
    
    char slp[] VAR16FIXED(0xFF80) = "Sony Corporation";
    
    
    char BiosCopyright[] VAR16FIXED(0xff00) =
        "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team.";
    
    
    // BIOS build date
    
    char BiosDate[] VAR16FIXED(0xfff5) = "06/23/99";

    6. Add any additional valid ranges by appending a number to the slp[] string and modifying the range according to the table above (if your manufacturer has only 1 valid range, i.e. Asus, you can skip this and the next step):
    Code:
    char slp[] VAR16FIXED(0xFF80) = "Sony Corporation";
    
    char slp2[] VAR16FIXED(0xDFC0) = "Sony Corporation";
    
    char slp3[] VAR16FIXED(0xE800) = "Sony Corporation";

    7. The final modified code should look like:
    Code:
    /**************************************************************** 
    * Misc fixed vars
     ****************************************************************/
    
    
    char slp[] VAR16FIXED(0xFF80) = "Sony Corporation";
    
    
    char slp2[] VAR16FIXED(0xDFC0) = "Sony Corporation";
    
    
    char slp3[] VAR16FIXED(0xE800) = "Sony Corporation";
    
    
    char BiosCopyright[] VAR16FIXED(0xff00) =
        "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team.";
    
    
    // BIOS build date
    
    char BiosDate[] VAR16FIXED(0xfff5) = "06/23/99";

    * For ranges beginning 0000, do not set the above to 0x0000, as this will cause the below error when compiling, instead enter a different value within the range. For example for the range of 0000 - FFFF, I find that F000 works good.
    Code:
    ld:out/romlayout16.lds:23: syntax error
    make: *** [out/rom16.o] Error 1

    Build the bios:

    1. Build the bios file:
    Code:
    make
    If make was successful and you received no errors, the bios will be saved to:
    Code:
    biostemp/seaslic-master/seabios.submodule/out/bios.bin

    To run Qemu/KVM with the new bios use the following command option:
    Code:
    -bios bios.bin

     
  18. Gelip

    Gelip MDL Member

    Feb 28, 2011
    158
    45
    10
    SLP working also for coreboot real hardware but SLIC not :-(. Build SeaBIOS after slic.patch OK but probably only for Qemu (bios.bin) not bios.bin.elf or coreboot not add ACPI tables to my hardware.

    Is slic.patch add slic table only for Qemu?