Auto use memdisk mode when booting iKuai OS.

pull/1648/head
longpanda 2 years ago
parent 2cd22da8fb
commit 7f2f845a68

@ -2612,24 +2612,38 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
{
char value[32];
char *pos = NULL;
char *last = NULL;
const char *id = NULL;
img_info *cur = NULL;
(void)ctxt;
if (argc < 1 || argc > 2)
if (argc < 1 || argc > 3)
{
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s {var}", cmd_raw_name);
}
if (g_fake_vlnk_src[0] && g_fake_vlnk_dst[0])
{
grub_env_set(args[0], grub_strchr(g_fake_vlnk_src, '/'));
pos = grub_strchr(g_fake_vlnk_src, '/');
grub_env_set(args[0], pos);
if (argc > 1)
{
grub_snprintf(value, sizeof(value), "%llu", (ulonglong)(g_fake_vlnk_size));
grub_env_set(args[1], value);
}
if (argc > 2)
{
for (last = pos; *pos; pos++)
{
if (*pos == '/')
{
last = pos;
}
}
grub_env_set(args[2], last + 1);
}
goto end;
}
@ -2658,6 +2672,12 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
grub_snprintf(value, sizeof(value), "%llu", (ulonglong)(cur->size));
grub_env_set(args[1], value);
}
if (argc > 2)
{
grub_snprintf(value, sizeof(value), "%llu", (ulonglong)(cur->size));
grub_env_set(args[2], cur->name);
}
end:
g_svd_replace_offset = 0;

@ -1301,7 +1301,7 @@ function iso_common_menuentry {
unset vt_system_id
unset vt_volume_id
vt_chosen_img_path vt_chosen_path vt_chosen_size
vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
if [ $vt_volume_space -ne $vt_chosen_size ]; then
@ -1349,10 +1349,17 @@ function iso_common_menuentry {
elif vt_iso_vd_id_begin 0 1 "KolibriOS"; then
set vtMemDiskBoot=1
fi
fi
fi
#For iKuai8 (<64MB)
if [ $vt_chosen_size -le 67108864 ]; then
if vt_str_begin "$vt_chosen_name" "iKuai"; then
set vtMemDiskBoot=1
fi
fi
fi
vt_iso_vd_id_clear
if [ "$grub_platform" = "pc" ]; then
if [ -n "$vtMemDiskBoot" ]; then

Loading…
Cancel
Save