Friday, December 02, 2011

iPXE: Boot iPXE Linux kernel via PXELinux

iPXE Linux kernel (ipxe.lkrn) may chain loaded by PXELinux:

default boot

label boot
        kernel ipxe.lkrn

Both iPXE firmware (undionly.kpxe) or iPXE kernel image (ipxe.lkrn) has same functions.  All usage of iPXE commands / scripts remain the same for both firmware and kernel.

Problem with Dell Vostro notebook

All the time I use PC with iPXE firmware (undionly.kpxe) with WinPE and SanBoot without problem.  If I boot Dell Vostro notebook with the same booting steps as PC, the WinPE or SanBoot doesn’t work at all.  The reason remain unknown.  Here are my booting steps:

Scenario A

  1. Switch on machine
  2. DHCP –> undionly.kpxe (undionly.0)
  3. Chain to load WinPE image
  4. Show blank screen after WinPE image

Scenario B

  1. Switch on machine
  2. DHCP –> undionly.kpxe (undionly.0)
  3. sanboot iSCSI target
  4. Machine hang while booting

Both scenario A and B works fine on PC but doesn’t work on Dell Vostro notebook.

I suspect the problem is related to:

  1. iPXE firmware
  2. Notebook network card’s firmware doesn’t work well with iPXE firmware.

Dell Vostro notebook work with iPXE kernel

While trying to find solution solving the mystery problem with Dell Vostro notebook, I found that iPXE kernel works.  I may load WinPE image or SanBoot a Windows ISCSI target with iPXE kernel chain loaded by PXELinux.

  1. Prepare ipxe.lkrn
    -bash-4.1$ git clone git://git.ipxe.org/ipxe.git
    -bash-4.1$ cd ipxe
    -
    bash-4.1$ make src/bin/ipxe.lkrn
  2. Copy src/bin/ipxe.lkrn to TFTP boot directory.
    # cp src/bin/ipxe.lkrn /var/lib/tftpboot
  3. Update dhcp configuration file: /etc/dhcp/dhcpd.conf to prevent infinite iPXE boot when ipxe.lkrn boot:
            if exists user-class and option user-class = "iPXE" {
                    filename "http://<ip-address>/boot.ipxe";
            } else {
                    filename "pxelinux.0";
            }
  4. Load ipxe.lkrn after PXELinux boot:
    # cat pxelinux.cfg/default
    default boot
    
    label boot
            kernel ipxe.lkrn
  5. iPXE kernel will query DHCP server again, DHCP will send boot.ipxe script file via HTTP to the machine:
    #!ipxe
    set 209:string pxelinux.cfg/boot
    set 210:string http://<ip-address>/
    chain ${210:string}pxelinux.0
  6. boot.ipxe will chain load pxelinux.0 with new configuration file: pxelinux.cfg/boot:
    # cat pxelinux.cfg/boot
    default menu.c32
    prompt 0
    
    LABEL boot_local
            menu label ^Boot Local System
            menu default
            localboot 0
            timeout 50
    
    LABEL boot_san
            menu label Boot ^Storage Area Network
            com32 syslinux/gpxecmd.c32
            append sanboot iscsi:<iscsi-host>::::iqn.example.com:win7
    
    LABEL WINDOWS_PE
            menu label ^Windows Preinstallation Exnvironment
            kernel windows.pe/pxeboot.0
  7. Both SanBoot and Window PE image works with Dell Vostro notebook now.

No comments: