-
Notifications
You must be signed in to change notification settings - Fork 107
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 loading the kernel and the 9p file server. We now use a single tool called
centre
to provide all these services; centre is built automatically when you run the bootstrap script.
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
- 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 centre:
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
If you want to use uroot, you need to change the service to uroot
and pass in a the uroot.cpio.lzma
ramdisk by appending --- uroot.cpio.lzma
to the APPEND
line like so:
DEFAULT harvey
LABEL harvey
KERNEL mboot.c32
APPEND http://192.168.0.19/harvey.32bit service=uroot nobootprompt=tcp maxcores=1024 fs=192.168.0.19 auth=192.168.0.19 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1 --- uroot.cpio.lzma
- Edit your
/etc/hosts
file to add the following lines. The first should point to your host machine which will runcentre
. The second (apu2 in this case) should point to the machine you want to boot harvey on. Change the IP and MAC addresses as appropriate.
192.168.0.100 centre
192.168.0.99 apu2 u00:0d:b9:57:cf:30
- Run
centre
on your Linux machine, taking care to change the interface to match your actual LAN interface name:
sudo $HARVEY/linux_amd64/bin/centre \
-i wlp2s0 \
-bootfilename lpxelinux.0 \
-tftp-dir $HARVEY/cfg/pxe/tftpboot \
-http-dir $HARVEY/cfg/pxe/tftpboot \
-rootpath $HARVEY/cfg/pxe/tftpboot \
-ninep-dir $HARVEY
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.
- Set up
centre
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
If you want to use uroot, (assuming you've built sys/src/u-root.json) you need to specify service=uroot and pass an initrd file:
#!ipxe
dhcp
kernel http://192.168.0.254/harvey.32bit service=uroot nobootprompt=tcp maxcores=1024 fs=192.168.0.254 auth=192.168.0.254 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1
initrd http://192.168.0.254/uroot.cpio.lzma
boot
- Run
centre
as above, but with a different bootfilename (remember to change the interface!):
sudo $HARVEY/linux_amd64/bin/centre \
-i wlp2s0 \
-bootfilename lpxelinux.0 \
-tftp-dir $HARVEY/cfg/pxe/tftpboot \
-http-dir $HARVEY/cfg/pxe/tftpboot \
-rootpath $HARVEY/cfg/pxe/tftpboot \
-ninep-dir $HARVEY
- 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 centre
(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;