WDSLINUX

From Syslinux Wiki
Jump to: navigation, search


Creating a PXE Boot menu for deploying Linux with Windows Deployment Services (WDS)

See also:

Requirements

  • PXELINUX
  • Windows Deployment Services already set up. Setting up WDS is outside the scope of this article
    • NOTE: $WDS-ROOT will reference the WDS root folder location (e.g. D:\RemoteInstall\)
  • In this article, the following directory tree (and files) will be used:
$WDS-ROOT\Boot\$ARCH\
                   |
                   |
         $WDS-ROOT\
         |_ Boot\
                |_ x86\
                |     |_ pxelinux.0    ⇒  pxelinux.com
                |     |_ abortpxe.com  ⇒  abortpxe.0
                |     |_ pxeboot.n12   ⇒  pxeboot.0
                |     |_ *.c32
                |     |_ ...
                |     |_ Linux\
                |     |_ pxelinux.cfg\
                |                    |_ default
                |
                |_ x64\
                      |_ pxelinux.0    ⇒  pxelinux.com
                      |_ abortpxe.com  ⇒  abortpxe.0
                      |_ pxeboot.n12   ⇒  pxeboot.0
                      |_ *.c32
                      |_ ...
                      |_ Linux\
                      |_ pxelinux.cfg\
                                     |_ default

How To Setup Windows Deployment Services with PXELinux

  • Download Syslinux
  • Extract
    • core\pxelinux.0
    • com32\menu\vesamenu.c32
    • com32\modules\chain.c32
    • [5.00+] and the necessary library modules

    from the Syslinux download and put them on your WDS server in (respective) $WDS-ROOT\Boot\$ARCH\ folders

    • substitute WDS-ROOT for where your WDS root folder is
    • substitute $ARCH with respective x86 and/or x64 folders (architectures)
    • Depending on the version, you may also need additional modules such as ldlinux.c32, libcom32.c32 and libmenu.c32. See also ELF missing dependencies
  • In the $WDS-ROOT\Boot\$ARCH\ folders, rename pxelinux.0 to pxelinux.com
  • Create a folder named pxelinux.cfg (in the $WDS-ROOT\Boot\$ARCH\ folders)
  • In the pxelinux.cfg folder, create a text file named default and add the following to it (you can substitute MyMenuBackgroundPicture640x480.jpg for any image you want as your menu background)
     DEFAULT      vesamenu.c32
     PROMPT       0
     NOESCAPE     0
     ALLOWOPTIONS 0
     # Timeout in units of 1/10 s
     TIMEOUT 300
     MENU MARGIN 10
     MENU ROWS 16
     MENU TABMSGROW 21
     MENU TIMEOUTROW 26
     MENU COLOR BORDER 	30;44 	#20ffffff #00000000 none
     MENU COLOR SCROLLBAR 	30;44 	#20ffffff #00000000 none
     MENU COLOR TITLE 	0 	#ffffffff #00000000 none
     MENU COLOR SEL   	30;47 	#40000000 #20ffffff
     MENU BACKGROUND MyMenuBackgroundPicture640x480.jpg
     MENU TITLE PXE Boot Menu
     
     LABEL wds
     MENU LABEL Windows Deployment Services
     KERNEL pxeboot.0
     
     LABEL abort
     MENU LABEL AbortPXE
     KERNEL	abortpxe.0
     
     LABEL local 
     MENU DEFAULT
     MENU LABEL Boot from Harddisk
     LOCALBOOT 0
     # Type 0x80
    
  • Make a copy of pxeboot.n12 and name it pxeboot.0
  • Make a copy of abortpxe.com and rename it abortpxe.0
  • Create a folder named Linux (in the $WDS-ROOT\Boot\$ARCH\ folders)
    • Open the Windows Deployment Services Console,
    • Right Click on your Server and Select Properties,
    • From the Boot Tab, change the default boot program for your architecute (x86 and x64 as well) to $WDS-ROOT\Boot\x86\pxelinux.com and $WDS-ROOT\Boot\x64\pxelinux.com respectively
      • NOTE: In the WDS included in Windows Server 2008 R2, the UI has changed and you have to use the command line in order to set the default boot program. Thus, to change the boot program to pxelinux.com, the wdsutil command line tool has to be used (for x86 and/or x64, respectively):
         wdsutil /set-server /bootprogram:boot\x86\pxelinux.com /architecture:x86
         wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.com /architecture:x86
        
         wdsutil /set-server /bootprogram:boot\x64\pxelinux.com /architecture:x64
         wdsutil /set-server /N12bootprogram:boot\x64\pxelinux.com /architecture:x64
        
    • Now when you pxe boot a machine, you will get your custom boot menu.

    Adding Linux images to boot/install

    Debian and Ubuntu

    $WDS-ROOT\Boot\$ARCH\
                        |_ Linux\
                                |_ Debian5\
                                |_ Ubuntu\
    
    • Copy the downloaded netboot files initrd.gz and linux to the new folder
    • Create a menu entry at the end of the $WDS-ROOT\Boot\$ARCH\pxelinux.cfg\default file
      • (boot menu items for debian and ubuntu can be found in the download site under "boot-screens" in the "text.cfg" file)
     LABEL debian5-0expert
     MENU LABEL ^Debian 5-0 Expert install:
     KERNEL Linux/Debian5/linux
     APPEND priority=low vga=normal initrd=Linux/Debian5/initrd.gz -- 
     
     LABEL debian5-0rescue
     MENU LABEL ^Debian 5-0 Rescue mode
     KERNEL Linux/Debian5/linux
     APPEND vga=normal initrd=Linux/Debian5/initrd.gz rescue/enable=true -- quiet 
     
     LABEL debian5-0auto
     MENU LABEL ^Debian 5-0 Automated install
     KERNEL Linux/Debian5/linux
     APPEND auto=true priority=critical vga=normal initrd=Linux/Debian5/initrd.gz -- quiet 
     
     LABEL debian5-0amd64expert
     MENU LABEL ^Debian 5-0 amd64 Expert install
     KERNEL Linux/Debian5/linux-amd64
     APPEND priority=low vga=normal initrd=Linux/Debian5/initrd-amd64.gz -- 
     
     LABEL debian5-0amd64rescue
     MENU LABEL ^Debian 5-0 amd64 Rescue mode
     KERNEL Linux/Debian5/linux-amd64
     APPEND vga=normal initrd=Linux/Debian5/initrd-amd64.gz rescue/enable=true -- quiet 
     
     LABEL debian5-0amd64auto
     MENU LABEL ^Debian 5-0 amd64 Automated install
     KERNEL Linux/Debian5/linux-amd64
     APPEND auto=true priority=critical vga=normal initrd=Linux/Debian5/initrd-amd64.gz -- quiet 
     
     LABEL ubuntu-expert
     MENU LABEL ^Ubuntu Expert install
     KERNEL Linux/Ubuntu/linux
     APPEND priority=low vga=normal initrd=Linux/Ubuntu/initrd.gz -- 
     
     LABEL ubuntu-cli-expert
     MENU LABEL ^Ubuntu Command-line expert install
     KERNEL Linux/Ubuntu/linux
     APPEND tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false priority=low vga=normal initrd=Linux/Ubuntu/initrd.gz -- 
     
     LABEL ubuntu-rescue
     MENU LABEL ^Ubuntu Rescue mode
     KERNEL Linux/Ubuntu/linux
     APPEND vga=normal initrd=Linux/Ubuntu/initrd.gz rescue/enable=true -- quiet 
     
     LABEL ubuntu-expert-amd64
     MENU LABEL ^Ubuntu-amd64 Expert install
     KERNEL Linux/Ubuntu/linux-amd64
     APPEND priority=low vga=normal initrd=Linux/Ubuntu/initrd-amd64.gz -- 
     
     LABEL ubuntu-amd64-cli-expert
     MENU LABEL ^Ubuntu-amd64 Command-line expert install
     KERNEL Linux/Ubuntu/linux-amd64
     APPEND tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false priority=low vga=normal initrd=Linux/Ubuntu/initrd-amd64.gz -- 
     
     LABEL ubuntu-amd64-rescue
     MENU LABEL ^Ubuntu-amd64 Rescue mode
     KERNEL Linux/Ubuntu/linux-amd64
     APPEND vga=normal initrd=Linux/Ubuntu/initrd-amd64.gz rescue/enable=true -- quiet
    

    Gentoo

    • Download the latest gentoo minimal install CD from a mirror
    • Extract the files:
      • isolinux/gentoo
      • isolinux/gentoo.igz
      • image.squashfs

      from the iso to a temporary folder

    • Make a folder on the WDS server under $WDS-ROOT\Boot\$ARCH\Linux\ called Gentoo
      $WDS-ROOT\Boot\$ARCH\
                          |_ Linux\
                                  |_ Gentoo\
      
    • Copy the extracted gentoo file to the $WDS-ROOT\Boot\$ARCH\Linux\Gentoo\ folder on the WDS server
    • Copy the extracted gentoo.igz and image.squashfs files to a temporary location on a linux machine (e.g. "/root/tmp/")
    • In the "/root/tmp/" location, create a folder called Gentoo and change into this directory
       mkdir /root/tmp/Gentoo
       cd /root/tmp/Gentoo
      
    • Extract all the files from the gentoo.igz file
       gunzip -c ../gentoo.igz | cpio -idv
      
    • Make the following folders (in the extracted folder)
       mkdir mnt
       mkdir mnt/cdrom
      
    • Copy the image.squashfs file to the newly-created mnt/cdrom/ folder
       cp ../image.squashfs mnt/cdrom
      
    • Make a backup copy of the init file
       cp init init.orig
      
    • Edit the init file with the following modifications:
       Change the line:
         -- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
       To:
         ++ if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ] && [ "${REAL_ROOT}" != "/" ]
       
       Change the line (under  # Check for a block device or /dev/nfs):
         -- elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "/dev/nfs" ]
       To:
         ++ elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "/dev/nfs" ] || [ "${REAL_ROOT}" = "/" ]
       
       Remove the line:
         -- cache_cd_contents
       
       Change the line:
         -- mount -t squashfs -o loop,ro ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP} ${NEW_ROOT}/mnt/livecd
       To:
         ++ mount -t squashfs -o loop,ro /mnt/cdrom/${LOOPEXT}${LOOP} ${NEW_ROOT}/mnt/livecd    
      
    • Compress everything back into a file again by typing the following and press enter:
       find . -print | cpio -o -H newc |gzip -9 -c - > ../gentoo.igz.new
      
    • Copy the new gentoo.igz.new to the $WDS-ROOT\Boot\$ARCH\Linux\Gentoo\ folder on the WDS server and name it gentoo.igz
    • Create a menu entry at the end of the $WDS-ROOT\Boot\$ARCH\pxelinux.cfg\default file
       LABEL gentoo2008-x86
       MENU LABEL Deploy Gentoo 32 bit
       KERNEL Linux/Gentoo/gentoo
       APPEND root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=Linux/Gentoo/gentoo.igz real_root=/ vga=791
       
       LABEL gentoo2008-x64
       MENU LABEL Deploy Gentoo amd64
       KERNEL Linux/Gentoo/gentoo-amd64
       APPEND root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=Linux/Gentoo/gentoo-amd64.igz real_root=/ vga=791
      
    • GParted

      • Download GParted live zip file (You have to use 0.3.7-2 or later, network drivers are only included after that), and unzip all the files in a temp dir
      • Copy necessary boot files (vmlinuz1 and initrd1.img) to a new folder on your WDS server ($WDS-ROOT\Boot\$ARCH\Linux\Gparted\)
      $WDS-ROOT\Boot\$ARCH\
                          |_ Linux\
                                  |_ Gparted\
      
      • Copy /tmp/gparted/live/filesystem.squashfs to your http web server. (If on IIS, create a new virtual directory and set the mime type for ".*" extension to text/plain)
      • Edit your PXE config file $WDS-ROOT\Boot\$ARCH\pxelinux.cfg\default, and append the following:
       LABEL GParted Live
       MENU LABEL GParted Live
       KERNEL Linux/Gparted/vmlinuz1
       APPEND initrd=Linux/Gparted/initrd1.img boot=live union=aufs noswap noprompt vga=788 fetch=http://$webserverIP/gparted/filesystem.squashfs
       # //NOTE// Replace $webserverIP with your IP address of http server.
      

      As of GParted-live version 0.3.8-3, fetch=tftp is supported. Just copy the filesystem.squashfs file into the same folder as vmlinuz1 and initrd1.img (in the above example, it would be Linux\Gparted\). The above APPEND can then be replaced with:

       APPEND initrd=Linux/Gparted/initrd1.img boot=live union=aufs noswap noprompt vga=788 fetch=tftp://$tftpserverIP/gparted/filesystem.squashfs
       # //NOTE// Replace $tftpserverIP with the IP address of your tftp server.
      

      See also linux.c32.

      F-Secure Antivirus Rescue CD

      $WDS-ROOT\Boot\$ARCH\
                          |_ Linux\
                                  |_ Fsecure\
      
      • Extract the boot/isolinux/fsecure/minirt.gz file and whole KNOPPIX folder from the ISO
      • Copy the extracted minirt.gz file and KNOPPIX folder to a temporary location on a linux machine (e.g. /root/tmp/)
      • In the /root/tmp/ location, create a folder called fsecure and change into this directory
       mkdir /root/tmp/fsecure
       cd /root/tmp/fsecure
      
      • Extract all the files from the minirt.gz file
       gunzip -c ../minirt.gz | cpio -idv
      
      • Copy the KNOPPIX folder extracted from the ISO to the mnt-system folder
       cp -r ../KNOPPIX mnt-system
      
      • Make a backup copy of the init file
       cp init init.orig
      
      • Edit the init file with the following modifications
        • find the findknoppix devices section and delete everything from it
       findknoppix(){
       -- local dev
       -- for dev in "$@"; do
       --  [ -b "$dev" ] || continue
       --  echo -n -e "\r${CRE}${BLUE}${SEARCHINGFOR} $DISTRO in: ${MAGENTA}$dev${NORMAL}   "
       --  trymount "$dev" /mnt-system >/dev/null 2>&1 || continue
       --  if [ -r /mnt-system/"$knoppix_dir"/KNOPPIX ] ; then
       --      # We must have also fsecure structure present else we might try to mount something wrong.
       --      if [ -d /mnt-system/fsecure/rescuecd ] || [ -d /mnt-system/boot/isolinux/fsecure ] ; then
       --         echo -e "\r${CRE}${GREEN}$DISTRO ${FOUNDAT}: ${MAGENTA}$dev${NORMAL}       "
       --         return 0
       --      fi
       --  fi
       --  umount /mnt-system
       -- done
       -- return 1
      
      • Add return 0 to the findknoppix devices section
       findknoppix(){
       ++ return 0
       }
      
      • Compress everything back into a file again
       find . -print | cpio -o -H newc |gzip -9 -c - > ../minirt.gz.new 
      
      • Copy the new minirt.gz.new file to the $WDS-ROOT\Boot\$ARCH\Linux\Fsecure\ folder on the WDS server and name it minirt.gz
      • Create a menu entry at the end of the $WDS-ROOT\Boot\$ARCH\pxelinux.cfg\default file
       LABEL fsecurerescuecd
       MENU LABEL F-Secure AV Rescue CD
       KERNEL Linux/Fsecure/linux
       APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=0x311 initrd=Linux/Fsecure/minirt.gz nomce quiet loglevel=1 nolapic_timer nosound console=tty10 video=noblank
      

      See also linux.c32.

      Knoppix

      See [1] for details

      Citrix XenServer (Redhat/Centos)

      • Download the latest XenServer ISO's
      • Make a folder on the WDS server under $WDS-ROOT\Boot\$ARCH\Linux\ called Xenserver
      $WDS-ROOT\Boot\$ARCH\
                          |_ Linux\
                                  |_ Xenserver\
      
      • Extract the following files from the first XenServer ISO
        • /install.img
        • /boot/xen.gz
        • /boot/vmlinuz
        • /boot/isolinux/mboot.c32
        • the whole /packages.main folder
      • Extract the following files from the second XenServer ISO
        • the whole /packages.linux folder
      • Copy the extracted files to the $WDS-ROOT\Boot\$ARCH\Linux\Xenserver\ folder on the WDS server
      • Create a virtual directory in IIS on the WDS server called Xen$version (e.g. xen5-5 ) with read access pointing to the $WDS-ROOT\Boot\$ARCH\Linux\Xenserver\ folder
      • On the new IIS virtual directory, add the mime type for extension ".*" text/plain
      • Edit your PXE config file $WDS-ROOT/Boot/$ARCH/pxelinux.cfg/default, and append the following:
       LABEL xenserver5-5beta
       MENU LABEL Citrix ^Xen Server 5.5 install
       KERNEL Linux/Xenserver/mboot.c32
       APPEND Linux/Xenserver/xen.gz dom0_mem=752M com1=115200,8n1 console=com1,tty --- Linux/Xenserver/vmlinuz console=ttyS0,115200n8 console=tty0 --- Linux/Xenserver/install.img
      
      • When installing xen, select install from http/ftp and type-in the location of your wds/web server (IIS webserver as configured above, e.g. http://172.16.0.1/xen5-5 )