I don’t think you should modify those files, or need to tinker with source code.
your problem seems to be ACPI/BIOS related => not all PC systems comply with the standards, and it shows in this aspect.
the documentation shown by the former post, correctly treats the problem, only left to you is a way to add that parameter to the kernel boot args
In order to fix the issue, you should try one-by-one passing the following parameter to the kernel, in the form of “reboot=<parameter>”, at the time of boot:
warm = Don’t set the cold reboot flag
cold = Set the cold reboot flag
bios = Reboot by jumping through the BIOS (only for X86_32)
smp = Reboot by executing reset on BSP or other CPU (only for X86_32)
triple = Force a triple fault (init)
kbd = Use the keyboard controller. cold reset (default)
acpi = Use the RESET_REG in the FADT
efi = Use efi reset_system runtime service
pci = Use the so-called “PCI reset register”, CF9
force = Avoid anything that could hang.
As per my experience, one of the parameters (in blue color above) should be able to resolve your hang (or freeze) issue 90% of the time:
Once your system boots you can verify whether the parameter was correctly passed or not by issuing the following command:
root=/dev/sda ro vga=791 quiet reboot=bios
You can find the list of all the above parameters in the reboot.c file in the Linux kernel source.
By default, the Linux kernel uses the reboot=kbd method i.e. it tries to look for a keyboard controller and issue a reset/shutdown command to it. But there are some systems like some of the Intel Atom processor based machines that don’t have a keyboard controller and the above fixes are required. If you read the reboot.c file carefully there are some major main stream machines from Dell, Sony, HP, etc. that require the above “reboot=” fix. I guess sometime it is easier to fix the issue by using the kernel parameter rather than fixing in the BIOS.
Also you can also use the first letter (as denoted in the “]” brackets) of each of the parameter:
reboot=b # for reboot=**ios
reboot= a # for reboot=[a]cpi
and you can pass multiple parameter at the same time and Linux kernel will try in order specified:
reboot=a,b,k,c # for reboot=acpi,bios,kbd,cold