Fix grub's slow boot
On many boards, grub takes a very long time to search for a grub.cfg file on the disk. The problem is the search_grub function which takes a long time to complete. I (vitali64) studied the grub.cfg from 2016 and the grub.cfg from 2021 and optimized the grub.cfg. It should be faster now.
This commit is contained in:
parent
7221782940
commit
cff081c6db
|
@ -1,3 +1,4 @@
|
||||||
|
/grubdiff2016/
|
||||||
*~
|
*~
|
||||||
/TODO
|
/TODO
|
||||||
/ich9utils/
|
/ich9utils/
|
||||||
|
|
|
@ -47,16 +47,25 @@ function try_user_config {
|
||||||
}
|
}
|
||||||
function search_grub {
|
function search_grub {
|
||||||
echo -n "Attempting to load grub.cfg from: "
|
echo -n "Attempting to load grub.cfg from: "
|
||||||
unset ddev
|
# TODO : Find a better way to detect how many disks
|
||||||
if [ (${1}?) != "(${1}?)" ]; then
|
# : are on the computer instead of hardcoding.
|
||||||
ddev=(${1}*) # Both raw and partitioned devices
|
# FIXME: Does this work on all boards?
|
||||||
fi
|
for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
|
||||||
for i in ${ddev}; do
|
# TODO : Find a better way to detect how many partitions
|
||||||
echo -n "${i} "
|
# : are on the disk instead of hardcoding.
|
||||||
try_user_config "${i}"
|
echo "\nTrying disk ${1}${i}"
|
||||||
|
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
|
||||||
|
# MBR/GPT partitions
|
||||||
|
echo "\nTrying partiton ${part}"
|
||||||
|
try_user_config "(${1}${i},${part})"
|
||||||
done
|
done
|
||||||
|
# raw devices
|
||||||
|
echo "\nTrying to boot to a raw disk ..."
|
||||||
|
try_user_config "(${1}${i})"
|
||||||
echo # Insert newline
|
echo # Insert newline
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function try_isolinux_config {
|
function try_isolinux_config {
|
||||||
set root="${1}"
|
set root="${1}"
|
||||||
for dir in '' /boot; do
|
for dir in '' /boot; do
|
||||||
|
|
Loading…
Reference in New Issue