1SUMMARY = "Google USB EEM Gadget Configuration Script"
2DESCRIPTION = "Google USB EEM Gadget Configuration Script"
3PR = "r1"
4PV = "0.2"
5
6LICENSE = "Apache-2.0"
7LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
8
9FILESEXTRAPATHS:prepend = "${THISDIR}/${PN}:"
10
11inherit systemd
12
13DEPENDS += "m4-native"
14DEPENDS += "systemd"
15RDEPENDS:${PN} += "bash"
16
17BMC_USB_ECM_PRODUCT_ID ??= ""
18BMC_USB_ECM_PRODUCT_NAME ??= "${MACHINE} BMC"
19BMC_USB_ECM_HOST_MAC ??= "invalid"
20BMC_USB_ECM_DEV_MAC ??= "invalid"
21BMC_USB_ECM_BIND_DEV ??= ""
22BMC_USB_TYPE ??= "eem"
23BMC_USB_IFACE ??= "gusb0"
24
25SRC_URI += "file://usb_network.service.m4"
26SRC_URI += "file://usb_network.sh"
27
28SYSTEMD_PACKAGES = "${PN}"
29SYSTEMD_SERVICE:${PN} = "${@'usb_network.service' if d.getVar('BMC_USB_ECM_PRODUCT_ID') else ''}"
30
31do_compile:append() {
32  if [ -n "${BMC_USB_ECM_PRODUCT_ID}" ]; then
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 \
37        -DM_BMC_USB_PRODUCT_ID="${BMC_USB_ECM_PRODUCT_ID}" \
38        -DM_BMC_USB_PRODUCT_NAME="${BMC_USB_ECM_PRODUCT_NAME}" \
39        -DM_BMC_USB_TYPE="${BMC_USB_TYPE}" \
40        -DM_BMC_USB_HOST_MAC="${BMC_USB_ECM_HOST_MAC}" \
41        -DM_BMC_USB_DEV_MAC="${BMC_USB_ECM_DEV_MAC}" \
42        -DM_BMC_USB_IFACE="${BMC_USB_IFACE}" \
43        -DM_BMC_USB_BIND_DEV="${BMC_USB_ECM_BIND_DEV}" \
44        -DM_SCRIPT_INSTALL_DIR="${bindir}" \
45        ${UNPACKDIR}/usb_network.service.m4 > ${UNPACKDIR}/usb_network.service
46  fi
47}
48
49do_install:append() {
50  install -d ${D}/${bindir}
51  install -m 0755 ${UNPACKDIR}/usb_network.sh ${D}/${bindir}
52
53  if [ -n "${BMC_USB_ECM_PRODUCT_ID}" ]; then
54    install -d ${D}${systemd_system_unitdir}
55    install -m 0644 ${UNPACKDIR}/usb_network.service ${D}${systemd_system_unitdir}
56  fi
57}
58