blob: 083cb2e0a71944061cb8f4fad4d3e231a26dc6ef [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
17SYSTEMD_PACKAGES = "${PN}"
Willy Tu4dd03ca2021-08-06 09:37:35 -070018SYSTEMD_SERVICE:${PN} = "usb_network.service"
Maksym Sloyko96342732021-08-03 21:54:28 +000019
Maksym Sloyko96342732021-08-03 21:54:28 +000020BMC_USB_ECM_PRODUCT_ID ??= ""
21BMC_USB_ECM_PRODUCT_NAME ??= "${MACHINE} BMC"
22BMC_USB_ECM_HOST_MAC ??= "invalid"
23BMC_USB_ECM_DEV_MAC ??= "invalid"
24BMC_USB_ECM_BIND_DEV ??= ""
William A. Kennington IIIf8a77742022-02-28 18:05:54 -080025BMC_USB_TYPE ??= "eem"
William A. Kennington IIIa68422b2022-04-04 17:54:01 -070026BMC_USB_IFACE ??= "gusb0"
Maksym Sloyko96342732021-08-03 21:54:28 +000027
Maksym Sloyko96342732021-08-03 21:54:28 +000028SRC_URI += "file://usb_network.service.m4"
29SRC_URI += "file://usb_network.sh"
30
Maksym Sloyko96342732021-08-03 21:54:28 +000031do_compile() {
Maksym Sloyko96342732021-08-03 21:54:28 +000032 test "X${BMC_USB_ECM_PRODUCT_ID}" != "X" || bberror "Please define BMC_USB_ECM_PRODUCT_ID"
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 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}" \
45 ${WORKDIR}/usb_network.service.m4 > ${S}/usb_network.service
46}
47
48do_install() {
49 install -d ${D}/${bindir}
50 install -m 0755 ${WORKDIR}/usb_network.sh ${D}/${bindir}
51
52 install -d ${D}${systemd_system_unitdir}
53 install -m 0644 ${S}/usb_network.service ${D}${systemd_system_unitdir}
Maksym Sloyko96342732021-08-03 21:54:28 +000054}