Skip to content

Commit

Permalink
Fix the invalid variable issue when set-fips in uboot (#2834)
Browse files Browse the repository at this point in the history
What I did
Reproduce the issue:

/home/admin# sonic-installer set-fips
Command: /usr/bin/fw_setenv linuxargs net.ifnames=0 loopfstype=squashfs loop=image-20220531.27/fs.squashfs systemd.unified_cgroup_hierarchy=0 varlog_size=4096 loglevel=4 sonic_fips=1
Error: illegal character '=' in variable name "loopfstype=squashfs"

Work item tracking
Microsoft ADO (number only): 22333116
How I did it
Add the double quotation marks when calling the command.

How to verify it
It works fine when calling the following command:
/usr/bin/fw_setenv linuxargs "net.ifnames=0 loopfstype=squashfs loop=image-20220531.27/fs.squashfs systemd.unified_cgroup_hierarchy=0 varlog_size=4096 loglevel=4 sonic_fips=1"
  • Loading branch information
xumia authored and yxieca committed May 17, 2023
1 parent d98033f commit ff26d90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sonic_installer/bootloader/uboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def set_fips(self, image, enable):
cmdline = out.strip()
cmdline = re.sub('^linuxargs=', '', cmdline)
cmdline = re.sub(r' sonic_fips=[^\s]', '', cmdline) + " sonic_fips=" + fips
run_command('/usr/bin/fw_setenv linuxargs ' + cmdline)
cmdline = '"' + cmdline + '"'
run_command('/usr/bin/fw_setenv linuxargs ' + cmdline )
click.echo('Done')

def get_fips(self, image):
Expand Down

0 comments on commit ff26d90

Please sign in to comment.