ESX / ESXi Bios Tools

Discussion in 'Virtualization' started by pix, Nov 22, 2009.

  1. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,354
    2,026
    210
    Because 4.1 become fully x64, I believe

    sebus
     
  2. torx666

    torx666 MDL Novice

    Jul 23, 2010
    4
    6
    0
    It works with the objbump and objcopy versions comming with an debian 64 bit version. Section name of .bios440 in vmx file is now only bios440 without the leading point. Apart from that and the unnamed file sys.vgz the procedure is the same as for 4.0.
     
  3. pix

    pix MDL Member

    Nov 3, 2008
    136
    96
    10
    I hadn't actually got this far with this... The biggest obstacle with the method I currently use is that there's not enough space on the root drive to uncompress s.z, after it's been converted to a .gz as it seems to have grown in size. (I'm running ESXi in a 2GB RAM VMWare 7 WS Virtual Machine)

    s.z can't be decompressed to one on the vmfs drives as they don't handle the attributes required so I think a change of tact is required:

    A method that would work is to create a custom x64 distie running as a vm inside ESXi to to scp the s.z file from ESXi and handle all the gz unpacking and elf64 extraction then use a windows tool to scp the unmodded bios file from that server, mod it and scp it back then objcopy the bios back in, gz it and then scp it over to the ESXi server to be repacked as a .z file. Then after an ESXi reboot we'd be back in business.

    Only trouble is that my linux skills are a bit lacking and I've got no time on my hands at the moment to learn what's required. There must be plenty of linux experts out there though?

    If somebody is prepared to knock up a minimal pre-configged x64 linux vm I'm happy to handle the Windows side.

    Anyone want to get involved?
     
  4. torx666

    torx666 MDL Novice

    Jul 23, 2010
    4
    6
    0
    Well, I have actually used a vmfs drive for packing. In my system i have a Datastore4 where i have done the packing and unpacking. So far it has worked very well. Using a x64 linux is exactly what i have done next for extracting the bios. I used a debian distribution. The install of vmware tools then also installs the binutils which include the needed version of objdump and objcopy.
    Maybe for you tool it could be a solution to install this binutils to the esxi as a first step. Then the extaction of the bios file could be done on the esxi side too.
    Although i could not really use your tool it was a great help for me telling me what is to do next. Thanks for that!
     
  5. alien2xx

    alien2xx MDL Senior Member

    Aug 5, 2009
    400
    197
    10
    Hi, until an automated tool is available, do you mind writing a step-to-step tutorial on how to do it manually? I have a Ubuntu server I can use for unpacking, I am planning on upgrading my vSphere server to version 4.1. I am not so good on linux (still learning) but I can follow steps.
    Thanks!
     
  6. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,354
    2,026
    210
    Yes, manual guide would be great, need to do it to my vS 4.1 as well

    sebus
     
  7. affa

    affa MDL Novice

    Mar 22, 2010
    4
    0
    0
    Please please please

    Any news? this will be of great help!
     
  8. torx666

    torx666 MDL Novice

    Jul 23, 2010
    4
    6
    0
    OK, that is what I have done:

    Step 1: Enable SSH on ESXi Server
    On ESXi console press F2 to configure the System. login as root. Go to "Troubleshooting Mode Options" and enable "Remote Tech Support (SSH)". Leave with Esc.
    Step 2: Installing an x64 Linux.
    I can't provide a full installation guide. But I can shortly tell what I have done.
    First I downloaded a debian net install cd: cdimage.debian.org/debian-cd/5.0.5/amd64/iso-cd/debian-505-amd64-netinst.iso
    After burning it to cd I have installed it as a virtual machine in my ESXi Server. Now the vmware tools have to be installed to the new system. Unfortunately this is not as easy as for a windows system. But with a little help of Google this can be managed. In my case this installation installs also the needed binutilities.
    Step 3: Finding the s.z file on ESXi
    To find the location of s.z use winscp.exe. This tool coming with pix's EsxBiostTools. Start it and connect as root to your ESXi server. Don't forget to change the protocol to SCP.
    On the left side of the window you see your windows system on the right side is the ESXi server. Goto /vmfs/volumes/Hypervisor1. If the file is there, remember the location. If it is not, check Hypervisor2 and Hypervisor3. In that case you have to adapt the statements below.
    Step 4: Getting the vmx file
    Now we need a remote shell to execute same statements. For that I used putty.exe. Start the program, connect to your ESXi Server and login as root. If the location of s.z is not Hypervisor1 you have to correct the statements.

    ~ # mkdir /vmfs/volumes/datastore1/t1

    ~ # mkdir /vmfs/volumes/datastore1/t2

    ~ # cp /vmfs/volumes/Hypervisor1/s.z /vmfs/volumes/datastore1/t1/s.gz

    ~ # gunzip /vmfs/volumes/datastore1/t1/s.gz

    ~ # vmtar -x /vmfs/volumes/datastore1/t1/s -o /vmfs/volumes/datastore1/t1/s.tar

    ~ # tar xf /vmfs/volumes/datastore1/t1/s.tar -C /vmfs/volumes/datastore1/t2/

    Start again winscp.exe. Goto /vmfs/volumes/datastore1/t2/bin. Copy the vmx file to your x64 Linux into /tmp/

    Step 5: Extract bios440.rom from vmx
    After you have copied the vmx file to /tmp/ on your x64 Linux start a shell on this system and execute the following commands:

    ~ # objdump --headers /tmp/vmx

    Now you are getting a list of all sections included in vmx. There must be one section named bios440

    ~ # objcopy /tmp/vmx --output-target=binary --only-section=bios440 --set-section-flags bios440=alloc /tmp/bios440.rom.zl

    Now copy the file /tmp/bios440.rom.zl from your Linux system back to c:\temp on your windows system

    Step 6: Extracting bios440.rom.zl
    Unfortunately this is still not yet the needed rom file. We have to decompress it, too. Therfore download:
    componentace.com/data/distr/zlib.NET.zip
    In \zlib\demo\Visual Studio 2005\VB.NET\CompressFile\bin you will find CompressFile.exe. Use this tool to decompress bios440.rom.zl to bios440.rom
    Now we have the needed bios.

    Step 7: Compress bios440.rom
    After you have modified the bios file we have to put it back into the vmx file. To do so first use CompressFile.exe to compress it to bios440_2.rom.zl. Then copy the
    file to your Linux system into /tmp/

    Step 8: Delete section bios440 from vmx file
    Before we can put the new file bios440_2.rom.zl into vmx file we have to delete the old section. Do this on your Linux system by executing:

    ~ # objcopy --remove-section bios440 /tmp/vmx

    Execute

    ~ # objdump --headers /tmp/vmx

    to check if the section is removed.

    Step 9: Put bios440_2.rom.zl into vmx
    Execute:
    ~ # objcopy --add-section bios440=/tmp/bios440_2.rom.zl /tmp/vmx

    And check again:
    ~ # objdump --headers /tmp/vmx

    If everything is OK copy the vmx file back to your ESXi server to /vmfs/volumes/datastore1/t2/bin. Overwrite the existing one.

    Step10: Build a new s.z file
    To build the new s.z file on your ESXi (putty.exe) execute:

    ~ # chmod 755 /vmfs/volumes/datastore1/t2/bin/vmx

    ~ # chmod u+s /vmfs/volumes/datastore1/t2/bin/vmx

    ~ # chown 201:201 /vmfs/volumes/datastore1/t2/bin/vmx

    ~ # rm -R /vmfs/volumes/datastore1/t1/

    ~ # mkdir /vmfs/volumes/datastore1/t1/

    ~ # cd /vmfs/volumes/datastore1/t2/; tar cf /vmfs/volumes/datastore1/t1/s.tar *

    ~ # vmtar -c /vmfs/volumes/datastore1/t1/s.tar -o /vmfs/volumes/datastore1/t1/s.tar.vtar

    ~ # gzip /vmfs/volumes/datastore1/t1/s.tar.vtar

    That is the file we want. If you execute the following statement the original s.z will be replaced!!!!!!!!!!!:

    ~ # mv /vmfs/volumes/datastore1/t1/s.tar.vtar.gz /vmfs/volumes/Hypervisor1/s.z

    Clean up:

    ~ # rm -R /vmfs/volumes/datastore1/t1/

    ~ # rm -R /vmfs/volumes/datastore1/t2/

    Good luck, torx
     
  9. affa

    affa MDL Novice

    Mar 22, 2010
    4
    0
    0
    Going to try it step for stap and give everyone some feedback
     
  10. alien2xx

    alien2xx MDL Senior Member

    Aug 5, 2009
    400
    197
    10
    That is awesome! , Thanks so much.. I will give it a try soon... I'll report how it goes...
     
  11. affa

    affa MDL Novice

    Mar 22, 2010
    4
    0
    0
    Works Great!!!!

    The instructions worked great. I have added some comments:

    1. Instead of building a brand new x64 linux VM, I just downloaded the following Minimal CentOS 5.5 x64 VA:

    www .vmware.com/appliances/directory/575943 <remove the space after www>

    once you have network sorted you'll want to install the Xlib compression pkg by issuing:

    yum update perl-Compress-Zlib

    I couldn't find CompressFile.exe and couldn't be bothered compiling my own, so I used the x64 linux to do the decompressing by issuing the following:

    $ perl -e 'use Compress::Zlib; my $v; read STDIN, $v, [bios440.rom.zl size in bytes]; $v = uncompress($v); print $v;' < bios440.rom.zl > bios440.rom

    Again, I used the linux VM to do the compressing:

    perl -e 'use Compress::Zlib; my $v; read STDIN, $v, 524288; $v = compress($v); print $v;' < bios440_mod.rom > bios440_mod.rom.zl

    Thanks a lot to all!!

    Having done all that, an automated tool would be excellent!! ;););)
     
  12. pix

    pix MDL Member

    Nov 3, 2008
    136
    96
    10
    Great work! For some reason while I was developing the tool I wasn't having any luck with vmfs. That makes life much easier.

    I've used this info in the new version of the tool v1.1.0 which can also now handle ESXi v4.1.0 without needing a linux distie for the objcopy and objdump operations.
     
  13. pix

    pix MDL Member

    Nov 3, 2008
    136
    96
    10
    v1.1.0

    [fix] Now works with ESXi v4.1.0
    [fix] objcopy and objdump updated to handle ELF64 binaries
    [enh] Uses vmfs for decompression
    [enh] Masks password from log files

    See first post for link
     
  14. deMarchi

    deMarchi MDL Junior Member

    Nov 7, 2009
    83
    4
    0
    Guys, I had dell modded bios for esxi vw4.0 (thanks alien2xx!) Now I tried to move to 4.1. Think ESXi Bios Tools works fine (thanks pix and torxx666!) I upgraded one of the esxi servers with vSphere Update managers to 4.1. Extracted new bios with ESXi tool. Got rom and rom.zl files (why I need zl?). Then modded rom file with phoenix tool 1.42 and Rw1.4 to dell slic. Injected new bios back. Anyway when virtual machines running they are not genuine. I did hex compare for pairs of modded and unmodded bioses for 4.0 and new 4.1 and found that 4.0 bioses have significant difference between unmodded and modded bioses, but 4.1 pair has just minor difference. Did anyone tried to move 4.1 (dell slic) with success and how amend new bios properly? Thanks for help!
     
  15. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,354
    2,026
    210
    #95 sebus, Aug 6, 2010
    Last edited by a moderator: Apr 20, 2017
    Sadly it does not work on ESX 3.5.0 build-130756

    The problem is with objcopy 2.20:

    objcopy: Unable to recognise the format of the input file `C:\ESXBiosTools\vmware-vmx'

    objcopy 2.19 & 2.19.1 do not complain, but output only 0k file, v2.18 does not complain, but also outputs 0k

    objdump works fine:

    Code:
    objdump.exe --headers vmware-vmx
    
    vmware-vmx:     file format elf32-little
    
    Sections:
    Idx Name          Size      VMA       LMA       File off  Algn
    27 .bios440      00033fe0  00000000  00000000  0048fd2f  2**0
                     CONTENTS, READONLY
    
    sebus
     
  16. pix

    pix MDL Member

    Nov 3, 2008
    136
    96
    10
    v1.1.1
    [fix] uses objcopy v2.191 for elf32 binaries

    Broken... need to use 2.18
     
  17. pix

    pix MDL Member

    Nov 3, 2008
    136
    96
    10
    v1.1.2

    [fix] Uses v2.18 of objcopy for ELF32
    [enh] objcopy versions named objcopy32.exe and objcopy64.exe so you can swap them out meaningfully

    Confirmed working with v3.5-4.1 ESX and ESXi
     
  18. sebus

    sebus MDL Guru

    Jul 23, 2008
    6,354
    2,026
    210
    Version 2.18, 2.19 & 2.19.1 all work fine, but I see that you now made the extraction command being correct:

    objcopy.exe "/ESXBiosTools/vmware-vmx" --output-target=binary --only-section=.bios440 --set-section-flags .bios440=alloc "bios440.rom.zl"

    Previous version of EsxBiosTools was missing the . (dot) before bios440, hence it was outputting 0k

    Well done! Perfect tool!:worthy:

    sebus
     
  19. Ales999

    Ales999 MDL Novice

    Sep 25, 2010
    8
    1
    0
    #100 Ales999, Sep 26, 2010
    Last edited by a moderator: Apr 20, 2017
    Strange, not check 'updated' or build in boot.cfg ? EsxBiosTools.v1.1.2 read OLD bios440.rom from 'Hypervisor2' and put to 'Hypervisor2' ! :-(
    So, reboot ESXi read bios from new build and my bios modify not uses. :-(
    Code:
    Copying sys.vgz from HypervisorX folders
    # cp /vmfs/volumes/Hypervisor1/sys.vgz /vmfs/volumes/4c215666-f126ea0b-9b42-002655555c12/vmvisor-sys/sys.gz
    # cp /vmfs/volumes/Hypervisor2/sys.vgz /vmfs/volumes/4c215666-f126ea0b-9b42-002655555c12/vmvisor-sys/sys.gz
    # cp /vmfs/volumes/Hypervisor3/sys.vgz /vmfs/volumes/4c215666-f126ea0b-9b42-002655555c12/vmvisor-sys/sys.gz
    No sys.vgz in Hypervisor3 folder
    Gunzipping sys.gz to vtar file
    
    Hm, read last sys.gz from Hypervisor :-(
    Code:
    /vmfs/volumes/386a41e4-ff1587ba-1385-2feaeed494ad # cd ../Hypervisor1
    /vmfs/volumes/386a41e4-ff1587ba-1385-2feaeed494ad # cat boot.cfg 
    kernel=vmkboot.gz
    kernelopt=
    modules=vmk.gz --- sys.vgz --- cim.vgz --- oem.tgz --- license.tgz --- mod.tgz --- vpxa.vgz --- aam.vgz
    build=4.0.0-2.17.261974
    updated=5
    bootstate=0
    
    /vmfs/volumes/386a41e4-ff1587ba-1385-2feaeed494ad # cd ../Hypervisor2
    /vmfs/volumes/8c7e2fe8-f4c58d9f-34d3-8553ffee79a0 # cat boot.cfg 
    kernel=vmkboot.gz
    kernelopt=
    modules=vmk.gz --- sys.vgz --- cim.vgz --- oem.tgz --- license.tgz --- mod.tgz --- vpxa.vgz --- aam.vgz
    build=4.0.0-1.13.256968
    updated=4
    bootstate=0
    
    In getted bios - my old data, from build 256968:
    0000043C50: 00 01 00 48 50 51 4F 45 │ 4D 53 4C 49 43 2D 4D 50 ☺ HPQOEMSLIC-MP

    PS My ESXi start from USB!
    PSPS Sorry for my bad english please.