Skip to content

Instantly share code, notes, and snippets.

@9nut
Last active June 5, 2020 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9nut/5a3829356b6d0ce3ae47e2f390df7442 to your computer and use it in GitHub Desktop.
Save 9nut/5a3829356b6d0ce3ae47e2f390df7442 to your computer and use it in GitHub Desktop.
Plan 9 dhcpd.c modifications for PXE booting Raspberry Pi 3 and Pi 4
diff ./dhcpd.c /n/sources/plan9/sys/src/cmd/ip/dhcpd/dhcpd.c
1143d1142
< char ipaddrstr[NDB_IPlen];
1263,1267d1261
< case ODtftpserver: /* RPi4s request it for no-SD netbooting without hardcoding TFTP_IP in EEPROM */
< memset(ipaddrstr, 0, sizeof(ipaddrstr));
< sprint(ipaddrstr, "%I", rp->up->laddr);
< stringopt(rp, ODtftpserver, ipaddrstr);
< break;
1289,1308d1282
<
< /* point back to packet, encapsulate vopts into packet */
< j = rp->p - vopts;
< rp->p = op;
< rp->max = omax;
< vectoropt(rp, OBvendorinfo, vopts, j);
< }else if(strncmp((char*)rp->vendorclass, "PXEClient", 9) == 0){
< /* raspberry pi 3 */
< /* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net.md */
< /* raspberry pi 4 */
< /* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md */
<
< /* point to temporary area */
< op = rp->p;
< omax = rp->max;
< /* stash encoded options in vopts */
< rp->p = vopts;
< rp->max = vopts + sizeof(vopts) - 1;
<
< stringopt(rp, OBvendorinfo, "Raspberry Pi Boot ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment