br33d
Posts: 4
Joined: Thu Jul 26, 2018 10:23 pm

PXE boot before microSD

Thu Jul 26, 2018 10:32 pm

I realize this has been asked before in a different form, but I couldn't quite follow the discussion.

Is there a way to make the board try to boot from PXE before it boots from the microSD?

I have a cluster of remote raspberry pis, and i'd like to occasionally reinstall them using PXE.

Specifically, I would like the pis to always try to boot using PXE, but if that fails, I would like them to fallback to booting with microSD. Thus, if I want to reinstall a pi, I configure the PXE server to respond to the MAC of that card with an new install image and use PoE to turn the card off and back on.

I see some discussion about enabling boot modes, but I don't see a description of how to change the boot order.

Is it possible to make a pi tried to boot using PXE before it tries the microSD?

thanx
ben

fruitoftheloom
Posts: 23337
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: PXE boot before microSD

Fri Jul 27, 2018 6:55 am

br33d wrote:
Thu Jul 26, 2018 10:32 pm
I realize this has been asked before in a different form, but I couldn't quite follow the discussion.

Is there a way to make the board try to boot from PXE before it boots from the microSD?

I have a cluster of remote raspberry pis, and i'd like to occasionally reinstall them using PXE.

Specifically, I would like the pis to always try to boot using PXE, but if that fails, I would like them to fallback to booting with microSD. Thus, if I want to reinstall a pi, I configure the PXE server to respond to the MAC of that card with an new install image and use PoE to turn the card off and back on.

I see some discussion about enabling boot modes, but I don't see a description of how to change the boot order.

Is it possible to make a pi tried to boot using PXE before it tries the microSD?

thanx
ben

https://www.raspberrypi.org/documentati ... /README.md
Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot)..
Asus ChromeBox 3 Celeron is my other computer...

mikerr
Posts: 2825
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: PXE boot before microSD

Fri Jul 27, 2018 7:59 am

I don't think you can directly change the boot order,
but you can selectively disable SD via GPIO:

https://www.raspberrypi.org/documentati ... ootflow.md

1. E.g hold gpio22 low and SD boot will be ignored, so would boot to PXE

2. Alternatively via software: renaming /boot/bootcode.bin (which can be done on the pi itself) would also make it failover into pxe at next boot.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

br33d
Posts: 4
Joined: Thu Jul 26, 2018 10:23 pm

Re: PXE boot before microSD

Sun Jul 29, 2018 12:49 pm

Yes, I had read that before posting. From that doc the answer seems to be that you cannot control boot order. The closest you can get is to use hardware pins to enable/disable different boot options, but even then the boot order remains the same, it's just that disabled options will be skipped. Or did I miss something?

br33d
Posts: 4
Joined: Thu Jul 26, 2018 10:23 pm

Re: PXE boot before microSD

Sun Jul 29, 2018 1:09 pm

mikerr wrote:
Fri Jul 27, 2018 7:59 am
2. Alternatively via software: renaming /boot/bootcode.bin (which can be done on the pi itself) would also make it failover into pxe at next boot.
I would like to go the software route. I've been thinking along the lines of your second suggestion. I was thinking that I would always PXE boot (never have the bootcode.bin on the microSD, but then have the TFTP server either serve back a cmdline.txt that makes it boot from the network or boot from the microSD. Is there a nicer way floating around?

hippy
Posts: 7729
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: PXE boot before microSD

Sun Jul 29, 2018 4:07 pm

br33d wrote:
Thu Jul 26, 2018 10:32 pm
I would like the pis to always try to boot using PXE, but if that fails, I would like them to fallback to booting with microSD.
Expanding on mikerr's suggestion earlier, by enabling GPIO selection of what to boot from it should be possible to add a microcontroller supervisor which can disable SD Card booting and enable PXE booting at initial power-on.

If PXE booting is not indicated as successful to the supervisor that can reset the Pi, enable SD Card booting, and let it out of reset for a second attempt at booting.

Such a supervisor program should be fairly straight forward so cheap and easy to implement even with no past microcontroller experience.

br33d
Posts: 4
Joined: Thu Jul 26, 2018 10:23 pm

Re: PXE boot before microSD

Sun Jul 29, 2018 11:42 pm

hippy wrote:
Sun Jul 29, 2018 4:07 pm

Expanding on mikerr's suggestion earlier, by enabling GPIO selection of what to boot from it should be possible to add a microcontroller supervisor which can disable SD Card booting and enable PXE booting at initial power-on.

If PXE booting is not indicated as successful to the supervisor that can reset the Pi, enable SD Card booting, and let it out of reset for a second attempt at booting.

Such a supervisor program should be fairly straight forward so cheap and easy to implement even with no past microcontroller experience.
i'm building a cluster of almost 100 pis, so the additional hardware and wiring really isn't practical. the software solution should work fine. do you see a problem with it?

hippy
Posts: 7729
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: PXE boot before microSD

Mon Jul 30, 2018 10:18 am

br33d wrote:
Sun Jul 29, 2018 11:42 pm
the software solution should work fine. do you see a problem with it?
Only that it always needs PXE available to boot, and the original requirement was for when PXE boot was not available.

If you always PXE boot and the system can handle all Pi's PXE booting then there should be no issue.

If you need to PXE boot and that's not available; then you have a problem.

Return to “Advanced users”