Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BootTemplate = template.Must(template.New("iPXE embedded").Parse(`#!ipxe
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||
{{/* print interfaces */}}
ifstat
{{/* retry 10 times overall */}}
set attempts:int32 10
set x:int32 0
:retry_loop
set idx:int32 0
:loop
{{/* try DHCP on each interface */}}
isset ${net${idx}/mac} || goto exhausted
ifclose
iflinkwait --timeout 5000 net${idx} || goto next_iface
dhcp net${idx} || goto next_iface
goto boot
:next_iface
inc idx && goto loop
:boot
{{/* attempt boot, if fails try next iface */}}
route
chain --replace http://{{ .Endpoint }}:{{ .Port }}/ipxe?uuid=${uuid}&mac=${net${idx}/mac:hexhyp}&domain=${domain}&hostname=${hostname}&serial=${serial}&arch=${buildarch} || goto next_iface
:exhausted
echo
echo Failed to iPXE boot successfully via all interfaces
iseq ${x} ${attempts} && goto fail ||
echo Retrying...
echo
inc x
goto retry_loop
:fail
echo
echo Failed to get a valid response after ${attempts} attempts
echo
echo Rebooting in 5 seconds...
sleep 5
reboot
`))
BootTemplate is embedded into iPXE binary when that binary is sent to the node.
View Source
var ErrBootFromDisk = errors.New("boot from disk")
Functions ¶
func PatchBinaries ¶
PatchBinaries patches iPXE binaries on the fly with the new embedded script.
This relies on special build in `pkgs/ipxe` where a placeholder iPXE script is embedded. EFI iPXE binaries are uncompressed, so these are patched directly. BIOS amd64 undionly.pxe is compressed, so we instead patch uncompressed version and compress it back using zbin. (zbin is built with iPXE).
func RegisterIPXE ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.