|
| 1 | +--- |
| 2 | +id: custom-menus |
| 3 | +title: Custom Menus |
| 4 | +sidebar_position: 5 |
| 5 | +description: "How to create and use custom iPXE menus using the web interface" |
| 6 | +hide_table_of_contents: false |
| 7 | +--- |
| 8 | + |
| 9 | +# Custom Menus |
| 10 | + |
| 11 | +The netboot.xyz web interface allows you to create custom iPXE menus that can be integrated into your netboot.xyz environment. This feature enables you to add your own boot options, utilities, or custom configurations without modifying the core netboot.xyz code. |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- Access to the netboot.xyz web interface |
| 16 | +- Basic understanding of iPXE scripting |
| 17 | +- Ability to modify configuration files |
| 18 | + |
| 19 | +## Creating a Custom Menu |
| 20 | + |
| 21 | +### Step 1: Enable Custom Menu in Configuration |
| 22 | + |
| 23 | +First, you need to modify the `boot.cfg` file to enable custom menu support: |
| 24 | + |
| 25 | +```bash |
| 26 | +set menu custom-user |
| 27 | +``` |
| 28 | + |
| 29 | +This setting tells netboot.xyz to include the custom menu option in the main menu. |
| 30 | + |
| 31 | +### Step 2: Create the Custom Menu File |
| 32 | + |
| 33 | +1. Navigate to the netboot.xyz web interface |
| 34 | +2. Click on the **Menus** option in the header |
| 35 | +3. Create a new file with the filename `custom.ipxe` |
| 36 | + |
| 37 | +### Step 3: Update the Menu Configuration |
| 38 | + |
| 39 | +You need to update the `menu.ipxe` file to properly chain to your custom menu: |
| 40 | + |
| 41 | +Replace the existing line: |
| 42 | +```bash |
| 43 | +chain custom/custom.ipxe |
| 44 | +``` |
| 45 | + |
| 46 | +With: |
| 47 | +```bash |
| 48 | +chain custom/custom.ipxe |
| 49 | +``` |
| 50 | + |
| 51 | +### Step 4: Configure Your Custom Menu |
| 52 | + |
| 53 | +Inside the `custom.ipxe` file you created, add your custom menu configuration. You can structure your menu using standard iPXE syntax. |
| 54 | + |
| 55 | +## Menu Structure Example |
| 56 | + |
| 57 | +Here's a basic structure for your custom menu: |
| 58 | + |
| 59 | +```bash |
| 60 | +#!ipxe |
| 61 | +######## CUSTOM MENU ######## |
| 62 | + |
| 63 | +:custom_menu |
| 64 | +menu Custom Boot Options |
| 65 | +item --gap -- Custom Options: |
| 66 | +item custom_option1 Custom Option 1 |
| 67 | +item custom_option2 Custom Option 2 |
| 68 | +item --gap -- Tools: |
| 69 | +item custom_tool1 Custom Tool 1 |
| 70 | +item --gap -- Return: |
| 71 | +item return Return to Main Menu |
| 72 | +choose --default return --timeout 10000 custom_target && goto ${custom_target} |
| 73 | + |
| 74 | +:custom_option1 |
| 75 | +# Add your custom boot logic here |
| 76 | +echo Booting Custom Option 1... |
| 77 | +# Add your boot commands |
| 78 | +goto custom_menu |
| 79 | + |
| 80 | +:custom_option2 |
| 81 | +# Add your custom boot logic here |
| 82 | +echo Booting Custom Option 2... |
| 83 | +# Add your boot commands |
| 84 | +goto custom_menu |
| 85 | + |
| 86 | +:custom_tool1 |
| 87 | +# Add your custom tool logic here |
| 88 | +echo Loading Custom Tool 1... |
| 89 | +# Add your tool commands |
| 90 | +goto custom_menu |
| 91 | + |
| 92 | +:return |
| 93 | +exit |
| 94 | +``` |
| 95 | + |
| 96 | +## Resources and Examples |
| 97 | + |
| 98 | +### Example Configuration |
| 99 | + |
| 100 | +For a complete example of a custom menu configuration, visit: |
| 101 | +- [netboot.xyz-custom example](https://github.com/netbootxyz/netboot.xyz-custom/blob/master/custom.ipxe.example) |
| 102 | + |
| 103 | +### iPXE Documentation |
| 104 | + |
| 105 | +For detailed information about iPXE commands and syntax: |
| 106 | +- [iPXE Commands Reference](https://ipxe.org/cmd) |
| 107 | + |
| 108 | +### Community Examples |
| 109 | + |
| 110 | +You can find additional examples and inspiration from other users' configurations: |
| 111 | +- [netboot.xyz-custom repository forks](https://github.com/netbootxyz/netboot.xyz-custom/forks) |
| 112 | + |
| 113 | +## Best Practices |
| 114 | + |
| 115 | +1. **Test your menu thoroughly** - Always test your custom menu in a safe environment before deploying to production |
| 116 | +2. **Keep it simple** - Start with basic menu items and gradually add complexity |
| 117 | +3. **Document your changes** - Comment your iPXE code to make it easier to maintain |
| 118 | +4. **Use descriptive names** - Choose clear, descriptive names for your menu items |
| 119 | +5. **Handle errors gracefully** - Include error handling in your custom boot logic |
| 120 | + |
| 121 | +## Troubleshooting |
| 122 | + |
| 123 | +### Common Issues |
| 124 | + |
| 125 | +- **Menu not appearing**: Ensure `set menu custom-user` is properly set in `boot.cfg` |
| 126 | +- **File not found**: Verify that `custom.ipxe` exists in the correct location |
| 127 | +- **Syntax errors**: Check your iPXE syntax using the command reference |
| 128 | +- **Boot failures**: Test individual boot commands before integrating them into the menu |
| 129 | + |
| 130 | +### Getting Help |
| 131 | + |
| 132 | +If you encounter issues with your custom menu: |
| 133 | +1. Check the [iPXE documentation](https://ipxe.org/cmd) for command syntax |
| 134 | +2. Review the [example configuration](https://github.com/netbootxyz/netboot.xyz-custom/blob/master/custom.ipxe.example) |
| 135 | +3. Ask for help in the netboot.xyz community forums or GitHub discussions |
| 136 | + |
| 137 | +## Related Documentation |
| 138 | + |
| 139 | +- [Self Hosting](./selfhosting.md) - For information about self-hosted custom options |
| 140 | +- [FAQ](./faq.md) - For general questions about netboot.xyz |
| 141 | +- [Quick Start](./quick-start.md) - For getting started with netboot.xyz |
0 commit comments