Basis - gPXE

How to boot linux

From cli

At the gPXE prompt you have to type the comand line for loading linux kernel and start the boot.

it's not very different than a normal grub config.

gPXE boot over CLI

gPXE> kernel http://bootserver.my.zone.tld/linux/kernel-genkernel-x86_64-2.6.36-gentoo-r1 root=/dev/ram0 real_root=/dev/sda2 resume=/dev/sda3 init=/linuxrc console=tty1 doscsi
gPXE> initrd http://bootserver.my.zone.tld/linux/initramfs-genkernel-x86_64-2.6.36-gentoo-r1
gPXE> boot

From http

We can load the same kernel and initrd by http.

gPXE boot over http

gPXE> dhcp net0
gPXE> set filename http://bootserver.my.zone.tld/linux/linux.gpxe
gPXE> autoboot

And we have in the linux.gpxe file the content of the cli sequence.

linux.gpxe

#!gpxe
dhcp net0
kernel http://bootserver.my.zone.tld/linux/kernel-genkernel-x86_64-2.6.36-gentoo-r1 root=/dev/ram0 real_root=/dev/sda2 resume=/dev/sda3 init=/linuxrc console=tty1 doscsi
initrd http://bootserver.my.zone.tld/linux/initramfs-genkernel-x86_64-2.6.36-gentoo-r1
boot

From scripts

for the scripting, we embed a script in the gPXE boot loader during the compilation of the binary.

cd /data/Tools/gpxe/src

make EMBEDDED_IMAGE=/data/Tools/linux.gpxe bin/undionly.kpxe

With this pxe boot file, we auto load the gPXE script and start the conputer with the linux kernel.

this 3 methods do exact same thing, we boot a linux kernel with the same parameters.

How to boot windows

Explanations

This is exactly the same, but the kenel file is not the same.

We need a Windows PE disk image(WinPE.img).

From http

First load the script for booting windows PE.

gPXE boot over http

gPXE> dhcp net0
gPXE> set filename http://bootserver.my.zone.tld/windows/windows.gpxe
gPXE> autoboot

And the windows.gpxe script start the windows PE system.

windows.gpxe

#!gpxe
dhcp net0
kernel http://bootserver.my.zone.tld/pxeconfig.cfg/bin/memdisk
append initrd=http://bootserver.my.zone.tld/windows/winpe.img hardisk=1 bigraw
autoboot

After doing this, memdis emulate a hard drive and start windows PE.

The windows PE start and we have cmd windows for doing what we want, but it depend of your winpe image.

With this method, you can start a BartPE system and have a usable windows environment.

With BartPE, you can start antivirus, recover disk and some other tools for admin or recover tools.

Boot with AoE

What is AoE

Here, i will talk about AoE (Ata Over Ethernet).It s like Iscsi, or SAN, but more simple.When you start gPXE, you can see some booting methode, like tftp,http, iscsi and AoE.

AoE is a less expensive NAS, more simple but the security model is very rudimentary.

Setup a AoE server.

Fisrt you must have a kernel with AoE support, and aoetools and vblade installed.

Start the AoE server

First we start on the server the vblade service with the ubuntu iso cdrom.

vbladed 0 0 eth0 /data/image/ubuntu.img

We must have a system that can abble to boot over AoE.

For exemple install a basic ubuntu system in a vitual environment, or debootstrap. add aoetools on it and modify the fstab entry with this one.

/etc/fstab

/dev/etherd/e0.0p1        /        ext4        noatime    0 0
/dev/etherd/e0.0p2        none     swap        sw    0 0
#
proc                     /proc     proc        noexec,nodev,nosuid    0 0

Boot the system

We boot the gPXE sub system, and at the prompt we doing this.

gPXE> dhcp net0
gPXE> sanboot aoe:e0.0

And Voila :)