How to boot a Raspberry Pi from Windows
Copyright © 2019 Herbert Hanewinkel, Neuried
Remote booting Raspbian 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
- Create a folder e.g. "c:\server\raspbian".
- Create a sub folder, "boot"
- Download a zipped Rasbian image, e.g. 2019-04-08-raspbian-stretch-lite.zip
- Use 7zip to extract the SD image.
- Use 7zip to open the SD image and extract "0.fat".
- Use 7zip to open the SD image and extract "1.img" to c:\server\raspbian.
- Use 7zip to open "0.fat" and extract the whole contents to folder "boot".
- In file "cmdline.txt" in folder "boot" from the line
In haneWIN NFS Server (1.2.43 and higher)
- Remove root=...
- Remove rootfstype=ext4
- Remove fsck.repair=yes
- Remove init=/usr/lib/raspi-config/init_resize.sh
- Add root=/dev/nfs nfsroot=192.168.1.4:/raspbian/nfs,vers=3 rw ip=dhcp
Create a NFS server exports entry:
c:\server\raspbian -name:raspbian -alldirs -umask:077 -sub:35 -maproot:0
- What the options do:
- name the exported filesystem raspbian for clients
- allow mount of subfolders
- disable access for group and world to protect ssh keys.
- substitute in filenames on Windows a : by #
- map raspbian user root to root for file access
7zip can open "1.img" but it is in ext format and 7z does not handle symbolic links on extraction. We need the
contents of "1.img" in the correct format for the NFS server:
- Boot the RPi with libreelec and login with ssh (setup description on previous page)
- Create two directories /var/raspbian and /var/nfs
- mount -t nfs 192.168.1.4:/raspbian /var/raspbian
now we can access the image "1.img" in libreelec.
- Bind the image to a device:
losetup /dev/loop1 /var/raspbian/1.img
- Mount the device:
mount /dev/loop1 /var/nfs
now we can access the contents of the image "1.img" in libreelec
- cp -a /var/nfs /var/raspbian
(could take an hour depending on the downloaded Raspbian release. libreelec has no rsync and cp -a worked fine)
- Clean up:
umount /var/raspbian and umount /var/nfs
rmdir /var/raspbian and rmdir /var/nfs
In haneWIN DHCP Server
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:
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.
the RPi. Now it should boot Raspbian from the net. Good luck.