blob: 882b755f8e1d1600542de327693b822280d15939 [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
20BMC_IP_ADDR ??= "169.254.95.118/16"
21BMC_USB_ECM_PRODUCT_ID ??= ""
22BMC_USB_ECM_PRODUCT_NAME ??= "${MACHINE} BMC"
23BMC_USB_ECM_HOST_MAC ??= "invalid"
24BMC_USB_ECM_DEV_MAC ??= "invalid"
25BMC_USB_ECM_BIND_DEV ??= ""
26BMC_USB_CONFIG_PRIORITY ??= ""
27BMC_USB_CONFIG_FILENAME ??= "${BMC_USB_CONFIG_PRIORITY}-bmc-usb0.network"
William A. Kennington IIIf8a77742022-02-28 18:05:54 -080028BMC_USB_TYPE ??= "eem"
Maksym Sloyko96342732021-08-03 21:54:28 +000029
30SRC_URI += "file://00-bmc-usb0.network.m4"
31SRC_URI += "file://usb_network.service.m4"
32SRC_URI += "file://usb_network.sh"
33
Willy Tu4dd03ca2021-08-06 09:37:35 -070034FILES:${PN} = "${bindir}/usb_network.sh"
35FILES:${PN}:append = " ${systemd_unitdir}/network/${BMC_USB_CONFIG_FILENAME}"
Maksym Sloyko96342732021-08-03 21:54:28 +000036
37do_compile() {
38 test "X${BMC_IP_ADDR}" != "X" || bberror "Please define BMC_IP_ADDR"
39 m4 -DM_BMC_IP_ADDR=${BMC_IP_ADDR} ${WORKDIR}/00-bmc-usb0.network.m4 > ${S}/00-bmc-usb0.network
40
41 test "X${BMC_USB_ECM_PRODUCT_ID}" != "X" || bberror "Please define BMC_USB_ECM_PRODUCT_ID"
42 test "X${BMC_USB_ECM_PRODUCT_NAME}" != "X" || bberror "Please define BMC_USB_ECM_PRODUCT_NAME"
43 test "X${BMC_USB_ECM_BIND_DEV}" != "X" || bberror "Please define BMC_USB_ECM_BIND_DEV"
44
45 m4 \
William A. Kennington IIIc65bda52022-02-22 15:25:45 -080046 -DM_BMC_USB_PRODUCT_ID="${BMC_USB_ECM_PRODUCT_ID}" \
47 -DM_BMC_USB_PRODUCT_NAME="${BMC_USB_ECM_PRODUCT_NAME}" \
William A. Kennington IIIf8a77742022-02-28 18:05:54 -080048 -DM_BMC_USB_TYPE="${BMC_USB_TYPE}" \
William A. Kennington IIIc65bda52022-02-22 15:25:45 -080049 -DM_BMC_USB_HOST_MAC="${BMC_USB_ECM_HOST_MAC}" \
50 -DM_BMC_USB_DEV_MAC="${BMC_USB_ECM_DEV_MAC}" \
51 -DM_BMC_USB_BIND_DEV="${BMC_USB_ECM_BIND_DEV}" \
Maksym Sloyko96342732021-08-03 21:54:28 +000052 -DM_SCRIPT_INSTALL_DIR="${bindir}" \
53 ${WORKDIR}/usb_network.service.m4 > ${S}/usb_network.service
54}
55
56do_install() {
57 install -d ${D}/${bindir}
58 install -m 0755 ${WORKDIR}/usb_network.sh ${D}/${bindir}
59
60 install -d ${D}${systemd_system_unitdir}
61 install -m 0644 ${S}/usb_network.service ${D}${systemd_system_unitdir}
62
63 install -d ${D}${systemd_unitdir}/network
64 install -m 0644 ${S}/00-bmc-usb0.network \
65 ${D}${systemd_unitdir}/network/${BMC_USB_CONFIG_FILENAME}
66}