initrd: add iBFT reader

System Internals / NetworkManager - Lubomir Rintel [v3.sk] - 18 September 2018 15:40 EDT

This is loosely based on nms-ibft-reader, but with some significant changes. Notably, it parses /sys/firmware/ibft directly instead of iscsiadm output.

iscsiadm is not available on early boot (perhaps it's too large) and turns out that parsing sysfs directly is easier and more straightforwared anyways. A win-win situation.

It is not useful alone, it's in a separate commit just for the sake of easier review.

b544f7243 initrd: add iBFT reader
.gitignore | 1 +
Makefile.am | 244 ++++++++++++
src/initrd/nm-initrd-generator.h | 45 +++
src/initrd/nmi-ibft-reader.c | 441 +++++++++++++++++++++
src/initrd/tests/meson.build | 22 +
.../tests/sysfs-bad-dns1/class/net/eth0/address | 1 +
.../sysfs-bad-dns1/firmware/ibft/ethernet0/gateway | 1 +
.../sysfs-bad-dns1/firmware/ibft/ethernet0/index | 1 +
.../sysfs-bad-dns1/firmware/ibft/ethernet0/ip-addr | 1 +
.../sysfs-bad-dns1/firmware/ibft/ethernet0/mac | 1 +
.../sysfs-bad-dns1/firmware/ibft/ethernet0/origin | 1 +
.../firmware/ibft/ethernet0/prefix-len | 1 +
.../firmware/ibft/ethernet0/primary-dns | 1 +
.../firmware/ibft/ethernet0/secondary-dns | 1 +
.../firmware/ibft/ethernet0/subnet-mask | 1 +
.../sysfs-bad-dns1/firmware/ibft/ethernet0/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../sysfs-bad-dns1/firmware/ibft/target0/index | 1 +
.../sysfs-bad-dns1/firmware/ibft/target0/ip-addr | 1 +
.../tests/sysfs-bad-dns1/firmware/ibft/target0/lun | 1 +
.../sysfs-bad-dns1/firmware/ibft/target0/port | 1 +
.../firmware/ibft/target0/target-name | 1 +
.../tests/sysfs-bad-dns2/class/net/eth0/address | 1 +
.../sysfs-bad-dns2/firmware/ibft/ethernet0/gateway | 1 +
.../sysfs-bad-dns2/firmware/ibft/ethernet0/index | 1 +
.../sysfs-bad-dns2/firmware/ibft/ethernet0/ip-addr | 1 +
.../sysfs-bad-dns2/firmware/ibft/ethernet0/mac | 1 +
.../sysfs-bad-dns2/firmware/ibft/ethernet0/origin | 1 +
.../firmware/ibft/ethernet0/prefix-len | 1 +
.../firmware/ibft/ethernet0/primary-dns | 1 +
.../firmware/ibft/ethernet0/secondary-dns | 1 +
.../firmware/ibft/ethernet0/subnet-mask | 1 +
.../sysfs-bad-dns2/firmware/ibft/ethernet0/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../sysfs-bad-dns2/firmware/ibft/target0/index | 1 +
.../sysfs-bad-dns2/firmware/ibft/target0/ip-addr | 1 +
.../tests/sysfs-bad-dns2/firmware/ibft/target0/lun | 1 +
.../sysfs-bad-dns2/firmware/ibft/target0/port | 1 +
.../firmware/ibft/target0/target-name | 1 +
.../tests/sysfs-bad-gateway/class/net/eth0/address | 1 +
.../firmware/ibft/ethernet0/gateway | 1 +
.../firmware/ibft/ethernet0/index | 1 +
.../firmware/ibft/ethernet0/ip-addr | 1 +
.../sysfs-bad-gateway/firmware/ibft/ethernet0/mac | 1 +
.../firmware/ibft/ethernet0/origin | 1 +
.../firmware/ibft/ethernet0/prefix-len | 1 +
.../firmware/ibft/ethernet0/primary-dns | 1 +
.../firmware/ibft/ethernet0/secondary-dns | 1 +
.../firmware/ibft/ethernet0/subnet-mask | 1 +
.../sysfs-bad-gateway/firmware/ibft/ethernet0/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../sysfs-bad-gateway/firmware/ibft/target0/index | 1 +
.../firmware/ibft/target0/ip-addr | 1 +
.../sysfs-bad-gateway/firmware/ibft/target0/lun | 1 +
.../sysfs-bad-gateway/firmware/ibft/target0/port | 1 +
.../firmware/ibft/target0/target-name | 1 +
.../tests/sysfs-bad-ipaddr/class/net/eth0/address | 1 +
.../firmware/ibft/ethernet0/gateway | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/ethernet0/index | 1 +
.../firmware/ibft/ethernet0/ip-addr | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/ethernet0/mac | 1 +
.../firmware/ibft/ethernet0/origin | 1 +
.../firmware/ibft/ethernet0/prefix-len | 1 +
.../firmware/ibft/ethernet0/primary-dns | 1 +
.../firmware/ibft/ethernet0/secondary-dns | 1 +
.../firmware/ibft/ethernet0/subnet-mask | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/ethernet0/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/target0/index | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/target0/ip-addr | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/target0/lun | 1 +
.../sysfs-bad-ipaddr/firmware/ibft/target0/port | 1 +
.../firmware/ibft/target0/target-name | 1 +
src/initrd/tests/sysfs-dhcp/class/net/eth0/address | 1 +
src/initrd/tests/sysfs-dhcp/class/net/eth1/address | 1 +
.../sysfs-dhcp/firmware/ibft/ethernet0/gateway | 1 +
.../tests/sysfs-dhcp/firmware/ibft/ethernet0/index | 1 +
.../tests/sysfs-dhcp/firmware/ibft/ethernet0/mac | 1 +
.../sysfs-dhcp/firmware/ibft/ethernet0/origin | 1 +
.../sysfs-dhcp/firmware/ibft/ethernet0/primary-dns | 1 +
.../firmware/ibft/ethernet0/secondary-dns | 1 +
.../tests/sysfs-dhcp/firmware/ibft/ethernet0/vlan | 1 +
.../sysfs-dhcp/firmware/ibft/ethernet1/gateway | 1 +
.../tests/sysfs-dhcp/firmware/ibft/ethernet1/index | 1 +
.../tests/sysfs-dhcp/firmware/ibft/ethernet1/mac | 1 +
.../sysfs-dhcp/firmware/ibft/ethernet1/origin | 1 +
.../sysfs-dhcp/firmware/ibft/ethernet1/primary-dns | 1 +
.../firmware/ibft/ethernet1/secondary-dns | 1 +
.../tests/sysfs-dhcp/firmware/ibft/ethernet1/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target0/index | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target0/ip-addr | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target0/lun | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target0/port | 1 +
.../sysfs-dhcp/firmware/ibft/target0/target-name | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target1/index | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target1/ip-addr | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target1/lun | 1 +
.../tests/sysfs-dhcp/firmware/ibft/target1/port | 1 +
.../sysfs-dhcp/firmware/ibft/target1/target-name | 1 +
.../tests/sysfs-static/class/net/eth0/address | 1 +
.../tests/sysfs-static/class/net/eth1/address | 1 +
.../sysfs-static/firmware/ibft/ethernet0/gateway | 1 +
.../sysfs-static/firmware/ibft/ethernet0/index | 1 +
.../sysfs-static/firmware/ibft/ethernet0/ip-addr | 1 +
.../tests/sysfs-static/firmware/ibft/ethernet0/mac | 1 +
.../sysfs-static/firmware/ibft/ethernet0/origin | 1 +
.../firmware/ibft/ethernet0/prefix-len | 1 +
.../firmware/ibft/ethernet0/primary-dns | 1 +
.../firmware/ibft/ethernet0/secondary-dns | 1 +
.../firmware/ibft/ethernet0/subnet-mask | 1 +
.../sysfs-static/firmware/ibft/ethernet0/vlan | 1 +
.../sysfs-static/firmware/ibft/ethernet1/gateway | 1 +
.../sysfs-static/firmware/ibft/ethernet1/index | 1 +
.../tests/sysfs-static/firmware/ibft/ethernet1/mac | 1 +
.../sysfs-static/firmware/ibft/ethernet1/origin | 1 +
.../firmware/ibft/ethernet1/primary-dns | 1 +
.../firmware/ibft/ethernet1/secondary-dns | 1 +
.../sysfs-static/firmware/ibft/ethernet1/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../tests/sysfs-static/firmware/ibft/target0/index | 1 +
.../sysfs-static/firmware/ibft/target0/ip-addr | 1 +
.../tests/sysfs-static/firmware/ibft/target0/lun | 1 +
.../tests/sysfs-static/firmware/ibft/target0/port | 1 +
.../sysfs-static/firmware/ibft/target0/target-name | 1 +
.../tests/sysfs-static/firmware/ibft/target1/index | 1 +
.../sysfs-static/firmware/ibft/target1/ip-addr | 1 +
.../tests/sysfs-static/firmware/ibft/target1/lun | 1 +
.../tests/sysfs-static/firmware/ibft/target1/port | 1 +
.../sysfs-static/firmware/ibft/target1/target-name | 1 +
src/initrd/tests/sysfs-vlan/class/net/eth0/address | 1 +
.../tests/sysfs-vlan/firmware/ibft/ethernet0/index | 1 +
.../sysfs-vlan/firmware/ibft/ethernet0/ip-addr | 1 +
.../tests/sysfs-vlan/firmware/ibft/ethernet0/mac | 1 +
.../sysfs-vlan/firmware/ibft/ethernet0/origin | 1 +
.../sysfs-vlan/firmware/ibft/ethernet0/prefix-len | 1 +
.../sysfs-vlan/firmware/ibft/ethernet0/subnet-mask | 1 +
.../tests/sysfs-vlan/firmware/ibft/ethernet0/vlan | 1 +
.../firmware/ibft/initiator/initiator-name | 1 +
.../tests/sysfs-vlan/firmware/ibft/target0/index | 1 +
.../tests/sysfs-vlan/firmware/ibft/target0/ip-addr | 1 +
.../tests/sysfs-vlan/firmware/ibft/target0/lun | 1 +
.../tests/sysfs-vlan/firmware/ibft/target0/port | 1 +
.../sysfs-vlan/firmware/ibft/target0/target-name | 1 +
src/initrd/tests/sysfs/class/net/eth0/address | 1 +
src/initrd/tests/sysfs/class/net/eth2/address | 1 +
.../tests/sysfs/firmware/ibft/acpi_header/oem_id | 1 +
.../sysfs/firmware/ibft/acpi_header/oem_table_id | 1 +
.../sysfs/firmware/ibft/acpi_header/signature | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/dhcp | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/flags | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/gateway | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/hostname | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/index | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/ip-addr | 1 +
src/initrd/tests/sysfs/firmware/ibft/ethernet0/mac | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/origin | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/prefix-len | 1 +
.../sysfs/firmware/ibft/ethernet0/primary-dns | 1 +
.../sysfs/firmware/ibft/ethernet0/secondary-dns | 1 +
.../sysfs/firmware/ibft/ethernet0/subnet-mask | 1 +
.../tests/sysfs/firmware/ibft/ethernet0/vlan | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/dhcp | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/flags | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/gateway | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/hostname | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/index | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/ip-addr | 1 +
src/initrd/tests/sysfs/firmware/ibft/ethernet2/mac | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/origin | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/prefix-len | 1 +
.../sysfs/firmware/ibft/ethernet2/primary-dns | 1 +
.../sysfs/firmware/ibft/ethernet2/secondary-dns | 1 +
.../sysfs/firmware/ibft/ethernet2/subnet-mask | 1 +
.../tests/sysfs/firmware/ibft/ethernet2/vlan | 1 +
.../tests/sysfs/firmware/ibft/initiator/flags | 1 +
.../tests/sysfs/firmware/ibft/initiator/index | 1 +
.../sysfs/firmware/ibft/initiator/initiator-name | 1 +
.../sysfs/firmware/ibft/initiator/isns-server | 1 +
.../firmware/ibft/initiator/pri-radius-server | 1 +
.../firmware/ibft/initiator/sec-radius-server | 1 +
.../tests/sysfs/firmware/ibft/initiator/slp-server | 1 +
.../tests/sysfs/firmware/ibft/target0/chap-type | 1 +
src/initrd/tests/sysfs/firmware/ibft/target0/flags | 1 +
src/initrd/tests/sysfs/firmware/ibft/target0/index | 1 +
.../tests/sysfs/firmware/ibft/target0/ip-addr | 1 +
src/initrd/tests/sysfs/firmware/ibft/target0/lun | 1 +
.../tests/sysfs/firmware/ibft/target0/nic-assoc | 1 +
src/initrd/tests/sysfs/firmware/ibft/target0/port | 1 +
.../tests/sysfs/firmware/ibft/target2/chap-type | 1 +
src/initrd/tests/sysfs/firmware/ibft/target2/flags | 1 +
src/initrd/tests/sysfs/firmware/ibft/target2/index | 1 +
.../tests/sysfs/firmware/ibft/target2/ip-addr | 1 +
src/initrd/tests/sysfs/firmware/ibft/target2/lun | 1 +
.../tests/sysfs/firmware/ibft/target2/nic-assoc | 1 +
src/initrd/tests/sysfs/firmware/ibft/target2/port | 1 +
.../tests/sysfs/firmware/ibft/target2/target-name | 1 +
src/initrd/tests/test-ibft-reader.c | 286 +++++++++++++
198 files changed, 1231 insertions(+)

Upstream: cgit.freedesktop.org


  • Share