How to boot and run a SD-less Raspberry Pi from WindowsCopyright © 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:
- The RPi sends out a DHCP request.
- The DHCP server must respond with ip-address, ... tftp server address and a defined vendor tag.
- 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).
- 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:
In haneWIN DHCP Server
- Create a folder e.g. "c:\server\kodi".
- Create two sub folders, "boot" and "storage"
- Download "LibreELEC-RPi2.arm-9.0.2.img.gz"
- Use 7zip to extract the SD image.
- Use 7zip to open the SD image and extract "0.fat".
- Use 7zip to open "0.fat" and extract the whole contents to folder "boot".
- In file "cmdline.txt" in folder "boot"
- Add ip=dhcp at the beginning of the line.
- Replace entries boot=... and disk=... with boot=NFS=192.168.1.4:/kodi/boot disk=NFS=192.168.1.4:/kodi/storage
- Create a new DHCP server profile for clients with static IP addresses.
- Configure the profile
- Set Gateway IP address
- On tab "DNS" set DNS server IP address
- On tab "Boot" set the TFTP server "Next Server IP address" to your Windows PC ip address.
- On tab "Other" select option "43 Vendor specific" and
- Add values: 6 1 3 10 4 0 80 88 69 9 20 0 0 17 82 97 115 112 98 101 114 114 121 32 80 105 32 66 111 111 116 255
- It consists of the following parts:
- tag 6 len 1 value 3
- tag 10 len 4 value 0 PXE
- tag 9 len 20 value 0 0 17 Raspberry 32 Pi 32 Boot
- tag 255
- The calculated length value should be 32 bytes.
- In Preferences-TFTP set the TFTP Root Directory to: c:\server\kodi\boot.
- 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
- 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.
In haneWIN NFS Server (1.2.50 and higher)
- Select under Preferences-Server the option "Save attributes/uid/gid on NTFS volumes"
- Create a NFS server exports entry: c:\server\kodi -name:kodi -alldirs -maproot:0:0
- What the options do:
- name the exported filesystem kodi for clients
- allow mount of subfolders
- map libreelec user/group root to root for file access
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.
Next (Netbooting Raspberry Pi OS from Windows) |
www.haneWIN.net | Home |