William A. Kennington III | c65bda5 | 2022-02-22 15:25:45 -0800 | [diff] [blame] | 1 | SUMMARY = "Google USB EEM Gadget Configuration Script" |
| 2 | DESCRIPTION = "Google USB EEM Gadget Configuration Script" |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 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 | |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 17 | BMC_USB_ECM_PRODUCT_ID ??= "" |
| 18 | BMC_USB_ECM_PRODUCT_NAME ??= "${MACHINE} BMC" |
| 19 | BMC_USB_ECM_HOST_MAC ??= "invalid" |
| 20 | BMC_USB_ECM_DEV_MAC ??= "invalid" |
| 21 | BMC_USB_ECM_BIND_DEV ??= "" |
William A. Kennington III | f8a7774 | 2022-02-28 18:05:54 -0800 | [diff] [blame] | 22 | BMC_USB_TYPE ??= "eem" |
William A. Kennington III | a68422b | 2022-04-04 17:54:01 -0700 | [diff] [blame] | 23 | BMC_USB_IFACE ??= "gusb0" |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 24 | |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 25 | SRC_URI += "file://usb_network.service.m4" |
| 26 | SRC_URI += "file://usb_network.sh" |
| 27 | |
William A. Kennington III | 5f13d39 | 2022-04-26 02:14:17 -0700 | [diff] [blame] | 28 | SYSTEMD_PACKAGES = "${PN}" |
William A. Kennington III | d10de96 | 2022-04-26 12:50:22 -0700 | [diff] [blame] | 29 | SYSTEMD_SERVICE:${PN} = "${@'usb_network.service' if d.getVar('BMC_USB_ECM_PRODUCT_ID') else ''}" |
William A. Kennington III | 5f13d39 | 2022-04-26 02:14:17 -0700 | [diff] [blame] | 30 | |
William A. Kennington III | f8cb53a | 2022-03-25 13:21:35 -0700 | [diff] [blame] | 31 | do_compile:append() { |
William A. Kennington III | 5f13d39 | 2022-04-26 02:14:17 -0700 | [diff] [blame] | 32 | if [ -n "${BMC_USB_ECM_PRODUCT_ID}" ]; then |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 33 | test "X${BMC_USB_ECM_PRODUCT_NAME}" != "X" || bberror "Please define BMC_USB_ECM_PRODUCT_NAME" |
| 34 | test "X${BMC_USB_ECM_BIND_DEV}" != "X" || bberror "Please define BMC_USB_ECM_BIND_DEV" |
| 35 | |
| 36 | m4 \ |
William A. Kennington III | c65bda5 | 2022-02-22 15:25:45 -0800 | [diff] [blame] | 37 | -DM_BMC_USB_PRODUCT_ID="${BMC_USB_ECM_PRODUCT_ID}" \ |
| 38 | -DM_BMC_USB_PRODUCT_NAME="${BMC_USB_ECM_PRODUCT_NAME}" \ |
William A. Kennington III | f8a7774 | 2022-02-28 18:05:54 -0800 | [diff] [blame] | 39 | -DM_BMC_USB_TYPE="${BMC_USB_TYPE}" \ |
William A. Kennington III | c65bda5 | 2022-02-22 15:25:45 -0800 | [diff] [blame] | 40 | -DM_BMC_USB_HOST_MAC="${BMC_USB_ECM_HOST_MAC}" \ |
| 41 | -DM_BMC_USB_DEV_MAC="${BMC_USB_ECM_DEV_MAC}" \ |
William A. Kennington III | a68422b | 2022-04-04 17:54:01 -0700 | [diff] [blame] | 42 | -DM_BMC_USB_IFACE="${BMC_USB_IFACE}" \ |
William A. Kennington III | c65bda5 | 2022-02-22 15:25:45 -0800 | [diff] [blame] | 43 | -DM_BMC_USB_BIND_DEV="${BMC_USB_ECM_BIND_DEV}" \ |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 44 | -DM_SCRIPT_INSTALL_DIR="${bindir}" \ |
William A. Kennington III | f8cb53a | 2022-03-25 13:21:35 -0700 | [diff] [blame] | 45 | ${WORKDIR}/usb_network.service.m4 > ${WORKDIR}/usb_network.service |
William A. Kennington III | 5f13d39 | 2022-04-26 02:14:17 -0700 | [diff] [blame] | 46 | fi |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 47 | } |
| 48 | |
William A. Kennington III | f8cb53a | 2022-03-25 13:21:35 -0700 | [diff] [blame] | 49 | do_install:append() { |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 50 | install -d ${D}/${bindir} |
| 51 | install -m 0755 ${WORKDIR}/usb_network.sh ${D}/${bindir} |
| 52 | |
William A. Kennington III | 5f13d39 | 2022-04-26 02:14:17 -0700 | [diff] [blame] | 53 | if [ -n "${BMC_USB_ECM_PRODUCT_ID}" ]; then |
| 54 | install -d ${D}${systemd_system_unitdir} |
| 55 | install -m 0644 ${WORKDIR}/usb_network.service ${D}${systemd_system_unitdir} |
| 56 | fi |
Maksym Sloyko | 9634273 | 2021-08-03 21:54:28 +0000 | [diff] [blame] | 57 | } |