Twitter
LinkedIn
RSS

PXE Manager – Part IV

PXE Manager Part IV – Add a driver into the ESXi image (oem.tgz) Although this may sound a bit complicated for what I was trying to achieve but I really could not find a different way to get it working in combination with PXE Manager. The idea was that the ESXi hosts PXE boots, run through the installer and on its firstboot it installs the driver (the servers I was working with were assembled with the Emulex OneConnect NIC cards), reboot and then PXE Manager continues its process by applying the host-profile as specified (the driver had to be installed as otherwise the host-profiles wouldn’t configure the server properly as the additional NIC’s were missing). Great idea but no matter what I tried it didn’t work so I thought lets integrate the Emulex OneConnect driver into the ESXi build.

In order to properly integrate the driver into the build, it took me quite a few hours as I initially tried to do it on Windows however everytime the ESXi boots up after the installer it told me that image is corrupted. Therefore I decided to use CentOS and it worked fine, so save yourself some time and use a linux virtual machine to perform the following procedure. In order to add the Emulex OneConnect driver into the image we would have to modify the oem.tgz file which includes additional drivers that will be installed by the ESXi installer.

  1. I used a CentOS virtual machines, connect the ESXi 4.1 Installable ISO file to the virtual machine and mount it:
    1. “mkdir /mnt/cd”
    2. “mount /dev/cdrom /mnt/cd”
  2. Make a temporary folder where we are going to store the “imagedd.bz2″ file
    1. “mkdir /tmp/imagedd”
  3. Next copy the “imagedd.bz2″ file to the “/tmp/imagedd” folder
    1. “cp /mnt/cd/imagedd.bz2 /tmp/imagedd/”
  4. Unzip the “imagedd.bz2″ file
    1. “bunzip2 /tmp/imagedd/imagedd.bz2″
  5. Check the contents of the “imagedd” file and mount the fifth partition:
    1. “cd /tmp/imagedd”
    2. “fdisk -ul imagedd”
    3. “mkdir /mnt/imagedd”
    4. “mount -o loop /tmp/imagedd/imagedd /mnt/imagedd -o offset=$((8224*512))”
    5. “cd /mnt/imagedd”
  6. Now copy the “oem.tgz” file to a temporary location and extract the contents:
    1. “mkdir /tmp/oem”
    2. “cp /mnt/imagedd/oem.tgz /tmp/oem”
    3. “cd /tmp/oem”
    4. “tar -xzvf oem.tgz”
  7. Now get the Emulex OneConnect NIC driver or whatever driver you wish to integrate and prepare the necessary files:
    1. Unzip the “EMU-be2net-2.104.277.3-offline_bundle-416102.zip”
    2. Unzip the “vmware-esx-drivers-net-be2net-400.2.104.277.3-1vmw.2.17.249663.x86_64.vib”
    3. Unzip the “data.tar” file
    4. “mkdir /tmp/driver”
    5. copy the “.\etc\vmware\init\manifests\vmware-be2net.mf” to the “/tmp/driver”
    6. copy the “.\etc\vmware\pciid\be2net.xml to the /tmp/driver”
    7. copy the “.\usr\lib\vmware\vmkmod\be2net.o to the /tmp/driver”
    8. unzip the ” metadata.zip” and the “Packages.gz” file (located in the “ESXi” folder)
    9. open the “.\ESXi\build\mts\release\bora-416102\release\build\partnerasync\tmpaESMdU\MetadataBuilder-stage\ESXi\Packages” file and take note of the packages value as we will give the files we create in the following step the same name.

  8. Create the following files and copy them into the “/tmp/driver” folder:
    1. vmware-esx-drivers-net-be2net.control (use the values from the “packages” file)

    1. vmware-esx-drivers-net-be2net.list

    1. vmware-esx-drivers-net-be2net.postinst

    1. vmware-esx-drivers-net-be2net.postrm

    1. vmware-esx-drivers-net-be2net.preinst

    1. vmware-esx-drivers-net-be2net.prerm

  9. Next we have to modify the “oem.tgz” contents:
    1. “cp /tmp/driver/vmware-be2net.mf /tmp/oem/etc/vmware/init/manifests/”
    2. “cp /tmp/driver/be2net.xml /tmp/oem/etc/vmware/pciid/”
    3. “cp /tmp/driver/be2net.o /tmp/oem/usr/lib/vmware/vmkmod/”
    4. “cd /tmp/oem/var/db/esxupdate/”
    5. Exract the “oem-pkgdb.tgz” file -> “tar -xzvf oem-pkgdb.tgz”
    6. “cp /tmp/driver/vmware-esx-drivers-net-be2net.* /tmp/oem/var/db/esxupdate/info/”
    7. add the following at the of the /tmp/oem/var/db/esxupdate/status file:

    1. compress the info folder and the status file and cleanup:
      1. “tar -zcf /tmp/tom/oem/var/db/esxupdate/oem-pkgdb.tgz info status”
      2. “rm -r -f info/”
      3. “rm -f status”
    2. Now have to rebuild the “oem.tgz” file:
      1. “cd /tmp/oem/”
      2. “tar -zcf /tmp/oem/oem.tgz etc lib sbin usr var”
  10. Copy the modified oem.tgz file into the imagedd mount point:
    1. “cp /tmp/oem/oem.tgz /mnt/imagedd/oem.tgz”
  11. Unmount the imagedd mount point:
    1. “umount /mnt/imagedd”
  12. Compress the imagdd file back:
    1. “bzip2 /tmp/imagedd/imagedd”
  13. Copy the imagedd.bz2 to your PXE Manager server into the proper build folder
  14. Verify the checksum of the modified “imagedd” file and modify the “imagedd.md5″ file into the proper build folder:
    1. md5sum imagedd.bz2
  15. replace the checksum value into the imagedd.md5 file located on the proper build folder on the PXE manager server

     

    Update: PXE Manager checks the MD5 value of each file, therefore by copying the “imagedd.bz2″ file directly into the build folder, PXE Manager will determine it is corrupt and will overwrite the file. In order to get a around this, you would have to make a new ISO image and create a new build based on the custom made ISO image. Thanks Max !

     

  16. In order to make a custom ISO:
    1. Create a temporary folder: “mkdir /tmp/iso”
    2. Copy the contents of the cdrom to the temporary folder: “cp –a /mnt/cdrom/* /tmp/iso”
    3. Next overwrite the original “imagedd.bz2″ with the custom made” imagedd.bz2″ file: “cp /tmp/imagedd/imagedd.bz2 /tmp/imagedd.bz2″
    4. Verify the checksum of the modified “imaged.bz2″ file and modify the “imagedd.md5″ file into the /tmp/iso folder:
      1. md5sum imagedd.bz2
      2. replace the checksum value into the imagedd.md5 file located in the /tmp/iso folder
    5. Create a new ISO image:
      1. cd /tmp/iso
      2. mkisofs -o VMware-VMvisor-Installer-4.1.0.update1-348481.x86_64_customdriver.iso -b isolinux.bin -c BOOT.CAT-no-emul-boot -boot-load-size 4 -boot-info-table ./
    6. Use the new ISO image to create a new PXE build.



2 Responses to “PXE Manager – Part IV”

  1. Great series!
    You might want to take a look at this tool:
    http://v-front.blogspot.com/p/esxi-customizer.html
    Forbes

Leave a Reply