How to boot a Raspberry Pi from Windows

Copyright 2019 Herbert Hanewinkel, Neuried
 
06.2019

Overview

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 assume the following addresses. Adapt to your own numbers:

Windows IP address: 192.168.1.4
Router/Gateway IP address: 192.168.1.73
DNS Server IP address: 192.168.1.73
RPi IP address: 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
  1. In Preferences-TFTP set the TFTP Root Directory to: c:\server\kodi\boot.
    dhcp tftp configuration
  2. 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

  3. 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.43 and higher)
  1. Create a NFS server exports entry: c:\server\kodi -name:kodi -alldirs -umask:077 -sub:35 -maproot:0

    nfs configuration
  2. 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 Raspbian from Windows)

www.haneWIN.net Home