mirror of
https://github.com/netbootxyz/netboot.xyz.git
synced 2025-08-10 15:56:58 +02:00
Adds PCI Device List to menu
Adds a PCI Device list tool to the menu which uses the pci.ids list and refreshes it during deployment.
This commit is contained in:
parent
c74c21c882
commit
01fdb200a3
@ -35,6 +35,10 @@ generate_version_file: false
|
|||||||
generate_checksums: true
|
generate_checksums: true
|
||||||
checksums_filename: "{{ site_name }}-sha256-checksums.txt"
|
checksums_filename: "{{ site_name }}-sha256-checksums.txt"
|
||||||
|
|
||||||
|
# pciids
|
||||||
|
generate_pciids: true
|
||||||
|
pciids_url: https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
|
||||||
|
|
||||||
# bootloader options
|
# bootloader options
|
||||||
generate_disks: true
|
generate_disks: true
|
||||||
generate_disks_legacy: true
|
generate_disks_legacy: true
|
||||||
|
26
roles/netbootxyz/files/pciids_gen
Executable file
26
roles/netbootxyz/files/pciids_gen
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Used for processing pci.ids into ipxe format
|
||||||
|
# https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
|
||||||
|
|
||||||
|
if [[ ! -n "$1" || ! -n "$2" ]]; then
|
||||||
|
echo "Please set PCIIDS file location and PCIIDS output file location..."
|
||||||
|
echo "pciids_gen pci.ids pciids.ipxe"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PCIIDS_FILE=$1
|
||||||
|
PCIIDS_IPXE=$2
|
||||||
|
|
||||||
|
awk ' \
|
||||||
|
BEGIN { \
|
||||||
|
print "#!ipxe\ngoto ${vendor}${device} || goto ${vendor} || exit" \
|
||||||
|
} \
|
||||||
|
/^[0-9a-f]{4}/ { \
|
||||||
|
vendor=substr($1,1,4); \
|
||||||
|
printf ":%s\nset ven %s\nexit\n", vendor, substr($0,7) \
|
||||||
|
} \
|
||||||
|
/^\t[0-9a-f]{4}/ { \
|
||||||
|
printf ":%s%s\nset dev %s\ngoto %s\n", \
|
||||||
|
vendor, substr($0, 2, 4), substr($0, 8), vendor \
|
||||||
|
} \
|
||||||
|
' ${PCIIDS_FILE} > ${PCIIDS_IPXE}
|
27
roles/netbootxyz/tasks/generate_pciids.yml
Normal file
27
roles/netbootxyz/tasks/generate_pciids.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
- name: Retrieve pci.ids
|
||||||
|
get_url:
|
||||||
|
url: "{{ pciids_url }}"
|
||||||
|
dest: "{{ netbootxyz_root }}/pci.ids"
|
||||||
|
|
||||||
|
- name: Copy pciids_gen script to source dir
|
||||||
|
copy:
|
||||||
|
src: pciids_gen
|
||||||
|
dest: "{{ netbootxyz_root }}/pciids_gen"
|
||||||
|
mode: 0744
|
||||||
|
|
||||||
|
- name: Convert pci.ids to pciids.ipxe
|
||||||
|
shell: |
|
||||||
|
./pciids_gen pci.ids pciids.ipxe
|
||||||
|
args:
|
||||||
|
chdir: "{{ netbootxyz_root }}"
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
|
- name: Cleanup of files no longer needed
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- "{{ netbootxyz_root }}/pciids_gen"
|
||||||
|
- "{{ netbootxyz_root }}/pci.ids"
|
@ -3,6 +3,10 @@
|
|||||||
when:
|
when:
|
||||||
- generate_menus | default(true) | bool
|
- generate_menus | default(true) | bool
|
||||||
|
|
||||||
|
- include: generate_pciids.yml
|
||||||
|
when:
|
||||||
|
- generate_pciids | default(true) | bool
|
||||||
|
|
||||||
- include: generate_menus_custom.yml
|
- include: generate_menus_custom.yml
|
||||||
when:
|
when:
|
||||||
- custom_generate_menus | default(false) | bool
|
- custom_generate_menus | default(false) | bool
|
||||||
|
34
roles/netbootxyz/templates/menu/lspci.ipxe.j2
Normal file
34
roles/netbootxyz/templates/menu/lspci.ipxe.j2
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!ipxe
|
||||||
|
|
||||||
|
# gather pci devices and list them
|
||||||
|
clear addr
|
||||||
|
pciscan addr && goto pciscan_found ||
|
||||||
|
echo No pci devices found...
|
||||||
|
exit
|
||||||
|
:pciscan_found
|
||||||
|
|
||||||
|
set spaces2:hex 20:20
|
||||||
|
set spaces4:hex 20:20:20:20
|
||||||
|
|
||||||
|
imgfetch pciids.ipxe
|
||||||
|
iseq ${sigs_enabled} true && goto verify_sigs || goto skip_verify
|
||||||
|
:verify_sigs
|
||||||
|
imgverify pciids.ipxe ${sigs}pciids.ipxe.sig ||
|
||||||
|
:skip_verify
|
||||||
|
|
||||||
|
clear addr
|
||||||
|
menu PCI device list
|
||||||
|
:scan pciscan addr || goto scan_done
|
||||||
|
clear ven
|
||||||
|
clear dev
|
||||||
|
set vendor ${pci/${addr}.0.2}
|
||||||
|
set device ${pci/${addr}.2.2}
|
||||||
|
chain pciids.ipxe
|
||||||
|
item --gap ${addr:busdevfn} ${spaces4:string} ${ven}
|
||||||
|
item b${addr:busdevfn} ${spaces2:string} ${vendor}:${device} ${dev}
|
||||||
|
goto scan
|
||||||
|
:scan_done
|
||||||
|
choose press_enter ||
|
||||||
|
|
||||||
|
imgfree pciids.ipxe
|
||||||
|
exit
|
@ -57,6 +57,7 @@ iseq ${arch} x86_64 && set bits 64 || set bits 32
|
|||||||
item changebits ${space} Architecture: ${arch} (${bits}bit)
|
item changebits ${space} Architecture: ${arch} (${bits}bit)
|
||||||
item shell ${space} iPXE shell
|
item shell ${space} iPXE shell
|
||||||
item netinfo ${space} Network card info
|
item netinfo ${space} Network card info
|
||||||
|
item lspci ${space} PCI Device List
|
||||||
item about ${space} About netboot.xyz
|
item about ${space} About netboot.xyz
|
||||||
{% if sigs_menu | bool %}
|
{% if sigs_menu | bool %}
|
||||||
item --gap Signature Checks:
|
item --gap Signature Checks:
|
||||||
|
Loading…
Reference in New Issue
Block a user