f4b22f67a4
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.
36 lines
970 B
Bash
36 lines
970 B
Bash
#!/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
|