Commit 3fdaee64 authored by Tobias Powalowski's avatar Tobias Powalowski
Browse files

add new kexec check depending on initrd size

parent 0e91e645
......@@ -273,13 +273,12 @@ _create_initramfs() {
}
_kexec () {
if [[ $(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g') -gt 5920000 ||\
$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g') -lt 2571000 ]]; then
# you need approx. 3x size for KEXEC_FILE_LOAD
if [[ "$(echo $(($(stat -c %s /initrd.img)*3.02)) | sed -e 's#\..*##g')" -lt $(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$#000#g') ]]; then
echo -e "Running \033[1m\033[92mkexec\033[0m with \033[1mnew\033[0m KEXEC_FILE_LOAD ..."
kexec -s -f /"${VMLINUZ}" --initrd="/initrd.img" --reuse-cmdline &
else
echo -e "Running \033[1m\033[92mkexec\033[0m with \033[1mold\033[0m KEXEC_LOAD ..."
# works on systems with <6GB
kexec -c -f --mem-max=0xA0000000 /"${VMLINUZ}" --initrd="/initrd.img" --reuse-cmdline &
fi
sleep 2
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment