Git Product home page Git Product logo

pxe_boot_rpi's Introduction

PXE Boot on a RPI

Tested on physical machines

  • rpi3b+ -->> SERIAL_NUMBER=76d2a334
  • rpi4b -->> SERIAL_NUMBER=ac8854ec

Using a Dell laptop 6.1.71-1-MANJARO over wifi to serve tftp and nfs

Very useful information : RPI Network Boot

Forwards ...

Go to RPI OS to download and extract your image.

Check the Configuration section below and then Run these commands ...

sudo kpartx -va 2023-12-11-raspios-bookworm-arm64-lite.img

sudo mkdir -v /pxe

sudo mount -v /dev/mapper/loop0p2 /pxe
sudo mount -v /dev/mapper/loop0p1 /pxe/boot/firmware

sudo mkdir -v /srv/tftp/$SERIAL_NUMBER

sudo mount -v -o bind /pxe/boot/firmware /srv/tftp/$SERIAL_NUMBER

When booting, rpi3b+ looks for bootcode.bin in the parent directory, i.e., /srv/tftp. See the network-booting link above that describes the difference between rpi3 and rpi4 and why this is needed.

sudo cp /srv/tftp/76d2a334/bootcode.bin /srv/tftp/bootcode.bin

Export the NFS mounts and start dnsmasq. Optionally, reload config when changing mount information


sudo systemctl daemon-reload # only needed when changing config

sudo systemctl start dnsmasq

sudo exportfs -a

In the meantime, on the server, run on another screen to watch if the system tries to download files. If it works, then you will see failure messages, but then success messages. It takes more than a few minutes over a wifi nfs mount, but it works.

journalctl -fex

If it succeeds on the server machine, then you will see messages on the client machine where the control is transferred.

This means that depending on your configuration, dnsmasq won't be needed anymore.

Configuration

Warning

Make sure to avoid any confusion and make backups of these files before working on live systems :

  1. On the client:
  • /etc/fstab
  • /boot/cmdline.txt
  1. On the server:
  • /etc/exports
  • /etc/dnsmasq.conf

Note

Edit /etc/fstab /boot/cmdline.txt on the client system (directly through the mounts done above)

On the Client:

/boot/cmdline.txt:

console=serial0,115200 console=tty1 root=/dev/nfs nfsroot=192.168.0.206:/pxe,vers=3 rw ip=dhcp rootwait elevator=deadline

/etc/fstab :

192.168.0.206:/pxe / nfs defaults,vers=3 0 0
192.168.0.206:/pxe/boot/firmware /boot/firmware nfs defaults,vers=3 0 0
On the Server:

/etc/exports:

/srv/tftp *(rw,sync,no_subtree_check,no_root_squash)
/pxe/boot/firmware *(rw,sync,no_subtree_check,no_root_squash)
/pxe *(rw,sync,no_subtree_check,no_root_squash)

/etc/dnsmasq.conf :

interface=*
dhcp-range=192.168.0.10,192.168.0.50,12h
log-dhcp
enable-tftp
tftp-root=/srv/tftp
pxe-service=0,"Raspberry Pi Boot"

Backwards ...

sudo systemctl stop dnsmasq
sudo umount -v /srv/tftp/$SERIAL_NUMBER
sudo umount -v /pxe/boot/firmware
sudo umount -v  /pxe

sudo rmdir  -v /pxe

sudo kpartx -vd 2023-12-11-raspios-bookworm-arm64-lite.img

pxe_boot_rpi's People

Contributors

mitalix avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.