-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[soft-reboot] Add support for platforms based on Device Tree #1963
Conversation
The soft-reboot command currently expects a platform that uses GRUB. Information about the current kernel boot arguments is extracted from the GRUB config file. This commit adds support for platforms that do not use GRUB but rather uses Device Tree to define the current kernel boot arguments. Example platform architectures using Device Tree include armhf and arm64.
scripts/soft-reboot
Outdated
# Handle architectures supporting Device Tree | ||
elif [ -f /sys/firmware/devicetree/base/chosen/bootargs ]; then | ||
KERNEL_IMAGE="$(ls $IMAGE_PATH/boot/vmlinuz-*)" | ||
BOOT_OPTIONS=$(cat /sys/firmware/devicetree/base/chosen/bootargs | sed 's/.$/\n/')" SONIC_BOOT_TYPE=${BOOT_TYPE_ARG}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you add "\n" new line before SONIC_BOOT_TYPE ?
And also don't you need to put the first " in front instead of next ')' as below?
BOOT_OPTIONS="$(cat /sys/firmware/devicetree/base/chosen/bootargs | sed 's/.$/\n/') SONIC_BOOT_TYPE=${BOOT_TYPE_ARG}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both good points.
The contents of /sys/firmware/devicetree/base/chosen/bootargs includes a trailing null character that yields a warning during the variable assignment. I replaced that with '\n' but better to just strip it away.
Your suggestion for " placement also works and looks cleaner.
I'll make these changes.
Thanks,
@dflynn-Nokia Can you also please share the |
As you requested, here's the reboot-cause info from syslog admin@localhost:~$ sudo zgrep reboot-cause /var/log/syslog And here's the value of /proc/cmdline after soft-reboot admin@localhost:~$ cat /proc/cmdline |
What I did Add soft-reboot command support for the armhf and arm64 platforms How I did it Add logic to retrieve kernel boot arguments from the Device Tree rather than from the GRUB config for these platforms How to verify it Execute the soft-reboot command on an armhf or arm64 platform
What I did Add soft-reboot command support for the armhf and arm64 platforms How I did it Add logic to retrieve kernel boot arguments from the Device Tree rather than from the GRUB config for these platforms How to verify it Execute the soft-reboot command on an armhf or arm64 platform
Update submodule sonic-utilities that contains the following commits: Revert "[202012] [generate_dump] allow to extend dump with plugin scripts (sonic-net#1945)" (sonic-net#1993) [soft-reboot] Add support for platforms based on Device Tree (sonic-net#1963) [Reclaiming buffer][202012] Database migrator for reclaiming buffer (sonic-net#1898) [202012] [generate_dump] allow to extend dump with plugin scripts (sonic-net#1945) Signed-off-by: dprital <[email protected]>
The soft-reboot command currently expects a platform that uses GRUB.
Information about the current kernel boot arguments is extracted from the
GRUB config file. This commit adds support for platforms that do not use GRUB
but rather uses Device Tree to define the current kernel boot arguments.
Example platform architectures using Device Tree include armhf and arm64.
What I did
Add soft-reboot command support for the armhf and arm64 platforms
How I did it
Add logic to retrieve kernel boot arguments from the Device Tree rather than from the GRUB config for these platforms
How to verify it
Execute the soft-reboot command on an armhf or arm64 platform
Previous command output (if the output of a command-line utility has changed)
sudo soft-reboot
Error response from daemon: Container 68b38ffde1c8a95922eed7706a2f92c46e5b6582539cecc4aaa7263803db56e3 is not running
cat: /host/grub/grub.cfg: No such file or directory
requested COLD shutdown
syscall kexec_file_load not available.
Read on /host failed: Is a directory
Cannot read /hostFailed to arm Watchdog for 180 seconds
Nothing has been loaded!
New command output (if the output of a command-line utility has changed)
Successful reboot via kexec to Sonic login prompt