From Fedora Project Wiki
Line 56: Line 56:
           }
           }
   }</pre>
   }</pre>
# Add a grub config file to <code>/var/lib/tftpboot/efi/efidefault</code> and a syslinux config file to <code>/var/lib/tftpboot/pxelinux/pxelinux.cfg/default</code>.
# Add a grub config file to <code>/var/lib/tftpboot/efi/grub.cfg</code> and a syslinux config file to <code>/var/lib/tftpboot/pxelinux/pxelinux.cfg/default</code>.
#* A sample grub config file at <code>/var/lib/tftpboot/efi/efidefault</code> might look like:
#* A sample grub config file at <code>/var/lib/tftpboot/efi/grub.cfg</code> might look like:
<pre>set default=0
<pre>set default=0
if loadfont /unicode.pf2
if loadfont /unicode.pf2

Revision as of 16:48, 17 November 2014

network booting

This describes how to set up a server for network booting of both UEFI and BIOS clients.

packages

On the server, you'll need several packages:

  1. dhcpd
  2. tftp-server
  3. grub-efi
  4. syslinux

setup

  1. Make sure tftp is enabled in /etc/xinetd.d/tftp
  2. Copy necessary files:
    • mkdir /var/lib/tftpboot/efi/ /var/lib/tftpboot/pxelinux/ /var/lib/tftpboot/pxelinux/pxelinux.cfg
    • cp /boot/efi/EFI/redhat/shim.efi /var/lib/tftpboot/efi/bootx64.efi
    • cp /boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/efi/grubx64.efi
    • cp /usr/share/grub/unicode.pf2 /var/lib/tftpboot/efi/unicode.pf2
    • cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux/pxelinux.0
  3. Configure your dhcpd server to use the EFI boot images packaged with grub, and configure a test system to boot using the EFI boot image. A sample configuration in /etc/dhcpd.conf might look like:
  option space PXE;
  option PXE.mtftp-ip    code 1 = ip-address;
  option PXE.mtftp-cport code 2 = unsigned integer 16;
  option PXE.mtftp-sport code 3 = unsigned integer 16;
  option PXE.mtftp-tmout code 4 = unsigned integer 8;
  option PXE.mtftp-delay code 5 = unsigned integer 8;
  option arch code 93 = unsigned integer 16;

  option space pxelinux;
  option pxelinux.magic code 208 = string;
  option pxelinux.configfile code 209 = text;
  option pxelinux.pathprefix code 210 = text;
  option pxelinux.reboottime code 211 = unsigned integer 32;

  subnet 10.0.0.0 netmask 255.255.255.0 {
          option routers 10.0.0.254;
          range 10.0.0.2 10.0.0.253;

          class "pxeclients" {
                  match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
                  next-server 10.0.0.1;
                 
                  if option arch = 00:07 {
                          filename "efi/bootx64.efi";
                  } else {
                          filename "pxelinux/pxelinux.0";
                  }
          }

          host example-ia32 {
                  hardware ethernet XX:YY:ZZ:11:22:33;
                  fixed-address 10.0.0.2;
          }
  }
  1. Add a grub config file to /var/lib/tftpboot/efi/grub.cfg and a syslinux config file to /var/lib/tftpboot/pxelinux/pxelinux.cfg/default.
    • A sample grub config file at /var/lib/tftpboot/efi/grub.cfg might look like:
set default=0
if loadfont /unicode.pf2
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5

menuentry 'Fedora 20' {
  load_video
  set gfxpayload=keep
  insmod gzip
  insmod part_gpt
  insmod ext2
  linuxefi /vmlinuz-3.16.3-200.fc20.x86_64
  initrdefi /initramfs-3.16.3-200.fc20.x86_64.img
}
    • A sample syslinux config file at /var/lib/tftpboot/pxelinux/pxelinux.cfg/default might look like:
default vesamenu.c32
IPAPPEND 2
timeout 100

label Fedora
	MENU rawhide x86_64
	kernel /rawhide-x86_64/vmlinuz
	append initrd=/rawhide-x86_64/initrd.img
It's fine not to have a background image on BIOS, but you'll need one in UEFI or else you won't get a console device set up properly.
  1. Copy the splash and boot images into your tftp directory:
    • cp /boot/grub/splash.xpm.gz /var/lib/tftpboot/pxelinux/splash.xpm.gz
    • cp /path/to/x86_64/os/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/rawhide-x86_64/
    • cp -al /var/lib/tftpboot/pxelinux/rawhide-x86_64/ /var/lib/tftpboot/efi/rawhide-x86_64/