Netbooting g4u via PXE

Mariusz Zynel , Aug 10, 2018

g4u is a great tool for backup/restore disks and partitions to/from a FTP server. I will try to explain how to setup a server to automatically boot g4u over a network.





In my setup I'm using ISC DHCP server but I believe it can be easily ported to any implementation of dhcp server. I'm working on Solaris 10 U6 x86 but it is not relevant here.


  1. Assume that TFTP server's root directory is /tftpboot
  2. Create /tftpboot/g4u directory and populate it with the following files:
    PXE boot loader from NetBSD distribution. The standard one (as of writing this) is not capable of reading boot.cfg which makes it impossible to automate booting g4u over the net. You probably need to build it yourself from sources.
    Configuration file of the PXE boot loader. It is taken from g4u ISO image and slightly modified:
    banner=Welcome to g4u 2.4
    banner=ACPI should work on all modern and legacy hardware, however if you have 
    banner=problems, please try disabling it.
    menu=Boot g4u:load tftp:g4u/miniroot.kmod;boot tftp:g4u/netbsd
    menu=Boot g4u (no ACPI):load tftp:g4u/miniroot.kmod;boot tftp:g4u/netbsd -2
    menu=Boot g4u (no ACPI, no SMP):load tftp:g4u/miniroot.kmod;boot tftp:g4u/netbsd -12
    menu=Drop to boot prompt:prompt
    The NetBSD kernel used by g4u. You can extract it from g4u ISO image.
    This module contains the actual g4u code. You can extract it from g4u ISO image. What is on g4u CD (that is in g4u ISO image) is gzipped miniroot.kmod. My experience is that it must be uncompressed otherwise PXE loader fails. I mean

    mv miniroot.kmod miniroot.kmod.gz; gunzip miniroot.kmod.gz

    This is a standard NetBSD kernel module. You can get in from NetBSD binary distribution or build it yourself. This bit is optional. Without it PXE loader will complain after booting the kernel that it cannot load nfs module but you can ignore it.

    For your (in)convenience there is a complete set of these files for download here: g4u.tgz. It contains pxeboot_ia32.bin and nfs.kmod that I have build on my own from NetBSD-current sources as of 20.11.2011 with some minor tweak in src/sys/arch/i386/stand/pxeboot/Makefile. Files netbsd, boot.cfg and miniroot.kmod are taken from g4u ISO image. So, appropriate licenses apply.

  3. Configure DHCP server. Its configuration file should contain more or less this:
    allow booting;
    allow bootp;
    filename "g4u/pxeboot_ia32.bin";
    subnet netmask {
    	option broadcast-address;
    	option subnet-mask;
    	option routers;
    if substring (option vendor-class-identifier, 0, 17) = "NetBSD:i386:libsa" {
        if filename = "boot.cfg" {
            filename "tftp:g4u/boot.cfg";
        } elsif filename = "nfs" {
            filename "tftp:g4u/nfs.kmod";
        } else {
            filename "";

    You can have a more complex settings but what is listed above is the minimum. The most important entries are:

    This is the path to boot loader program.
    It contains the IP of TFTP server.
    if statement
    PXE loader always asks DHCP server about the file it is going to fetch. We need to answer pointing to our TFTP server.
  4. That's it. Try it out.


TFTP server is only required to hand PXE loader over the net to a client machine. The other files like: boot.cfg, netbsd, miniroot.kmod and even nfs.kmod can be loaded over NFS. In order to do that you need one extra option in DHCP namely

option root-path "/tftpboot";

telling where the files are on the NFS server. PXE loader doesn't request that pathname from DHCP server explicitly so, we need to force DHCP server to provide that information any way:

append dhcp-parameter-request-list 17;

As you may know option code 17 is root-path. To fetch files over NFS instead of TFTP all the prefixes tftp: in boot.cfg and dhcpd.conf should be replaced by the prefix nfs:.



Thanks go to Hubert Feyrer, the author and maintainer of g4u, and to people from NetBSD project.

Copyright (c) 2011 by Mariusz Zynel.