-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[initramfs]: SSD firmware upgrade in initramfs (#10748)
Why I did it To upgrade SSD firmware in initramfs while rebooting from SONiC to SONiC and during NOS to SONiC migration. How I did it New option 'ssd-upgrader-part’ is introduced in grub command line, to indicate the partition and its filesystem type in which the SSD firmware updater is present. ‘ssd-upgrader-part’ syntax is ssd-upgrader-part=<partition>,<filesystem type>. Example: ssd-upgrader-part=/dev/sda8,ext4 A new initramfs script ‘ssd-upgrade’ is included in init-premount and it invokes the SSD firmware updater (ssd-fw-upgrade) present in the partition indicated by the boot option 'ssd-upgrader-part' How to verify it In SONiC, the SSD firmware updater is copied to “/host/” directory. Fast-reboot is to be initiated with the ‘-u’ option ([scripts/fast-reboot] Add option to include ssd-upgrader-part boot option with SONiC partition sonic-utilities#2150) After reboot, while booting into SONiC the SSD firmware updater will be executed in initramfs.
- Loading branch information
1 parent
992d233
commit f4b22f6
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
case $1 in | ||
prereqs) | ||
exit 0 | ||
;; | ||
esac | ||
|
||
# Extract kernel parameters | ||
set -- $(cat /proc/cmdline) | ||
for x in "$@"; do | ||
case "$x" in | ||
ssd-upgrader-part=*) | ||
ssd_upgrader_part="${x#ssd-upgrader-part=}" | ||
;; | ||
esac | ||
done | ||
|
||
if [ ! -z "$ssd_upgrader_part" ]; then | ||
echo "ssd-upgrader-part found in /proc/cmdline" > /tmp/ssd-fw-upgrade.log | ||
mkdir -p /mnt/ssd_upgrader_part | ||
mount -t "${ssd_upgrader_part#*,}" "${ssd_upgrader_part%,*}" /mnt/ssd_upgrader_part | ||
if [ -x /mnt/ssd_upgrader_part/ssd-fw-upgrade ]; then | ||
cp /mnt/ssd_upgrader_part/ssd-fw-upgrade /tmp/ | ||
cd /tmp/ | ||
umount /mnt/ssd_upgrader_part | ||
rm -r /mnt/ssd_upgrader_part | ||
./ssd-fw-upgrade >> /tmp/ssd-fw-upgrade.log 2>&1 | ||
else | ||
echo "ssd-fw-upgrade not found" >> /tmp/ssd-fw-upgrade.log | ||
umount /mnt/ssd_upgrader_part | ||
rm -r /mnt/ssd_upgrader_part | ||
fi | ||
gzip /tmp/ssd-fw-upgrade.log | ||
fi |
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