forked from openbmc/openbmc
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meta-ampere: flash: Update method to turn on the host
While BMC is in firmware updating phase, the BMC's state is UpdateInProgress, BMC rejects all turn on host requests during this time if users enabled "only-allow-boot-when-bmc-ready" option build. This commit updates the method to turn on the host after flashing done. When flashing done, BMC does not directly request to turn on the host, it request to start [email protected] instead. This service shall check BMC's state then request to turn on the host. B/c this service's "Type" is simple, it does not block firmware updating action. Tested: 1. Turn on the Host then request to flashing new firmware. 2. Wait until flashing done, check the Host's state. $busctl get-property xyz.openbmc_project.State.Host0 /xyz/openbmc_project/state/host0 \ xyz.openbmc_project.State.Host CurrentHostState 3. The Host's state is "Running" Signed-off-by: Thang Tran <[email protected]>
- Loading branch information
1 parent
9fa1792
commit 5d24c0f
Showing
9 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...on/recipes-phosphor/flash/phosphor-software-manager/[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Unit] | ||
Description=Ampere service to turn on the host after flashing | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/sbin/turn_on_host_after_flash.sh %i |
32 changes: 32 additions & 0 deletions
32
.../meta-common/recipes-phosphor/flash/phosphor-software-manager/turn_on_host_after_flash.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to turn on the Host after flashing. | ||
# It has to wait for BMC's state enter to "Ready" status | ||
# due to current BMC's state is "UpdateInProgress", therefore | ||
# we can not request to turn on the Host immediately. | ||
|
||
time_out=30 | ||
|
||
if [ "$#" -gt 0 ] | ||
then | ||
time_out=$1 | ||
fi | ||
|
||
for i in $(seq 1 "$time_out") | ||
do | ||
bmc_state=$(busctl get-property xyz.openbmc_project.State.BMC \ | ||
/xyz/openbmc_project/state/bmc0 xyz.openbmc_project.State.BMC \ | ||
CurrentBMCState | cut -d " " -f 2) | ||
|
||
if [[ "${bmc_state}" == *".Ready"* ]] | ||
then | ||
temp_val=$(busctl set-property xyz.openbmc_project.State.Host0 \ | ||
/xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \ | ||
RequestedHostTransition s xyz.openbmc_project.State.Host.Transition.On) | ||
break | ||
fi | ||
|
||
sleep 1s | ||
done | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,24 +2,31 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" | |
|
||
SRC_URI += " \ | ||
file://firmware_update.sh \ | ||
file://turn_on_host_after_flash.sh \ | ||
file://allow-reboot-actions.service \ | ||
file://prevent-reboot-actions.service \ | ||
file://[email protected] \ | ||
file://0001-BMC-Updater-Support-update-on-BMC-Alternate-device.patch \ | ||
" | ||
|
||
PACKAGECONFIG:append = " flash_bios static-dual-image" | ||
|
||
SYSTEMD_SERVICE:${PN}:updater += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', 'allow-reboot-actions.service', '', d)}" | ||
SYSTEMD_SERVICE:${PN}:updater += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', 'prevent-reboot-actions.service', '', d)}" | ||
SYSTEMD_SERVICE:${PN}:updater += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', '[email protected]', '', d)}" | ||
|
||
FILES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', '${systemd_unitdir}/system/allow-reboot-actions.service', '', d)}" | ||
FILES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', '${systemd_unitdir}/system/prevent-reboot-actions.service', '', d)}" | ||
FILES:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'flash_bios', '${systemd_unitdir}/system/[email protected]', '', d)}" | ||
|
||
RDEPENDS:${PN} += "bash" | ||
|
||
do_install:append() { | ||
install -d ${D}/usr/sbin | ||
install -m 0755 ${WORKDIR}/firmware_update.sh ${D}/usr/sbin/firmware_update.sh | ||
install -m 0755 ${WORKDIR}/turn_on_host_after_flash.sh ${D}/usr/sbin/turn_on_host_after_flash.sh | ||
|
||
install -m 0644 ${WORKDIR}/allow-reboot-actions.service ${D}${systemd_unitdir}/system/allow-reboot-actions.service | ||
install -m 0644 ${WORKDIR}/prevent-reboot-actions.service ${D}${systemd_unitdir}/system/prevent-reboot-actions.service | ||
install -m 0644 ${WORKDIR}/turn-on-the-host-after-flash@.service ${D}${systemd_unitdir}/system/turn-on-the-host-after-flash@.service | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters