Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 1 | SUMMARY = "Google USB ECM Gadget Configuration Script" |
| 2 | DESCRIPTION = "Google USB ECM Gadget Configuration Script" |
| 3 | PR = "r1" |
| 4 | PV = "0.2" |
| 5 | |
| 6 | LICENSE = "Apache-2.0" |
| 7 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 8 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 9 | FILESEXTRAPATHS:prepend = "${THISDIR}/${PN}:" |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 10 | |
| 11 | inherit systemd |
| 12 | |
| 13 | DEPENDS += "m4-native" |
| 14 | DEPENDS += "systemd" |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 15 | RDEPENDS:${PN} += "bash" |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 16 | |
| 17 | SYSTEMD_PACKAGES = "${PN}" |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 18 | SYSTEMD_SERVICE:${PN} = "usb_network.service" |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 19 | |
| 20 | BMC_IP_ADDR ??= "169.254.95.118/16" |
| 21 | BMC_USB_ECM_PRODUCT_ID ??= "" |
| 22 | BMC_USB_ECM_PRODUCT_NAME ??= "${MACHINE} BMC" |
| 23 | BMC_USB_ECM_HOST_MAC ??= "invalid" |
| 24 | BMC_USB_ECM_DEV_MAC ??= "invalid" |
| 25 | BMC_USB_ECM_BIND_DEV ??= "" |
| 26 | BMC_USB_CONFIG_PRIORITY ??= "" |
| 27 | BMC_USB_CONFIG_FILENAME ??= "${BMC_USB_CONFIG_PRIORITY}-bmc-usb0.network" |
| 28 | |
| 29 | SRC_URI += "file://00-bmc-usb0.network.m4" |
| 30 | SRC_URI += "file://usb_network.service.m4" |
| 31 | SRC_URI += "file://usb_network.sh" |
| 32 | |
Willy Tu | 4dd03ca | 2021-08-06 09:37:35 -0700 | [diff] [blame] | 33 | FILES:${PN} = "${bindir}/usb_network.sh" |
| 34 | FILES:${PN}:append = " ${systemd_unitdir}/network/${BMC_USB_CONFIG_FILENAME}" |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 35 | |
| 36 | do_compile() { |
| 37 | test "X${BMC_IP_ADDR}" != "X" || bberror "Please define BMC_IP_ADDR" |
| 38 | m4 -DM_BMC_IP_ADDR=${BMC_IP_ADDR} ${WORKDIR}/00-bmc-usb0.network.m4 > ${S}/00-bmc-usb0.network |
| 39 | |
| 40 | test "X${BMC_USB_ECM_PRODUCT_ID}" != "X" || bberror "Please define BMC_USB_ECM_PRODUCT_ID" |
| 41 | test "X${BMC_USB_ECM_PRODUCT_NAME}" != "X" || bberror "Please define BMC_USB_ECM_PRODUCT_NAME" |
| 42 | test "X${BMC_USB_ECM_BIND_DEV}" != "X" || bberror "Please define BMC_USB_ECM_BIND_DEV" |
| 43 | |
| 44 | m4 \ |
| 45 | -DM_BMC_USB_ECM_PRODUCT_ID="${BMC_USB_ECM_PRODUCT_ID}" \ |
| 46 | -DM_BMC_USB_ECM_PRODUCT_NAME="${BMC_USB_ECM_PRODUCT_NAME}" \ |
| 47 | -DM_BMC_USB_ECM_HOST_MAC="${BMC_USB_ECM_HOST_MAC}" \ |
| 48 | -DM_BMC_USB_ECM_DEV_MAC="${BMC_USB_ECM_DEV_MAC}" \ |
| 49 | -DM_BMC_USB_ECM_BIND_DEV="${BMC_USB_ECM_BIND_DEV}" \ |
| 50 | -DM_SCRIPT_INSTALL_DIR="${bindir}" \ |
| 51 | ${WORKDIR}/usb_network.service.m4 > ${S}/usb_network.service |
| 52 | } |
| 53 | |
| 54 | do_install() { |
| 55 | install -d ${D}/${bindir} |
| 56 | install -m 0755 ${WORKDIR}/usb_network.sh ${D}/${bindir} |
| 57 | |
| 58 | install -d ${D}${systemd_system_unitdir} |
| 59 | install -m 0644 ${S}/usb_network.service ${D}${systemd_system_unitdir} |
| 60 | |
| 61 | install -d ${D}${systemd_unitdir}/network |
| 62 | install -m 0644 ${S}/00-bmc-usb0.network \ |
| 63 | ${D}${systemd_unitdir}/network/${BMC_USB_CONFIG_FILENAME} |
| 64 | } |