Files
netboot.xyz/roles/netbootxyz/tasks/generate_disks_efi.yml
6fa759a811 Add legacy iPXE bootloader disks for USB keyboard compatibility
iPXE upstream (ipxe/ipxe@2161e976) now includes USB NIC drivers by
default in the all-drivers build. This disables BIOS SMM-based USB
legacy support which emulates a PS/2 keyboard, breaking USB keyboards
on some systems.

This adds support for building iPXE's `ipxe-legacy` driver set
variants which exclude USB NIC drivers, preserving USB keyboard
functionality for affected users.

New bootloader variants:
- Legacy BIOS: .lkrn, .dsk, .pdsk, .kpxe (with -legacy suffix)
- EFI: .efi (with -legacy suffix)
- Hybrid: .iso, .img (with -legacy suffix)

Controlled by the `generate_disks_legacy_usb` flag (default: true).

Agent-Logs-Url: https://github.com/netbootxyz/netboot.xyz/sessions/0337d14a-1d72-43d8-aa32-8a804eeac778

Co-authored-by: antonym <245007+antonym@users.noreply.github.com>
2026-04-11 21:57:36 +00:00

110 lines
3.8 KiB
YAML

---
- name: Copy netboot.xyz local EFI iPXE configs
ansible.builtin.copy:
src: "ipxe/local/{{ item }}"
dest: "{{ ipxe_source_dir }}/src/config/local/{{ item }}"
with_items:
- colour.h
- console.h
- crypto.h
- name: Copy netboot.xyz general.h.efi iPXE config
ansible.builtin.copy:
src: "ipxe/local/general.h.efi"
dest: "{{ ipxe_source_dir }}/src/config/local/general.h"
- name: Set trust file to ipxe ca
ansible.builtin.set_fact:
trust_files: "{{ cert_dir }}/{{ ipxe_ca_filename }}"
when: not generate_signatures
- name: Combine trust files if set
ansible.builtin.set_fact:
trust_files: "{{ cert_dir }}/{{ ipxe_ca_filename }},{{ cert_dir }}/{{ cert_file_filename }}"
when: generate_signatures | bool
- name: Compile iPXE bootloader for EFI
ansible.builtin.shell: |
make clean
make -j{{ make_num_jobs }} \
EMBED={{ bootloader_filename }} \
TRUST={{ trust_files }} \
bin-x86_64-efi/ipxe.efi \
bin-x86_64-efi/snp.efi \
bin-x86_64-efi/snponly.efi
args:
chdir: "{{ ipxe_source_dir }}/src"
when: ipxe_debug_enabled | bool == false
- name: Compile iPXE bootloader for EFI with debug flags
ansible.builtin.shell: |
make clean
make -j{{ make_num_jobs }} \
EMBED={{ bootloader_filename }} \
DEBUG={{ ipxe_debug_options }} \
TRUST={{ trust_files }} \
bin-x86_64-efi/ipxe.efi \
bin-x86_64-efi/snp.efi \
bin-x86_64-efi/snponly.efi
args:
chdir: "{{ ipxe_source_dir }}/src"
when: ipxe_debug_enabled | bool
- name: Generate iPXE floppy images for EFI
ansible.builtin.shell: |
truncate -s 1440k bin-x86_64-efi/ipxe.efi.dsk
mformat -i bin-x86_64-efi/ipxe.efi.dsk -f 1440 ::
mmd -i bin-x86_64-efi/ipxe.efi.dsk ::EFI
mmd -i bin-x86_64-efi/ipxe.efi.dsk ::EFI/BOOT
cp bin-x86_64-efi/ipxe.efi.dsk bin-x86_64-efi/snp.efi.dsk
mcopy -i bin-x86_64-efi/ipxe.efi.dsk bin-x86_64-efi/ipxe.efi ::EFI/BOOT/BOOTX64.EFI
mcopy -i bin-x86_64-efi/snp.efi.dsk bin-x86_64-efi/snp.efi ::EFI/BOOT/BOOTX64.EFI
args:
chdir: "{{ ipxe_source_dir }}/src"
- name: Copy iPXE EFI builds to http directory
ansible.builtin.copy:
src: "{{ ipxe_source_dir }}/src/{{ item.src }}"
dest: "{{ netbootxyz_root }}/ipxe/{{ item.dest }}"
remote_src: true
with_items:
- {src: "bin-x86_64-efi/ipxe.efi", dest: "{{ bootloader_filename }}.efi"}
- {src: "bin-x86_64-efi/snp.efi", dest: "{{ bootloader_filename }}-snp.efi"}
- {src: "bin-x86_64-efi/snponly.efi", dest: "{{ bootloader_filename }}-snponly.efi"}
- {src: "bin-x86_64-efi/ipxe.efi.dsk", dest: "{{ bootloader_filename }}.efi.dsk"}
- {src: "bin-x86_64-efi/snp.efi.dsk", dest: "{{ bootloader_filename }}-snp.efi.dsk"}
- name: Compile iPXE legacy-driver bootloader for EFI
ansible.builtin.shell: |
make -j{{ make_num_jobs }} \
EMBED={{ bootloader_filename }} \
TRUST={{ trust_files }} \
bin-x86_64-efi/ipxe-legacy.efi
args:
chdir: "{{ ipxe_source_dir }}/src"
when:
- generate_disks_legacy_usb | default(true) | bool
- ipxe_debug_enabled | bool == false
- name: Compile iPXE legacy-driver bootloader for EFI with debug flags
ansible.builtin.shell: |
make -j{{ make_num_jobs }} \
EMBED={{ bootloader_filename }} \
DEBUG={{ ipxe_debug_options }} \
TRUST={{ trust_files }} \
bin-x86_64-efi/ipxe-legacy.efi
args:
chdir: "{{ ipxe_source_dir }}/src"
when:
- generate_disks_legacy_usb | default(true) | bool
- ipxe_debug_enabled | bool
- name: Copy iPXE legacy-driver EFI build to http directory
ansible.builtin.copy:
src: "{{ ipxe_source_dir }}/src/bin-x86_64-efi/ipxe-legacy.efi"
dest: "{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}-legacy.efi"
remote_src: true
when:
- generate_disks_legacy_usb | default(true) | bool