How to boot and run a SD-less Raspberry Pi from Windows

Copyright © 2019-2020 Herbert Hanewinkel, Neuried
 
updated 10.2020

Overview

The Raspberry Pi 4 has a bootloader that optional can boot from usb or net. Booting from net or usb needs to be enabled in the bootloader. See this guide: Pi 4 Bootloader Configuration Change variable BOOT_ORDER to 0x421 to enable net and USB booting as well as normal SD boot.

The Raspberry Pi 3B+ contains code for booting from the net. It could be used to run a RPi without any local file system only using NFS. (For elder RPi boards net boot is possible with an SD card containg a FAT partition with file "bootcode.bin" only).

Booting an RPi from the net needs a DHCP server with TFTP and a NFS server. The server could be a Windows system, a Linux system is not required.

Net booting an RPi in summary:
  1. The RPi sends out a DHCP request.
  2. The DHCP server must respond with ip-address, ... tftp server address and a defined vendor tag.
  3. If the RPi receives a correct response, it tries to load files by tftp (files stored in the FAT partition of a RPi boot image).
  4. If successfull, the RPi finds in cmdline.txt instructions for mounting further file systems by NFS.


Remote booting libreelec/KODI from Windows

The setup assumes the following addresses. Adapt to your own numbers:

Windows IP address (server): 192.168.1.4
Router/Gateway IP address: 192.168.1.73
DNS Server IP address: 192.168.1.73
RPi IP address (client): 192.168.1.26

On Windows:
  1. Create a folder e.g. "c:\server\kodi".
  2. Create two sub folders, "boot" and "storage"
  3. Download "LibreELEC-RPi2.arm-9.0.2.img.gz"
  4. Use 7zip to extract the SD image.
  5. Use 7zip to open the SD image and extract "0.fat".
  6. Use 7zip to open "0.fat" and extract the whole contents to folder "boot".
  7. In file "cmdline.txt" in folder "boot"
In haneWIN DHCP Server
  1. Create a new DHCP server profile for clients with static IP addresses.
  2. Configure the profile
  3. In Preferences-TFTP set the TFTP Root Directory to: c:\server\kodi\boot.
    dhcp tftp configuration
  4. Power on the RPi. The DHCP server should log a DHCP discover from a new device, e.g.

    DHCP  Discov. b8:27:eb:9e:75:f0 (0.0.0.0) vc "PXEClient:Arch:00000:UNDI:002001" if 192.168.1.4

  5. A matching entry should appear in the list of unknown clients. Move the entry to the list of static clients and assign it ip address 192.168.1.26 and the created profile.
    dhcp entry configuration

In haneWIN NFS Server (1.2.50 and higher)
  1. Select under Preferences-Server the option "Save attributes/uid/gid on NTFS volumes"
  2. Create a NFS server exports entry: c:\server\kodi -name:kodi -alldirs -maproot:0:0

    nfs configuration
  3. What the options do:

Restart the RPi. Now it should boot from the net and create a default KODI configuration in folder "storage". The DHCP server should log TFTP downloads from the RPi, e.g.

2019-06-20 14:32:22 TFTP Get Name C:\server\kodi\boot\bootcode.bin Mode octet Size 52116
2019-06-20 14:32:22 TFTP       0s 192.168.1.26  Get/octet  C:\server\kodi\boot\bootcode.bin
2019-06-20 14:32:22 TFTP Get Name C:\server\kodi\boot\bootsig.bin Mode octet Size 0
2019-06-20 14:32:22 TFTP  Error   192.168.1.26  Get  1 File not found C:\server\kodi\boot\bootsig.bin
2019-06-20 14:32:29 TFTP Get Name C:\server\kodi\boot\autoboot.txt Mode octet Size 0 tsize 0
2019-06-20 14:32:29 TFTP  Error   192.168.1.26  Get  1 File not found C:\server\kodi\boot\autoboot.txt
2019-06-20 14:32:29 TFTP Get Name C:\server\kodi\boot\config.txt Mode octet Size 1590 tsize 1590
2019-06-20 14:32:29 TFTP       0s 192.168.1.26  Get/octet  C:\server\kodi\boot\config.txt
2019-06-20 14:32:29 TFTP Get Name C:\server\\kodi\boot\recovery.elf Mode octet Size 0 tsize 0
2019-06-20 14:32:29 TFTP  Error   192.168.1.26  Get  1 File not found C:\server\kodi\boot\recovery.elf
2019-06-20 14:32:29 TFTP Get Name C:\server\kodi\boot\start.elf Mode octet Size 2857060 tsize 2857060
2019-06-20 14:32:31 TFTP       2s 192.168.1.26  Get/octet  C:\server\kodi\boot\start.elf
...

In "c:\server\kodi\storage\.cache\services" folder create an empty file "sshd.conf". It enables ssh access to the server.
Reboot and you can access the RPi using ssh using login root and default password libreelec.

ssh login screen

Next (Netbooting Raspberry Pi OS from Windows)

www.haneWIN.net Home