mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-12-20 02:26:19 +00:00
Add support for AerynOS. (#3433)
This commit is contained in:
@@ -7039,6 +7039,7 @@ static cmd_para ventoy_cmds[] =
|
|||||||
{ "vt_cmp_checksum", ventoy_cmd_cmp_checksum, 0, NULL, "", "", NULL },
|
{ "vt_cmp_checksum", ventoy_cmd_cmp_checksum, 0, NULL, "", "", NULL },
|
||||||
{ "vt_push_menu_lang", ventoy_cmd_push_menulang, 0, NULL, "", "", NULL },
|
{ "vt_push_menu_lang", ventoy_cmd_push_menulang, 0, NULL, "", "", NULL },
|
||||||
{ "vt_pop_menu_lang", ventoy_cmd_pop_menulang, 0, NULL, "", "", NULL },
|
{ "vt_pop_menu_lang", ventoy_cmd_pop_menulang, 0, NULL, "", "", NULL },
|
||||||
|
{ "vt_linux_initrd", ventoy_cmd_linux_initrd, 0, NULL, "", "", NULL },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#define VTOY_SIZE_4MB (4 * 1024 * 1024)
|
#define VTOY_SIZE_4MB (4 * 1024 * 1024)
|
||||||
#define VTOY_SIZE_512KB (512 * 1024)
|
#define VTOY_SIZE_512KB (512 * 1024)
|
||||||
#define VTOY_SIZE_1KB 1024
|
#define VTOY_SIZE_1KB 1024
|
||||||
|
#define VTOY_SIZE_4KB 4096
|
||||||
#define VTOY_SIZE_32KB (32 * 1024)
|
#define VTOY_SIZE_32KB (32 * 1024)
|
||||||
#define VTOY_SIZE_128KB (128 * 1024)
|
#define VTOY_SIZE_128KB (128 * 1024)
|
||||||
|
|
||||||
@@ -662,6 +663,7 @@ grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file);
|
|||||||
int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
|
int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
|
||||||
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
|
grub_err_t ventoy_cmd_linux_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||||
@@ -1279,6 +1281,7 @@ typedef struct systemd_menu_ctx
|
|||||||
{
|
{
|
||||||
char *dev;
|
char *dev;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
const char *initrd_cmd;
|
||||||
int pos;
|
int pos;
|
||||||
int len;
|
int len;
|
||||||
}systemd_menu_ctx;
|
}systemd_menu_ctx;
|
||||||
|
|||||||
@@ -1867,7 +1867,7 @@ static int ventoy_systemd_conf_hook(const char *filename, const struct grub_dirh
|
|||||||
ctx->pos = oldpos;
|
ctx->pos = oldpos;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Downloading kernel ...\"\n linux %s ", tag);
|
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Loading kernel ...\"\n linux %s ", tag);
|
||||||
|
|
||||||
/* kernel options */
|
/* kernel options */
|
||||||
grub_memcpy(filebuf, bkbuf, file->size);
|
grub_memcpy(filebuf, bkbuf, file->size);
|
||||||
@@ -1876,7 +1876,7 @@ static int ventoy_systemd_conf_hook(const char *filename, const struct grub_dirh
|
|||||||
|
|
||||||
|
|
||||||
/* initrd xxx xxx xxx */
|
/* initrd xxx xxx xxx */
|
||||||
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Downloading initrd ...\"\n initrd ");
|
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Loading initrd ...\"\n %s ", ctx->initrd_cmd);
|
||||||
grub_memcpy(filebuf, bkbuf, file->size);
|
grub_memcpy(filebuf, bkbuf, file->size);
|
||||||
tag = ventoy_systemd_conf_tag(filebuf, "initrd", 1);
|
tag = ventoy_systemd_conf_tag(filebuf, "initrd", 1);
|
||||||
while (tag)
|
while (tag)
|
||||||
@@ -1893,6 +1893,34 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grub_err_t ventoy_cmd_linux_initrd(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int pos = 0;
|
||||||
|
char *buf = NULL;
|
||||||
|
|
||||||
|
(void)ctxt;
|
||||||
|
|
||||||
|
buf = (char *)grub_malloc(VTOY_SIZE_4KB);
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos += grub_snprintf(buf + pos, VTOY_SIZE_4KB - pos, "initrd mem:%s:size:%s",
|
||||||
|
grub_env_get("ventoy_cpio_addr"), grub_env_get("ventoy_cpio_size"));
|
||||||
|
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
pos += grub_snprintf(buf + pos, VTOY_SIZE_4KB - pos, " newc:initrd%03d:%s", i + 1, args[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_script_execute_sourcecode(buf);
|
||||||
|
grub_free(buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
|
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
{
|
{
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
@@ -1936,6 +1964,7 @@ grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, c
|
|||||||
|
|
||||||
ctx.dev = args[0];
|
ctx.dev = args[0];
|
||||||
ctx.buf = buf;
|
ctx.buf = buf;
|
||||||
|
ctx.initrd_cmd = args[2] ? args[2] : "initrd";
|
||||||
ctx.pos = 0;
|
ctx.pos = 0;
|
||||||
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
|
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
|
||||||
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
|
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
|
||||||
|
|||||||
@@ -177,6 +177,8 @@ ventoy_get_os_type() {
|
|||||||
echo 'deepin'; return
|
echo 'deepin'; return
|
||||||
elif $GREP -q 'chinauos' /etc/os-release; then
|
elif $GREP -q 'chinauos' /etc/os-release; then
|
||||||
echo 'deepin'; return
|
echo 'deepin'; return
|
||||||
|
elif $GREP -qi 'aerynos' /etc/os-release; then
|
||||||
|
echo 'rhel7'; return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,12 @@ function ventoy_acpi_param {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vt_vcfg_pre_proc {
|
||||||
|
vt_img_sector "${vtoy_iso_part}${vt_chosen_path}"
|
||||||
|
vt_load_cpio $vtoy_path "${vt_chosen_path}" ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
|
||||||
|
vt_trailer_cpio $vtoy_iso_part "$vt_chosen_path"
|
||||||
|
}
|
||||||
|
|
||||||
function ventoy_vcfg_proc {
|
function ventoy_vcfg_proc {
|
||||||
if vt_check_custom_boot "${1}" vt_vcfg; then
|
if vt_check_custom_boot "${1}" vt_vcfg; then
|
||||||
set vtoy_chosen_path="${1}"
|
set vtoy_chosen_path="${1}"
|
||||||
@@ -422,6 +428,16 @@ function distro_specify_initrd_file_phase2 {
|
|||||||
vt_linux_specify_initrd_file /initramfs-linux.img
|
vt_linux_specify_initrd_file /initramfs-linux.img
|
||||||
elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
|
elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
|
||||||
vt_linux_specify_initrd_file /boot/isolinux/initrd.gz
|
vt_linux_specify_initrd_file /boot/isolinux/initrd.gz
|
||||||
|
elif vt_str_begin "$vt_volume_id" "AERYNOS"; then
|
||||||
|
vt_vcfg_pre_proc
|
||||||
|
|
||||||
|
loopback va "${vtoy_iso_part}${vt_chosen_path}"
|
||||||
|
loopback vb (va)/EFI/Boot/efiboot.img
|
||||||
|
|
||||||
|
set root=(vb)
|
||||||
|
vt_systemd_menu (vb) vt_sys_menu_mem vt_linux_initrd
|
||||||
|
configfile "mem:${vt_sys_menu_mem_addr}:size:${vt_sys_menu_mem_size}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user