-
Notifications
You must be signed in to change notification settings - Fork 111
Booting Harvey on real hardware I (TFTP)
One of the goals of every operating system has is to run in a real machine. This how to covers a method for booting from network through PXE. You will need:
- A working computer of x86_64 (amd64) architecture PXE booting capable (check your BIOS or UEFI settings).
- A Local Area Network (LAN) ready.
- Another computer which will be the host, running the tftp and http server for the kernel (pxeserver) and the 9p file server (ufs)
We'll cover for this case a host with Linux and an empty "dumb" machine for booting Harvey. So if you're using one of the other platforms covered in Getting Started, just follow the proper instructions for your platform there. You won't need any disk support for this since the main file server will be served by the Linux host machine.
- Build harvey
- Build pxeserver from u-root. We will assume pxeserver will be built in
$HOME/go/bin
:
go get github.com/u-root/u-root
go install github.com/u-root/u-root/cmds/exp/pxeserver
- Create the file
$HARVEY/cfg/pxe/tftpboot/pxelinux.cfg/default
, and paste the following into it, taking care to change the references to192.168.0.19
with the IP address of the machine that will run pxeserver and ufs:
DEFAULT harvey
LABEL harvey
KERNEL mboot.c32
APPEND http://192.168.0.19/harvey.32bit service=cpu nobootprompt=tcp maxcores=1024 fs=192.168.0.19 auth=192.168.0.19 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1
- Run ufs:
$HARVEY/util/ufs -root=$HARVEY -debug=3
- Run pxeserver, taking care to change the IP address and interface to that of the machine running pxeserver:
sudo $HOME/go/bin/pxeserver \
-tftp-dir $HARVEY/cfg/pxe/tftpboot/ \
-http-dir $HARVEY/cfg/pxe/tftpboot/ \
-bootfilename lpxelinux.0 \
-interface enp0s31f6 \
-ip 192.168.0.19
If your machine has UEFI, ensure you disable any security measure which could break the load of a kernel through the network. Then, BIOS/UEFI, select as primary device the network card and enable PXE protocol. This could be very different between vendors, so please read the manual of your motherboard: it always has worth.
Once done, just reboot the machine and wait for loading Harvey kernel and see how it boots a cpuserver. Connect to it through a drawterm.
If your Harvey host runs iPXE, we can skip the use of PXELINUX and do everything we need from iPXE instead.
- Download/install pxeserver as above.
- Create
$HARVEY/cfg/pxe/tftpboot/ipxe
and put the following in it, replacing the IP address with the IP of the machine which runs the dhcp/tftp/http servers:
#!ipxe
dhcp
kernel http://192.168.0.254/harvey.32bit service=cpu nobootprompt=tcp maxcores=1024 fs=192.168.0.254 auth=192.168.0.254 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1
boot
- Run ufs:
$HARVEY/util/ufs -root=$HARVEY -debug=3
- Run pxeserver, taking care to change the IP address and interface to that of the machine running pxeserver:
sudo $HOME/go/bin/pxeserver \
-tftp-dir $HARVEY/cfg/pxe/tftpboot/ \
-http-dir $HARVEY/cfg/pxe/tftpboot/ \
-bootfilename ipxe \
-interface enp0s7f0 \
-ip 192.168.0.254
- Boot your Harvey box. iPXE should fetch the "ipxe" file via TFTP, which then instructs it to grab the kernel over HTTP and boot it.
If you're already running the ISC dhcpd, you should disable the DHCP service on pxeserver (add the flag -4=false
to the command), then add the following to your dhcpd.conf entry for the Harvey system:
filename "ipxe";
server-name "192.168.0.254";
next-server 192.168.0.254;