utils-pcbios.ipxe.j2 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!ipxe
  2. :utils_menu
  3. menu Utilities
  4. item --gap Utilities:
  5. {% for key, value in utilitiespcbios.items() | sort(attribute='1.name') %}
  6. {% if value.enabled %}
  7. item {{ key }} ${space} {{ value.name }}
  8. {% endif %}
  9. {% endfor %}
  10. item --gap netboot.xyz tools:
  11. item cmdline ${space} Kernel cmdline params: [${cmdline}]
  12. item nbxyz_custom_url ${space} Set custom menu [url: ${custom_url}]
  13. item nbxyz_custom_github ${space} Set Github username [user: ${github_user}]
  14. item testdistro ${space} Test Distribution ISO
  15. item nbxyz ${space} netboot.xyz endpoints
  16. choose --default ${menu} menu || goto utils_exit
  17. echo ${cls}
  18. goto ${menu} ||
  19. chain ${menu}.ipxe || goto utils_exit
  20. goto utils_exit
  21. {% for key, value in utilitiespcbios.items() | sort %}
  22. {% if value.enabled | bool and value.type == "memdisk" %}
  23. :{{ key }}
  24. set util_path {{ value.util_path }}
  25. set util_file {{ value.util_path | basename }}
  26. set util_version {{ value.version }}
  27. goto boot_{{ value.type }}
  28. {% endif %}
  29. {% endfor %}
  30. {% for key, value in utilitiespcbios.items() | sort %}
  31. {% if value.enabled | bool and value.type == "direct" %}
  32. :{{ key }}
  33. imgfree
  34. kernel {{ value.kernel }}
  35. initrd {{ value.initrd }}
  36. boot
  37. goto utils_exit
  38. {% endif %}
  39. {% endfor %}
  40. :boot_memdisk
  41. imgfree
  42. kernel ${memdisk} iso raw
  43. initrd --name ${util_file} ${util_path}
  44. echo
  45. echo MD5sums:
  46. md5sum memdisk ${util_file}
  47. boot
  48. goto utils_exit
  49. :cmdline
  50. echo If you want to change the default kernel command line parameters
  51. echo you can override the defaults here.
  52. echo
  53. echo Currently set to: ${cmdline}
  54. echo
  55. echo -n Enter cmdline parameters: ${} && read cmdline
  56. goto utils_menu
  57. :memtest
  58. imgfree
  59. kernel {{ utilitiespcbios.memtest.util_path }}
  60. boot
  61. goto utils_menu
  62. :nbxyz_custom_url
  63. echo If you have a customized menu you would like to load into netboot.xyz
  64. echo set the base path url to your custom ipxe files here.
  65. echo It will look for custom.ipxe in that path as the entry point.
  66. echo
  67. echo -n Please enter your custom http url here: ${} && read custom_url
  68. goto utils_menu
  69. :nbxyz_custom_github
  70. echo Make sure you have a fork of https://github.com/netbootxyz/netboot.xyz-custom.
  71. echo You can then customize your fork as needed and set up your own custom options.
  72. echo Once your username is set, a custom option will appear on the main menu.
  73. echo
  74. echo -n Please enter your Github username: ${} && read github_user
  75. goto utils_menu
  76. :testdistro
  77. echo This option will allow you to test booting an ISO using memdisk. Please
  78. echo specify the URL of the ISO you want to test and it will automatically
  79. echo attempt to load the ISO using memdisk.
  80. echo -n URL: ${} && read distro_iso
  81. kernel ${memdisk} iso raw
  82. initrd ${distro_iso}
  83. boot
  84. goto utils_menu
  85. :utils_exit
  86. clear menu
  87. exit 0