Raspberry PI 3 B+

Martin Krämer mk.maddin at gmail.com
Fri Apr 26 19:32:48 CEST 2019


Hey Daniel,

I have the following information available for you:

*What do I do?*
I have some RaspberryPi 2B in use.
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.
There the PI searches for a boot entry with boot text 'Raspberry Pi
Boot' earches
in it. - It can be any text you want in addition but the 'Raspberry Pi Boot'
 part is required - case sensitive!
(It took me hours to find this! My boot text now is e.g. 'FAI armhf
(Raspberry Pi Boot)')
A good source if you are more interested into how Pi performs network boot
is:
http://www.raspibo.org/wiki/index.php?title=Raspberry_PI:_network_boot_explained

*The raspberry pi & FAI tftproot:*
If your PI is checking correctly for pxe files and dhcp boot entries there
is the tftproot.
The pi needs some special bootfiles which you can get by downloading the
fai firmware zip (https://github.com/raspberrypi/firmware/archive/master.zip
),
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)
Additionally your pi searches for a config.txt in the same folder ( details
on config.txt see
https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
 )
The three settings I found which are important to be set in config.txt for
pxe boot are:
*initramfs initrd.img-4.19.0-4-armmp followkernel  *(adjust to your version
and name as you have it in your nfsroot - more here on later)
*ramfsfile=initrd.img-4.19.0-4-armmp                    *(adjust to your
version and name as you have it in your nfsroot - more here on later)
ramfsaddr=-1
Additionally you need to create file "cmdline.txt" still in the same folder
which contains your boot parameters - this is my content:
*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*
("/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)

*The raspberry pi & FAI nfsroot:*
Of course you need to have a armhf nfsroot, too.
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)
After that nfsroot was created correctly there are small special
adjustments I had to make:
1. Copy the fimrware modules from previously downloaded
<zipextract>/firmware-master/modules/* to subfolder /lib/modules/ of your
nfsroot.
2. Download the following script:
https://raw.githubusercontent.com/ppisa/rpi-utils/master/init-overlay/sbin/init-overlay,
save it to /sbin/ folder of your nfsroot and make it executable.
    Additionally create a folder "/overlay" at the root of your nfsroot.
Additionally copy over the file /boot/initrd.img-4.19.0-4-armmp from your
nfsroot into the /srv/tftp folder.

*The raspberry pi & FAI configspace:*
You should be able to correctly boot your raspberry pi from network now and
FAI install should start as expected.
Never the less you do not have some config done in your configspace that
makes your pi to install correctly.
I will try to go through typical config dir folders and describe what I did
there:

*basefiles:*
I started with a plain debian 9 armhf (e.g. from here
https://fai-project.org/download/basefiles/ ) and it works - but not that
well.
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,
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 :) )
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).
Simply execute e.g. "mk-basefile -J PI_STRETCH"

*class:*
I created an additional class "RASPBERRY" where all raspberry pi specific
topics were added.
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)
*[ -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:]'*

*disk_config:*
The pi uses a disk layout very similar to the one UEFI devices use.
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)
*disk_config disk1 disklabel:msdos bootable:3 fstabkey:uuid*
*primary /boot 128 vfat rw*
*primary swap   RAM:30%   swap  sw*
*primary /      10-100%     ext4  rw,noatime,errors=remount-ro*

*files:*
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

*deb http://archive.raspberrypi.org/debian/
<http://archive.raspberrypi.org/debian/> stretch main ui*

*hooks*:
Since the pi does not have a hardware clock and that caused some trouble
with the time sync I had to add a hook "defvar.RASPBERRY.sh" with following
content to get time from ntp:
[ "${FAI_ACTION}" == "install" ] && [ -n "$(which ntpd)" ] && ntpd -q -g

*package_config:*
the following packages helped my pi to run much better:

*PACKAGES install RASPBERRY*
*raspberrypi-kernel raspberrypi-bootloader*
*#raspberrypi-sys-mods raspberrypi-net-mods*
*#raspi-config raspi-copies-and-fills*
*#rpi-update pi-bluetooth*
Of course if you use the raspbian basefile you could add them there
directly, too.
Additionally do not forget to add the gpg key of raspberry pi repo :)

*scripts:*
*see attached*
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)
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.


I hope above helps you to get your pi up and running via FAI. - Of course
anything at your own risk.
If you make improvements or find some topics which are specific to your B+
I would be happy to receive some feedback.

Kind Regards

Martin


Am Fr., 26. Apr. 2019 um 11:55 Uhr schrieb Andrew Ruthven <andrew at etc.gen.nz
>:

> Hey,
>
> On Fri, 2019-04-26 at 06:56 +0200, Daniel Haensse wrote:
> > Dear all
> >
> > I read that raspberry pi supports PXE boot and that it is enabled
> > per
> > default on the latest B+ version. I'm wondering if there is anybody
> > out
> > there using it with plain debian or raspbian yet?
> >
> > Maybe even on qemu with arm emulation on x64 platform?
>
> I wasn't aware that PXE boot was enabled by default now - that's much
> nicer! I have a Pi 3B+ here which I can't use as the SD card slot is
> damaged and we didn't enable PXE boot before the slot was damaged.
>
> Yes, I'm doing this with an NFSROOT provided from a Debian Stretch
> machine as the server. I install the NFSROOTs using debootstrap with --
> foreign, which allows to just chroot into them if I need to compile
> things, or install other packages. This is very handy!
>
> I'm not using FAI to do this yet. ;)
>
> All of this is currently deployed via Ansible playbooks. I've been
> meaning to write a blog post about this and publish the playbooks...
> Information from my previous iteration is here:
> http://blog.etc.gen.nz/archives/131-Network-boot-a-Raspberry-Pi-3.html
>
> Cheers,
> Andrew
>
> --
> Andrew Ruthven, Wellington, New Zealand
> andrew at etc.gen.nz              | linux.conf.au 2020, Gold Coast, AU
> Catalyst Cloud:                |    https://lca2020.linux.org.au/
>    https://catalystcloud.nz    |
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20190426/a26bb632/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mk-basefile
Type: application/octet-stream
Size: 8249 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20190426/a26bb632/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 005-boot-setup.sh
Type: application/x-shellscript
Size: 1882 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20190426/a26bb632/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 006-configcmd-setup.sh
Type: application/x-shellscript
Size: 2314 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20190426/a26bb632/attachment-0003.bin>


More information about the linux-fai mailing list