From e2ac2b63879eae35e2c600043e59f624f47e64c1 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sat, 9 Mar 2024 11:40:01 +0800 Subject: [PATCH] [Bug] Fix fw_setenv illegel character issue (#3201) What I did The bug can be reproduced by the following command: root@bjw-can-7215-6:/home/admin# sonic-installer set-fips Command: /usr/bin/fw_setenv linuxargs net.ifnames=0 loopfstype=squashfs loop=image-fips-armhf-202305.88981472-dde4d1d844/fs.squashfs systemd.unified_cgroup_hierarchy=0 varlog_size=4096 loglevel=4 logs_inram=on sonic_fips=1 Error: illegal character '=' in variable name "loopfstype=squashfs" How I did it It is to set the variable linuxargs to the the environment value cmdline, as the part of the Linux Kernel Cmdline. The environment variable cannot be split. --- sonic_installer/bootloader/uboot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic_installer/bootloader/uboot.py b/sonic_installer/bootloader/uboot.py index 0490a48216..9e83f8edd7 100644 --- a/sonic_installer/bootloader/uboot.py +++ b/sonic_installer/bootloader/uboot.py @@ -89,7 +89,7 @@ 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'] + split(cmdline)) + run_command(['/usr/bin/fw_setenv', 'linuxargs', cmdline]) click.echo('Done') def get_fips(self, image):