Fix code blocks in "Boot Raspberry Pi Over TFTP" post

This commit is contained in:
Eryn Wells 2022-10-01 09:49:27 -07:00
parent 6af32976c6
commit 9ebc58f50a

View file

@ -11,18 +11,18 @@ according to the instructions in the Raspberry Pi documentation. That page is
also on [GitHub][eeprom-gh] which might be a more stable location. On Raspbian
on the RPi:
```bash
{{< figures/code lang=sh >}}
fw=/lib/firmware/raspberrypi/bootloader/stable/pieeprom-2020-09-03.bin
rpi-eeprom-config $fw > ~/bootconf.txt
vi ~/bootconf.txt
rpi-eeprom-config --out ~/pieeprom-new.bin --config ~/bootconf.txt $fw
sudo rpi-eeprom-update -d -f ~/pieeprom-new.bin
sudo reboot
```
{{< /figures/code >}}
My updated bootconf.txt is:
```conf
{{< figures/code lang=cfg >}}
[all]
BOOT_UART=1
WAKE_ON_GPIO=0
@ -33,7 +33,7 @@ TFTP_FILE_TIMEOUT=30000
ENABLE_SELF_UPDATE=1
DISABLE_HDMI=0
BOOT_ORDER=0xf412
```
{{< /figures/code >}}
I enabled UART debugging, and set the boot order to be: network `0x2`, SD card
`0x1`, USB mass storage `0x4`, and finally reboot `0xf`. These steps need to be
@ -41,11 +41,11 @@ repeated if the bootloader is updated via apt.
I [enabled the TFTP server][mac-tftp] on my Mac:
```bash
{{< figures/code lang=sh >}}
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
sudo launchctl enable System/com.apple.tftpd
sudo launchctl start com.apple.tftpd
```
{{< /figures/code >}}
Im not sure if the `enable` command is actually necessary. This doesn't
actually start the `tftpd` daemon. Instead, macOS starts the daemon on demand
@ -55,11 +55,11 @@ The tftp server looks for files to serve out of **/private/tftpboot**, and those
things need to be world `rwx`, i.e. `777`. By default (this is configurable) the
RPi queries for a directory named by its serial number.
```bash
{{< figures/code lang=sh >}}
mkdir /private/tftpboot/$raspberry_pi_serial
chmod 777 /private/tftpboot
chmod -R 777 /private/tftpboot/*
```
{{< /figures/code >}}
RPi looks for files of various names in that directory, one in particular by the
name of **start.elf**.
@ -69,13 +69,13 @@ command line) to pass a `tftp-server` parameter in the DHCP payload. This step
may be optional because you can also set `TFTP_IP` in the **bootconf.txt** above
to specify the IP directly. On my router:
```bash
{{< figures/code lang=sh >}}
configure
set service dhcp-server shared-network-name LAN subnet $lan_cidr_subnet tftp-server-name $ip_of_mac
commit
save
exit
```
{{< /figures/code >}}
I also gave my Mac a static IP, and renewed the DHCP lease so it took the new IP
to make the whole process a little more smooth. Now, it appears the RPi will
@ -88,4 +88,4 @@ attempt a TFTP boot, and I see queries in the logs on my Mac.
[eeprom]: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md
[eeprom-gh]: https://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/bcm2711_bootloader_config.md
[mac-tftp]: https://www.unixfu.ch/start-a-tftp-server-on-your-mac/
[mac-tftp]: https://www.unixfu.ch/start-a-tftp-server-on-your-mac/