blob: bf77187c19a58fa153a40377071e771eb806140d [file] [log] [blame]
William A. Kennington IIIc65bda52022-02-22 15:25:45 -08001SUMMARY = "Google USB EEM Gadget Configuration Script"
2DESCRIPTION = "Google USB EEM Gadget Configuration Script"
Maksym Sloyko96342732021-08-03 21:54:28 +00003PR = "r1"
4PV = "0.2"
5
6LICENSE = "Apache-2.0"
7LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
8
Willy Tu4dd03ca2021-08-06 09:37:35 -07009FILESEXTRAPATHS:prepend = "${THISDIR}/${PN}:"
Maksym Sloyko96342732021-08-03 21:54:28 +000010
11inherit systemd
12
13DEPENDS += "m4-native"
14DEPENDS += "systemd"
Willy Tu4dd03ca2021-08-06 09:37:35 -070015RDEPENDS:${PN} += "bash"
Maksym Sloyko96342732021-08-03 21:54:28 +000016
Maksym Sloyko96342732021-08-03 21:54:28 +000017BMC_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 ??= ""
William A. Kennington IIIf8a77742022-02-28 18:05:54 -080022BMC_USB_TYPE ??= "eem"
William A. Kennington IIIa68422b2022-04-04 17:54:01 -070023BMC_USB_IFACE ??= "gusb0"
Maksym Sloyko96342732021-08-03 21:54:28 +000024
Maksym Sloyko96342732021-08-03 21:54:28 +000025SRC_URI += "file://usb_network.service.m4"
26SRC_URI += "file://usb_network.sh"
27
William A. Kennington III5f13d392022-04-26 02:14:17 -070028SYSTEMD_PACKAGES = "${PN}"
William A. Kennington IIId10de962022-04-26 12:50:22 -070029SYSTEMD_SERVICE:${PN} = "${@'usb_network.service' if d.getVar('BMC_USB_ECM_PRODUCT_ID') else ''}"
William A. Kennington III5f13d392022-04-26 02:14:17 -070030
William A. Kennington IIIf8cb53a2022-03-25 13:21:35 -070031do_compile:append() {
William A. Kennington III5f13d392022-04-26 02:14:17 -070032 if [ -n "${BMC_USB_ECM_PRODUCT_ID}" ]; then
Maksym Sloyko96342732021-08-03 21:54:28 +000033 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 IIIc65bda52022-02-22 15:25:45 -080037 -DM_BMC_USB_PRODUCT_ID="${BMC_USB_ECM_PRODUCT_ID}" \
38 -DM_BMC_USB_PRODUCT_NAME="${BMC_USB_ECM_PRODUCT_NAME}" \
William A. Kennington IIIf8a77742022-02-28 18:05:54 -080039 -DM_BMC_USB_TYPE="${BMC_USB_TYPE}" \
William A. Kennington IIIc65bda52022-02-22 15:25:45 -080040 -DM_BMC_USB_HOST_MAC="${BMC_USB_ECM_HOST_MAC}" \
41 -DM_BMC_USB_DEV_MAC="${BMC_USB_ECM_DEV_MAC}" \
William A. Kennington IIIa68422b2022-04-04 17:54:01 -070042 -DM_BMC_USB_IFACE="${BMC_USB_IFACE}" \
William A. Kennington IIIc65bda52022-02-22 15:25:45 -080043 -DM_BMC_USB_BIND_DEV="${BMC_USB_ECM_BIND_DEV}" \
Maksym Sloyko96342732021-08-03 21:54:28 +000044 -DM_SCRIPT_INSTALL_DIR="${bindir}" \
William A. Kennington IIIf8cb53a2022-03-25 13:21:35 -070045 ${WORKDIR}/usb_network.service.m4 > ${WORKDIR}/usb_network.service
William A. Kennington III5f13d392022-04-26 02:14:17 -070046 fi
Maksym Sloyko96342732021-08-03 21:54:28 +000047}
48
William A. Kennington IIIf8cb53a2022-03-25 13:21:35 -070049do_install:append() {
Maksym Sloyko96342732021-08-03 21:54:28 +000050 install -d ${D}/${bindir}
51 install -m 0755 ${WORKDIR}/usb_network.sh ${D}/${bindir}
52
William A. Kennington III5f13d392022-04-26 02:14:17 -070053 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 Sloyko96342732021-08-03 21:54:28 +000057}