Feature/ipxe customization

pull/2/head
Alexander Böhm 2020-11-07 20:40:14 +01:00
parent b5cb86950d
commit 1769770e79
12 changed files with 78 additions and 31 deletions

View File

@ -9,6 +9,24 @@
server_name: faiserver
# ip of the server of the installer network
server_ip: 192.168.33.1
ipxe_additional_entries:
dban:
name: Memtest86+
files: tools/memtest
kernel: memtest86+-5.31b.bin
# other:
# files: path/to/files/to/copy
# name: Menu Entry
# initrd:
# - initrd0.img
# - initrd1.img
# - ...
# multiboot:
# - module0.img
# - module1.img
# - ...
roles:
- fai

View File

@ -19,3 +19,5 @@ tftp_dir: "/srv/tftp/fai"
http_mirror_ipxe_path_prefix: "ipxe"
http_mirror_fai_path_prefix: "fai"
ipxe_additional_entries:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,16 +10,17 @@
with_items:
- /usr/lib/ipxe/ipxe.efi
- /usr/lib/ipxe/ipxe.pxe
- /usr/lib/ipxe/ipxe.lkrn
- name: write ipxe menu
copy:
content: |
#!ipxe
set boot-root {{ http_mirror_ipxe_root_url }}
set menu-default fai
set menu-default __exit
set menu-timeout 5000
set submenu-timeout ${menu-timeout}
isset ${menu-default} || set menu-default exit
isset ${menu-default} || set menu-default __exit
# Figure out if client is 64-bit capable
cpuid --ext 29 && set arch x64 || set arch x86
@ -27,53 +28,72 @@
:start
menu iPXE boot menu
item --key f fai FAI Installer
item --key x __exit Exit iPXE and continue local boot
item --gap --
item --key d dban Dariks boot and nuke (DBAN)
item --key f __fai FAI Installer
{% for k, v in ipxe_additional_entries.items() %}
item {% if 'key' in v %}--key v.key {% endif %}{{ k }} {% if 'name' in v %}{{ v.name }}{% else %}{{ k }}{% endif %}
{% endfor %}
item --gap --
item --key c config Configure settings
item shell Drop to iPXE shell
item reboot Reboot computer
item
item --key x exit Exit iPXE and continue BIOS boot
item __reload_after_fail Reload iPXE
item --gap --
item --key c __config Configure settings
item __shell Drop to iPXE shell
item __reboot Reboot computer
choose --timeout ${menu-timeout} --default ${menu-default} selected || goto cancel
set menu-timeout 0
goto ${selected}
:cancel
:__cancel
echo You cancelled the menu, dropping you to a shell
:shell
:__shell
echo Type 'exit' to get the back to the menu
shell
set menu-timeout 0
set submenu-timeout 0
goto start
:failed
:__failed
echo Booting failed, dropping to shell
goto shell
goto __shell
:config
:__config
config
goto start
:reboot
:__reload_after_fail
echo Reloading iPXE
sleep 3
chain --replace --autofree menu.ipxe || goto failed
:__reboot
reboot
:exit
:__exit
exit
:fai
kernel --name fai ${boot-root}/{{ fai_live_vmlinuz }} root=live:{{ http_mirror_fai_squashfs_url }} FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC={{ http_mirror_fai_profiles_url }} FAI_ACTION=install net.ifnames=0 ip=dhcp
imgfetch --name fai ${boot-root}/{{ fai_live_initrd }}
boot || goto failed
:__fai
kernel ${boot-root}/{{ fai_live_vmlinuz }} root=live:{{ http_mirror_fai_squashfs_url }} FAI_FLAGS=verbose,sshd,createv,menu FAI_CONFIG_SRC={{ http_mirror_fai_profiles_url }} FAI_ACTION=install net.ifnames=0 ip=dhcp || goto __reload_after_fail
initrd ${boot-root}/{{ fai_live_initrd }} || goto __reload_after_fail
boot || goto __reload_after_fail
goto start
:dban
kernel ${boot-root}/dban.bzi silent vga=785
boot || goto failed
goto start
{% for k, v in ipxe_additional_entries.items() %}{% if 'kernel' %}
:{{ k }}
kernel ${boot-root}/{{ k }}/{{ v.kernel }} {% if 'args' in v %}{{ v['args'] }}{% endif %} || goto __reload_after_fail
{% if 'initrd' in v %}{% for initrd in v.initrd %}
initrd ${boot-root}/{{ k }}/{{ initrd }} || goto __reload_after_fail
{% endfor %}{% endif %}
{% if 'module' in v %}{% for module in v.multiboot %}
module ${boot-root}/{{ k }}/{{ module }} || goto __reload_after_fail
{% endfor %}{% endif %}
boot || goto __reload_after_fail
goto start{% endif %}
{% endfor %}
dest: /srv/tftp/fai/menu.ipxe
mode: 0644
owner: root

View File

@ -33,10 +33,11 @@
shell: "fai-cd -f -M -S {{ fai_squashfs_path }} -d {{ http_mirror_fai_profiles_url }}"
when: "not squash_img.stat.exists"
- name: copy dban image
copy:
src: files/dban/dban.bzi
dest: "{{ ipxe_download_dir }}/dban.bzi"
owner: root
group: root
mode: u=rw,g=r,o=r
- name: copy additional files
synchronize:
src: "{{ item.value.files }}/"
dest: "{{ ipxe_download_dir }}/{{ item.key }}"
mode: push
delete: yes
recursive: yes
with_dict: "{{ ipxe_additional_entries }}"

1
tools/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

5
tools/README.md Normal file
View File

@ -0,0 +1,5 @@
# Additional tools für PXE menu
Content:
* *memtest* [Memtest86+](http://memtest.org)

Binary file not shown.