PXE Network Boot RPI 4 tutorial?

  • I recently set up one of my raspberry pis to network boot LibreELEC, so I'll add some notes here, in the hope that they help someone else (if you find them useful, please feel free to add them to the wiki).

    The procedure was mostly the same as setting one up to network boot Raspberry Pi OS (which is documented here: https://www.raspberrypi.com/documentation/…ur-raspberry-pi), but as LibreELEC mounts its filesystems differently, there are some changes.

    Where with Raspberry Pi OS, you would put something like "root=/dev/nfs nfsroot=10.42.0.211:/nfs/client1,vers=3 rw ip=dhcp" in cmdline.txt (and put the details for mounting /boot/firmware in /etc/fstab), LibreELEC takes both mount points from cmdline.txt, formatted something like "boot=NFS=10.42.0.211:/tftpboot disk=NFS=10.42.0.211:/nfs/client1 ip=dhcp". Adjust IPs and paths as needed to match your setup.

    If you are moving from an sd card to network boot, copy the first partition on the sd card into the "boot" directory, and the second partition into the "disk" directory. If you are setting a new device up, leave the "disk" directory empty, and copy the boot files out of the image using something like

    Bash
    gunzip LibreELEC-RPi2.arm-12.0.1.img.gz
    losetup -P /dev/loop0 LibreELEC-RPi2.arm-12.0.1.img
    mount /dev/loop0p1 /mnt 
    cp -r /mnt/* /tftpboot/
    umount /mnt
    losetup -d /dev/loop0

    Again, adjust paths to match your setup.

    If you have more than one pi netbooting LibreELEC, each will need its own separate storage, but they can share the same boot files. Sharing boot files means they will load the same cmdline.txt, but you can include "@UID@" in the path for the storage, and it will be replaced by the pi's serial number. The only documentation I found for this was here: https://github.com/LibreELEC/Libr…issue-170601436, but it may be better documented elsewhere.

    It may also be advantageous to add "toram" to cmdline.txt. This causes the root filesystem to be copied into memory on boot (using up some ram, but possibly improving performance).