diff options
Diffstat (limited to 'meta-ampere/meta-common/recipes-phosphor')
6 files changed, 86 insertions, 21 deletions
diff --git a/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh index af3e2bead..cc39f30fc 100755 --- a/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh +++ b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh @@ -21,31 +21,29 @@ usage () { echo "Usage:" - echo " $(basename $0) <image path> " + echo " $(basename "$0") <image path> " echo "Where:" echo " <image path>: the path link to folder, which include image file and MANIFEST" echo "Example:" - echo " $(basename $0) /tmp/images/ghdh1393" + echo " $(basename "$0") /tmp/images/ghdh1393" } IMG_PATH="$1" -if [ ! -d $IMG_PATH ]; then - echo $IMG_PATH +if [ ! -d "$IMG_PATH" ]; then echo "The folder $IMG_PATH does not exist" usage exit 1 fi MANIFEST_PATH="${IMG_PATH}/MANIFEST" -if [ ! -f $MANIFEST_PATH ]; then - echo $MANIFEST_PATH +if [ ! -f "$MANIFEST_PATH" ]; then echo "The MANIFEST file $MANIFEST_PATH does not exist" usage exit 1 fi -EXTENDED_VERSION=$(awk '/ExtendedVersion/ {print}' ${MANIFEST_PATH} | cut -d "=" -f 2) +EXTENDED_VERSION=$(awk '/ExtendedVersion/ {print}' "${MANIFEST_PATH}" | cut -d "=" -f 2) # If the ExtendedVersion is empty, set default to update UEFI/EDKII on primary device if [ -z "$EXTENDED_VERSION" ] @@ -56,28 +54,28 @@ fi # Assign the command based on the ExtendedVersion case ${EXTENDED_VERSION} in "primary") - export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \)) - export CMD='/usr/sbin/ampere_flash_bios.sh $IMAGE 1' + IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \)) + CMD="/usr/sbin/ampere_flash_bios.sh $IMAGE 1" ;; "secondary") - export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \)) - export CMD='/usr/sbin/ampere_flash_bios.sh $IMAGE 2' + IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \)) + CMD="/usr/sbin/ampere_flash_bios.sh $IMAGE 2" ;; "scp-primary") - export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \)) - export CMD='/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 1' + IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \)) + CMD="/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 1" ;; "scp-secondary") - export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \)) - export CMD='/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 2' + IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \)) + CMD="/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 2" ;; "fru") - export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.bin" \)) - export CMD='/usr/sbin/ampere_firmware_upgrade.sh fru $IMAGE' + IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.bin" \)) + CMD="/usr/sbin/ampere_firmware_upgrade.sh fru $IMAGE" ;; *) @@ -91,11 +89,10 @@ if [ -z "$IMAGE" ] then echo "ERROR: The image file: No such file or directory" exit 1 -else - eval $CMD fi -if [[ $? -ne 0 ]]; then +if ! eval "$CMD"; +then echo "ERROR: The firmware update not successfull" exit 1 fi diff --git a/meta-ampere/meta-common/recipes-phosphor/ipmi/ampere-ipmi-oem.bb b/meta-ampere/meta-common/recipes-phosphor/ipmi/ampere-ipmi-oem.bb index e0a6819b6..68852b4ae 100644 --- a/meta-ampere/meta-common/recipes-phosphor/ipmi/ampere-ipmi-oem.bb +++ b/meta-ampere/meta-common/recipes-phosphor/ipmi/ampere-ipmi-oem.bb @@ -16,7 +16,7 @@ LIBRARY_NAMES = "libzampoemcmds.so" S = "${WORKDIR}/git" SRC_URI = "git://github.com/openbmc/ampere-ipmi-oem.git" -SRCREV = "1463f7013a17699081c1fbf506ee8d57827d1088" +SRCREV = "4c556399c7161d3742cad978fd64e8ad0fd0aa0a" HOSTIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}" NETIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}" diff --git a/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet.bb b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet.bb new file mode 100644 index 000000000..d1dff35ec --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet.bb @@ -0,0 +1,28 @@ +SUMMARY = "Enable USB ethernet" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +DEPENDS += "systemd" +RDEPENDS:${PN} += "libsystemd bash" + +inherit allarch systemd + +SRC_URI += "file://ampere-usbnet.service \ + file://ampere_usbnet.sh \ + file://00-bmc-usb0.network" + +do_install() { + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/ampere-usbnet.service ${D}${systemd_unitdir}/system + + install -d ${D}${sysconfdir_native}/systemd/network/ + install -m 0644 ${WORKDIR}/00-bmc-usb0.network ${D}${sysconfdir_native}/systemd/network + + install -d ${D}/${sbindir} + install -m 755 ${WORKDIR}/ampere_usbnet.sh ${D}/${sbindir} +} + +NATIVE_SYSTEMD_SUPPORT = "1" +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "ampere-usbnet.service" diff --git a/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/00-bmc-usb0.network b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/00-bmc-usb0.network new file mode 100644 index 000000000..640fe04b9 --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/00-bmc-usb0.network @@ -0,0 +1,7 @@ +[Match] +Name=usb0 +[Address] +Address=192.168.0.10/16 +[Network] +LinkLocalAddressing=no +IPv6AcceptRA=no diff --git a/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/ampere-usbnet.service b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/ampere-usbnet.service new file mode 100644 index 000000000..349954325 --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/ampere-usbnet.service @@ -0,0 +1,12 @@ +[Unit] +Description=Ampere Ethernet over USB gadget device +After=phosphor-ipmi-host.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/ampere_usbnet.sh +ExecStop=/usr/bin/usb-ctrl ecm usbnet off + +[Install] +WantedBy=multi-user.target diff --git a/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/ampere_usbnet.sh b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/ampere_usbnet.sh new file mode 100644 index 000000000..fd2dce610 --- /dev/null +++ b/meta-ampere/meta-common/recipes-phosphor/network/ampere-usbnet/ampere_usbnet.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +ENV_MAC_ADDR=$(fw_printenv eth1addr) +if [ -z "$ENV_MAC_ADDR" ]; then + ENV_MAC_ADDR=$(fw_printenv ethaddr) +fi + +MAC_ADDR=$(echo "$ENV_MAC_ADDR" | cut -d "=" -f 2) + +if [ -n "$MAC_ADDR" ]; then + # Generate MAC Address from eth1addr using locally administered MAC + # https://en.wikipedia.org/wiki/MAC_address#Universal_vs._local_(U/L_bit + SUBMAC=$(echo "$MAC_ADDR" | cut -d ":" -f 2-6) + /usr/bin/usb-ctrl ecm usbnet on "06:$SUBMAC" "02:$SUBMAC" +else + /usr/bin/usb-ctrl ecm usbnet on +fi + +# Use NCM (Ethernet) Gadget instead of FunctionFS Gadget +echo 0x0103 > /sys/kernel/config/usb_gadget/usbnet/idProduct +echo "OpenBMC usbnet Device" > /sys/kernel/config/usb_gadget/usbnet/strings/0x409/product |