Skip to content
Snippets Groups Projects
Commit 04ba3b0f authored by livio's avatar livio Committed by Libreboot project
Browse files

Implemented media detection

parent e709aed1
Branches
No related tags found
No related merge requests found
......@@ -40,6 +40,46 @@ if [ -f (cbfsdisk)/keymap.gkb ]; then
keymap (cbfsdisk)/keymap.gkb
fi
# Default enums for non detectable medias. Override as you like, eventually.
set partnums="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
set medianums="20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0"
# Loads into a variable all the medias from *
function mediadetect {
unset media_devlist
set media_devlist=*
}
# Fills a variable containing possible partition list from a specified and previously detected media kind
function enum_tgt {
unset tgt_medias
for media_item in ${media_devlist}; do
for device_kind in ${1}; do
for num in $medianums; do
# If media number is an existent detected media
if [ $media_item == "($device_kind$num)" ]; then
# Add raw media
tgt_medias="${tgt_medias} (${device_kind}${num})"
# Add every possible partition
for part in ${partnums}; do
tgt_medias="${tgt_medias} (${device_kind}${num},${part})"
done
fi
done
done
done
echo $tgt_medias
}
mediadetect
menuentry "Media detection test" {
enum_tgt ata
enum_tgt ahci
set pager=1
read
}
function try_user_grub_config {
set root="${1}"
# The @/... entries are for cases where the BTRFS filesystem is being used
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment