瀏覽代碼

Add iPXE disk for packet.net support

Antony Messerli 8 年之前
父節點
當前提交
118d1e89ce
共有 3 個文件被更改,包括 77 次插入2 次删除
  1. 68 0
      ipxe/disks/netboot.xyz-packet
  2. 6 0
      script/prep-release.sh
  3. 3 2
      src/menu.ipxe

+ 68 - 0
ipxe/disks/netboot.xyz-packet

@@ -0,0 +1,68 @@
+#!ipxe
+set esc:hex 1b
+set bold ${esc:string}[1m
+set boldoff ${esc:string}[22m
+set fg_gre ${esc:string}[32m
+set fg_red ${esc:string}[31m
+set fg_cya ${esc:string}[36m
+set fg_whi ${esc:string}[37m
+set HTTPS_ERR HTTPS appears to have failed... attempting HTTP
+set HTTP_ERR HTTP has failed, localbooting...
+set version 1.04
+set ipxe_cloud_config packet
+
+:start
+echo ${bold}${fg_gre}netboot.xyz ${fg_whi}v${version} for ${fg_red}packet.net${boldoff}
+prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to open failsafe menu... && goto failsafe || goto dhcp
+
+:dhcp
+dhcp || goto netconfig
+goto menu
+
+:failsafe
+menu netboot.xyz Failsafe Menu
+item localboot Boot to local drive
+item netconfig Manual network configuration
+item retry Retry boot
+item debug iPXE Debug Shell
+item reboot Reboot System
+choose failsafe_choice || exit
+goto ${failsafe_choice}
+
+:netconfig
+echo Network Configuration:
+echo Available interfaces...
+ifstat
+imgfree
+echo -n Set network interface number [0 for net0, defaults to 0]: ${} && read net
+isset ${net} || set net 0
+echo -n IP: && read net${net}/ip
+echo -n Subnet mask: && read net${net}/netmask
+echo -n Gateway: && read net${net}/gateway
+echo -n DNS: && read dns
+ifopen net${net}
+echo Attempting chainload of netboot.xyz...
+goto menu || goto failsafe
+
+:menu
+set conn_type https
+chain --autofree https://boot.netboot.xyz/menu.ipxe || echo ${HTTPS_ERR}
+sleep 5
+set conn_type http
+chain --autofree http://boot.netboot.xyz/menu.ipxe || echo ${HTTP_ERR}
+goto localboot
+
+:localboot
+exit
+
+:retry
+goto start
+
+:reboot
+reboot
+goto start
+
+:debug
+echo Type "exit" to return to menu
+shell
+goto failsafe

+ 6 - 0
script/prep-release.sh

@@ -50,6 +50,12 @@ mv bin/ipxe.usb ../../build/ipxe/netboot.xyz.usb
 mv bin/ipxe.kpxe ../../build/ipxe/netboot.xyz.kpxe
 mv bin/ipxe.kpxe ../../build/ipxe/netboot.xyz.kpxe
 mv bin/undionly.kpxe ../../build/ipxe/netboot.xyz-undionly.kpxe
 mv bin/undionly.kpxe ../../build/ipxe/netboot.xyz-undionly.kpxe
 
 
+# generate netboot.xyz-packet iPXE disk
+make bin/undionly.kpxe \
+EMBED=../../ipxe/disks/netboot.xyz-packet TRUST=ca-ipxe-org.crt,ca-netboot-xyz.crt
+error_check
+mv bin/undionly.kpxe ../../build/ipxe/netboot.xyz-packet.kpxe
+
 # generate netboot.xyz iPXE disk for Google Compute Engine
 # generate netboot.xyz iPXE disk for Google Compute Engine
 make bin/ipxe.usb CONFIG=cloud EMBED=../../ipxe/disks/netboot.xyz-gce \
 make bin/ipxe.usb CONFIG=cloud EMBED=../../ipxe/disks/netboot.xyz-gce \
 TRUST=ca-ipxe-org.crt,ca-netboot-xyz.crt
 TRUST=ca-ipxe-org.crt,ca-netboot-xyz.crt

+ 3 - 2
src/menu.ipxe

@@ -5,9 +5,10 @@ chain --autofree boot.cfg ||
 iseq ${cls} serial && goto ignore_cls ||
 iseq ${cls} serial && goto ignore_cls ||
 set cls:hex 1b:5b:4a  # ANSI clear screen sequence - "^[[J"
 set cls:hex 1b:5b:4a  # ANSI clear screen sequence - "^[[J"
 set cls ${cls:string}
 set cls ${cls:string}
+set ipxe_disk netboot.xyz-undionly.kpxe
 :ignore_cls
 :ignore_cls
 iseq ${ipxe_cloud_config} gce && set console console=ttyS0,115200n8 || goto version_check
 iseq ${ipxe_cloud_config} gce && set console console=ttyS0,115200n8 || goto version_check
-iseq ${ipxe_cloud_config} packet && set console console=ttyS1,115200n8 || goto version_check
+iseq ${ipxe_cloud_config} packet && set console console=ttyS1,115200n8 && set ipxe_disk netboot.xyz-packet.kpxe || goto version_check
 
 
 :version_check
 :version_check
 set latest_version 1.04
 set latest_version 1.04
@@ -22,7 +23,7 @@ echo
 echo Please download the latest version from netboot.xyz.
 echo Please download the latest version from netboot.xyz.
 echo
 echo
 echo Attempting to chain to latest version...
 echo Attempting to chain to latest version...
-chain --autofree http://${boot_domain}/ipxe/netboot.xyz-undionly.kpxe ||
+chain --autofree http://${boot_domain}/ipxe/${ipxe_disk} ||
 :version_up2date
 :version_up2date
 
 
 isset ${arch} && goto skip_arch_detect ||
 isset ${arch} && goto skip_arch_detect ||