<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hey Daniel,<div><br></div><div>I have the following information available for you:</div><div><br></div><div><b><u>What do I do?</u></b><br>I have some RaspberryPi 2B in use.<br>I know these are not "PXE Bootable" by default but placing a single file 'bootcode.bin' to the sd card and booting the Pi 2B with it makes them boot from network.<br>There the PI searches for a boot entry with boot text '<span style="background-color:rgb(249,249,249);color:rgb(0,0,0);font-family:monospace,Courier;font-size:12.8px">Raspberry Pi Boot' </span>earches in it. - It can be any text you want in addition but the '<span style="background-color:rgb(249,249,249);color:rgb(0,0,0);font-family:monospace,Courier;font-size:12.8px">Raspberry Pi Boot'</span><span style="background-color:rgb(249,249,249);color:rgb(0,0,0);font-family:monospace,Courier;font-size:12.8px"> </span>part is required - case sensitive!<br>(It took me hours to find this! My boot text now is e.g. <span style="background-color:rgb(249,249,249);color:rgb(0,0,0);font-family:monospace,Courier;font-size:12.8px">'FAI armhf (Raspberry Pi Boot)'</span>)</div><div>A good source if you are more interested into how Pi performs network boot is: <a href="http://www.raspibo.org/wiki/index.php?title=Raspberry_PI:_network_boot_explained" target="_blank">http://www.raspibo.org/wiki/index.php?title=Raspberry_PI:_network_boot_explained</a></div><div><br></div><div><b><u>The raspberry pi & FAI tftproot:</u></b><br></div><div>If your PI is checking correctly for pxe files and dhcp boot entries there is the tftproot.</div><div>The pi needs some special bootfiles which you can get by downloading the fai firmware zip (<a href="https://github.com/raspberrypi/firmware/archive/master.zip" target="_blank">https://github.com/raspberrypi/firmware/archive/master.zip</a>),</div><div>extracting it and copy everything from <zipextract>/firmware-master/boot/* to the parentdirectory of TFTPROOT from your nfsroot.conf (by default TFTPROO is /srv/tftp/fai so copy everything to /srv/tftp)</div><div>Additionally your pi searches for a config.txt in the same folder ( details on config.txt see <a href="https://www.raspberrypi.org/documentation/configuration/config-txt/README.md" target="_blank">https://www.raspberrypi.org/documentation/configuration/config-txt/README.md</a> )<br>The three settings I found which are important to be set in config.txt for pxe boot are: </div><div><i>initramfs initrd.img-4.19.0-4-armmp followkernel  </i>(adjust to your version and name as you have it in your nfsroot - more here on later)</div><div><i>ramfsfile=initrd.img-4.19.0-4-armmp                    </i>(adjust to your version and name as you have it in your nfsroot - more here on later)</div><div>ramfsaddr=-1</div><div>Additionally you need to create file "cmdline.txt" still in the same folder which contains your boot parameters - this is my content:<br><i>dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 elevator=deadline init=/sbin/init-overlay initrd=initrd.img-4.19.0-4-armmp ip=dhcp  root=192.168.33.250:/srv/fai/nfsroot-armhf:vers=3 rootdelay  FAI_FLAGS=verbose,sshd,menu,reboot FAI_CONFIG_SRC=nfs://faiserver/srv/fai/config FAI_SENDID=mac FAI_ACTION=install</i><br></div><div>("/sbin/init-overlay" is a script that we will add in the following to the nfsroot - this was needed since I faced some issues with the overlayfs during boot..not sure if this is due to my special SD PXE boot config)</div><div><br></div><div><b><u>The raspberry pi & FAI nfsroot:</u></b></div><div>Of course you need to have a armhf nfsroot, too.</div><div>copy the /etc/fai, adjust values needed and create a new armhf nfsroot using "fai-make-nfsroot" command. (My installs worked all correctly using default debian armhf nfsroot)</div><div>After that nfsroot was created correctly there are small special adjustments I had to make:<br>1. Copy the fimrware modules from previously downloaded <zipextract>/firmware-master/modules/* to subfolder /lib/modules/ of your nfsroot.</div><div>2. Download the following script: <a href="https://raw.githubusercontent.com/ppisa/rpi-utils/master/init-overlay/sbin/init-overlay" target="_blank">https://raw.githubusercontent.com/ppisa/rpi-utils/master/init-overlay/sbin/init-overlay</a>, save it to /sbin/ folder of your nfsroot and make it executable.<br>    Additionally create a folder "/overlay" at the root of your nfsroot.</div><div>Additionally copy over the file /boot/initrd.img-4.19.0-4-armmp from your nfsroot into the /srv/tftp folder.</div><div><br></div><div><b><u>The raspberry pi & FAI configspace:</u></b></div><div>You should be able to correctly boot your raspberry pi from network now and FAI install should start as expected.<br>Never the less you do not have some config done in your configspace that makes your pi to install correctly.<br>I will try to go through typical config dir folders and describe what I did there:</div><div><u><br></u></div><div><u>basefiles:</u></div><div>I started with a plain debian 9 armhf (e.g. from here <a href="https://fai-project.org/download/basefiles/">https://fai-project.org/download/basefiles/</a> ) and it works - but not that well.</div><div>Since I discovered multiple topics worked much better after I installed some packages (more later which ones) from original Pi repo and I due to this had to add the pi repo to sources.list,</div><div>I decided at some point to switch over to original raspbian base file. - Both solutions work so it is up to you if you want to stay with plain debian 9. (and not really FAI specific here :) )<br>So how do you create a raspbian base file? - Attached is my modified "mk-basefile" ( I have added commentes to all my changes and a short diff with the default mk-basefile should show you the changes made).<br>Simply execute e.g. "mk-basefile -J PI_STRETCH"<br><br></div><div><u>class:</u></div><div>I created an additional class "RASPBERRY" where all raspberry pi specific topics were added. <br></div><div>Additionally the following command within one of the classes scripts should be able to create a class with the model name of PI in case you have differnet models (never tested with others than my PI 2B)</div><div><div><i>[ -e /proc/device-tree/model ] && cat /proc/device-tree/model 2>/dev/null | sed 's#\(^\S*\)\(.*$\)#\1#g' | tr -cd '[[:alnum:]]_\r\n' | sed 's/^_*//;s/_*$//' | tr '[:lower:]' '[:upper:]'</i></div></div><div><br></div><div><u>disk_config:</u><br>The pi uses a disk layout very similar to the one UEFI devices use.<br>Here is the one I use since (with a bit smaller sized - only boot needs to be relatively big due to the lot of special firmware files of pi)<br><div><i>disk_config disk1 disklabel:msdos bootable:3 fstabkey:uuid</i></div><div><i>primary /boot 128<span style="white-space:pre">        </span>vfat<span style="white-space:pre"> </span>rw</i></div><div><i>primary swap   RAM:30%   swap  sw</i></div><div><i>primary /      10-100%     ext4  rw,noatime,errors=remount-ro</i></div></div><div><br></div><div><u>files:</u></div><div>if you are using plain debian stretch (not raspbian) basefile you should copy over/add the pi repository into /etc/apt/sources.d/raspi.list<br><i>deb <a href="http://archive.raspberrypi.org/debian/">http://archive.raspberrypi.org/debian/</a> stretch main ui<br></i></div><div><br></div><div><u>hooks</u>:</div><div><div>Since the pi does not have a hardware clock and that caused some trouble with the time sync I had to add a hook "<a href="http://defvar.RASPBERRY.sh">defvar.RASPBERRY.sh</a>" with following content to get time from ntp:</div><div>[ "${FAI_ACTION}" == "install" ] && [ -n "$(which ntpd)" ] && ntpd -q -g</div></div><div><br></div></div><div><u>package_config:</u></div><div>the following packages helped my pi to run much better:</div><div><div><i>PACKAGES install RASPBERRY<br></i></div><div><i>raspberrypi-kernel raspberrypi-bootloader</i></div><div><i>#raspberrypi-sys-mods raspberrypi-net-mods</i></div><div><i>#raspi-config raspi-copies-and-fills</i></div><div><i>#rpi-update pi-bluetooth</i></div></div><div>Of course if you use the raspbian basefile you could add them there directly, too.</div><div>Additionally do not forget to add the gpg key of raspberry pi repo :)</div><div><br></div><div><u>scripts:</u></div><div><u>see attached</u></div><div>005-boot-setup.sh -> copies required raspberry pi firmware files (two possibilities exist - you have the firmware-master.zip in your configdir or it gets downloaded from web)<br></div><div>006-configcmd-setup.sh -> creates an emtpy config.txt (can be solved maybe better using fcopy) and a cmdline.txt containing the correct uuid of your sd card.<br></div><div><br></div><div><br></div><div>I hope above helps you to get your pi up and running via FAI. - Of course anything at your own risk.</div><div>If you make improvements or find some topics which are specific to your B+ I would be happy to receive some feedback.</div><div><br></div><div>Kind Regards </div><div><br></div><div>Martin </div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Fr., 26. Apr. 2019 um 11:55 Uhr schrieb Andrew Ruthven <<a href="mailto:andrew@etc.gen.nz" target="_blank">andrew@etc.gen.nz</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey,<br>
<br>
On Fri, 2019-04-26 at 06:56 +0200, Daniel Haensse wrote:<br>
> Dear all<br>
> <br>
> I read that raspberry pi supports PXE boot and that it is enabled<br>
> per <br>
> default on the latest B+ version. I'm wondering if there is anybody<br>
> out <br>
> there using it with plain debian or raspbian yet?<br>
> <br>
> Maybe even on qemu with arm emulation on x64 platform?<br>
<br>
I wasn't aware that PXE boot was enabled by default now - that's much<br>
nicer! I have a Pi 3B+ here which I can't use as the SD card slot is<br>
damaged and we didn't enable PXE boot before the slot was damaged.<br>
<br>
Yes, I'm doing this with an NFSROOT provided from a Debian Stretch<br>
machine as the server. I install the NFSROOTs using debootstrap with --<br>
foreign, which allows to just chroot into them if I need to compile<br>
things, or install other packages. This is very handy!<br>
<br>
I'm not using FAI to do this yet. ;)<br>
<br>
All of this is currently deployed via Ansible playbooks. I've been<br>
meaning to write a blog post about this and publish the playbooks...<br>
Information from my previous iteration is here:<br>
<a href="http://blog.etc.gen.nz/archives/131-Network-boot-a-Raspberry-Pi-3.html" rel="noreferrer" target="_blank">http://blog.etc.gen.nz/archives/131-Network-boot-a-Raspberry-Pi-3.html</a><br>
<br>
Cheers,<br>
Andrew<br>
<br>
-- <br>
Andrew Ruthven, Wellington, New Zealand<br>
<a href="mailto:andrew@etc.gen.nz" target="_blank">andrew@etc.gen.nz</a>              | <a href="http://linux.conf.au" rel="noreferrer" target="_blank">linux.conf.au</a> 2020, Gold Coast, AU<br>
Catalyst Cloud:                |    <a href="https://lca2020.linux.org.au/" rel="noreferrer" target="_blank">https://lca2020.linux.org.au/</a><br>
   <a href="https://catalystcloud.nz" rel="noreferrer" target="_blank">https://catalystcloud.nz</a>    |<br>
</blockquote></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>