Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
f82475d9
Commit
f82475d9
authored
Apr 20, 2021
by
longpanda
Browse files
support new GhostBSD release
parent
aad15461
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
194 additions
and
18 deletions
+194
-18
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+1
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+1
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c
+170
-0
GRUB2/MOD_SRC/grub-2.04/install.sh
GRUB2/MOD_SRC/grub-2.04/install.sh
+4
-4
INSTALL/grub/arm64-efi/file.mod
INSTALL/grub/arm64-efi/file.mod
+0
-0
INSTALL/grub/arm64-efi/moddep.lst
INSTALL/grub/arm64-efi/moddep.lst
+1
-1
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+14
-10
INSTALL/grub/i386-efi/file.mod
INSTALL/grub/i386-efi/file.mod
+0
-0
INSTALL/grub/i386-efi/moddep.lst
INSTALL/grub/i386-efi/moddep.lst
+1
-1
INSTALL/grub/i386-pc/moddep.lst
INSTALL/grub/i386-pc/moddep.lst
+1
-1
INSTALL/grub/mips64el-efi/file.mod
INSTALL/grub/mips64el-efi/file.mod
+0
-0
INSTALL/grub/mips64el-efi/moddep.lst
INSTALL/grub/mips64el-efi/moddep.lst
+0
-0
INSTALL/grub/x86_64-efi/file.mod
INSTALL/grub/x86_64-efi/file.mod
+0
-0
INSTALL/grub/x86_64-efi/moddep.lst
INSTALL/grub/x86_64-efi/moddep.lst
+1
-1
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
f82475d9
...
...
@@ -4402,6 +4402,7 @@ static cmd_para ventoy_cmds[] =
{
"vt_parse_iso_create_date"
,
ventoy_cmd_parse_create_date
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_parse_freenas_ver"
,
ventoy_cmd_parse_freenas_ver
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_unix_parse_freebsd_ver"
,
ventoy_cmd_unix_freebsd_ver
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_unix_parse_freebsd_ver_elf"
,
ventoy_cmd_unix_freebsd_ver_elf
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_unix_reset"
,
ventoy_cmd_unix_reset
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_unix_replace_conf"
,
ventoy_cmd_unix_replace_conf
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_unix_replace_ko"
,
ventoy_cmd_unix_replace_ko
,
0
,
NULL
,
""
,
""
,
NULL
},
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
f82475d9
...
...
@@ -983,6 +983,7 @@ grub_err_t ventoy_cmd_unix_fill_image_desc(grub_extcmd_context_t ctxt, int argc,
grub_err_t
ventoy_cmd_unix_gzip_newko
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
);
grub_err_t
ventoy_cmd_unix_freebsd_ver
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
);
grub_err_t
ventoy_cmd_parse_freenas_ver
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
);
grub_err_t
ventoy_cmd_unix_freebsd_ver_elf
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
);
int
ventoy_check_device_result
(
int
ret
);
int
ventoy_check_device
(
grub_device_t
dev
);
void
ventoy_debug_dump_guid
(
const
char
*
prefix
,
grub_uint8_t
*
guid
);
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c
View file @
f82475d9
...
...
@@ -33,6 +33,8 @@
#include <grub/i18n.h>
#include <grub/net.h>
#include <grub/time.h>
#include <grub/elf.h>
#include <grub/elfload.h>
#include <grub/ventoy.h>
#include "ventoy_def.h"
...
...
@@ -383,6 +385,174 @@ grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, cha
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
grub_err_t
ventoy_cmd_unix_freebsd_ver_elf
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
j
;
int
k
;
grub_elf_t
elf
=
NULL
;
grub_off_t
offset
=
0
;
grub_uint32_t
len
=
0
;
char
*
str
=
NULL
;
char
*
data
=
NULL
;
void
*
hdr
=
NULL
;
char
ver
[
64
]
=
{
0
};
(
void
)
ctxt
;
(
void
)
argc
;
(
void
)
args
;
if
(
argc
!=
3
)
{
debug
(
"Invalid argc %d
\n
"
,
argc
);
return
1
;
}
data
=
grub_zalloc
(
8192
);
if
(
!
data
)
{
goto
out
;
}
elf
=
grub_elf_open
(
args
[
0
],
GRUB_FILE_TYPE_LINUX_INITRD
);
if
(
!
elf
)
{
debug
(
"Failed to open file %s
\n
"
,
args
[
0
]);
goto
out
;
}
if
(
args
[
1
][
0
]
==
'6'
)
{
Elf64_Ehdr
*
e
=
&
(
elf
->
ehdr
.
ehdr64
);
Elf64_Shdr
*
h
;
Elf64_Shdr
*
s
;
Elf64_Shdr
*
t
;
Elf64_Half
i
;
h
=
hdr
=
grub_zalloc
(
e
->
e_shnum
*
e
->
e_shentsize
);
if
(
!
h
)
{
goto
out
;
}
debug
(
"read section header %u %u %u
\n
"
,
e
->
e_shnum
,
e
->
e_shentsize
,
e
->
e_shstrndx
);
grub_file_seek
(
elf
->
file
,
e
->
e_shoff
);
grub_file_read
(
elf
->
file
,
h
,
e
->
e_shnum
*
e
->
e_shentsize
);
s
=
(
Elf64_Shdr
*
)((
char
*
)
h
+
e
->
e_shstrndx
*
e
->
e_shentsize
);
str
=
grub_malloc
(
s
->
sh_size
+
1
);
if
(
!
str
)
{
goto
out
;
}
str
[
s
->
sh_size
]
=
0
;
debug
(
"read string table %u %u
\n
"
,
(
grub_uint32_t
)
s
->
sh_offset
,
(
grub_uint32_t
)
s
->
sh_size
);
grub_file_seek
(
elf
->
file
,
s
->
sh_offset
);
grub_file_read
(
elf
->
file
,
str
,
s
->
sh_size
);
for
(
t
=
h
,
i
=
0
;
i
<
e
->
e_shnum
;
i
++
)
{
if
(
grub_strcmp
(
str
+
t
->
sh_name
,
".data"
)
==
0
)
{
offset
=
t
->
sh_offset
;
len
=
t
->
sh_size
;
debug
(
"find .data section at %u %u
\n
"
,
(
grub_uint32_t
)
offset
,
len
);
break
;
}
t
=
(
Elf64_Shdr
*
)((
char
*
)
t
+
e
->
e_shentsize
);
}
}
else
{
Elf32_Ehdr
*
e
=
&
(
elf
->
ehdr
.
ehdr32
);
Elf32_Shdr
*
h
;
Elf32_Shdr
*
s
;
Elf32_Shdr
*
t
;
Elf32_Half
i
;
h
=
hdr
=
grub_zalloc
(
e
->
e_shnum
*
e
->
e_shentsize
);
if
(
!
h
)
{
goto
out
;
}
debug
(
"read section header %u %u %u
\n
"
,
e
->
e_shnum
,
e
->
e_shentsize
,
e
->
e_shstrndx
);
grub_file_seek
(
elf
->
file
,
e
->
e_shoff
);
grub_file_read
(
elf
->
file
,
h
,
e
->
e_shnum
*
e
->
e_shentsize
);
s
=
(
Elf32_Shdr
*
)((
char
*
)
h
+
e
->
e_shstrndx
*
e
->
e_shentsize
);
str
=
grub_malloc
(
s
->
sh_size
+
1
);
if
(
!
str
)
{
goto
out
;
}
str
[
s
->
sh_size
]
=
0
;
debug
(
"read string table %u %u
\n
"
,
(
grub_uint32_t
)
s
->
sh_offset
,
(
grub_uint32_t
)
s
->
sh_size
);
grub_file_seek
(
elf
->
file
,
s
->
sh_offset
);
grub_file_read
(
elf
->
file
,
str
,
s
->
sh_size
);
for
(
t
=
h
,
i
=
0
;
i
<
e
->
e_shnum
;
i
++
)
{
if
(
grub_strcmp
(
str
+
t
->
sh_name
,
".data"
)
==
0
)
{
offset
=
t
->
sh_offset
;
len
=
t
->
sh_size
;
debug
(
"find .data section at %u %u
\n
"
,
(
grub_uint32_t
)
offset
,
len
);
break
;
}
t
=
(
Elf32_Shdr
*
)((
char
*
)
t
+
e
->
e_shentsize
);
}
}
if
(
offset
==
0
||
len
==
0
)
{
debug
(
".data section not found %s
\n
"
,
args
[
0
]);
goto
out
;
}
grub_file_seek
(
elf
->
file
,
offset
+
len
-
8192
);
grub_file_read
(
elf
->
file
,
data
,
8192
);
for
(
j
=
0
;
j
<
8192
-
12
;
j
++
)
{
if
(
grub_strncmp
(
data
+
j
,
"@(#)FreeBSD "
,
12
)
==
0
)
{
for
(
k
=
j
+
12
;
k
<
8192
;
k
++
)
{
if
(
0
==
grub_isdigit
(
data
[
k
])
&&
data
[
k
]
!=
'.'
)
{
data
[
k
]
=
0
;
break
;
}
}
grub_snprintf
(
ver
,
sizeof
(
ver
),
"%s"
,
data
+
j
+
12
);
break
;
}
}
if
(
ver
[
0
])
{
k
=
(
int
)
grub_strtoul
(
ver
,
NULL
,
10
);
debug
(
"freebsd version:<%s> <%d.x>
\n
"
,
ver
,
k
);
grub_snprintf
(
ver
,
sizeof
(
ver
),
"%d.x"
,
k
);
ventoy_set_env
(
args
[
2
],
ver
);
}
else
{
debug
(
"freebsd version:<%s>
\n
"
,
"NOT FOUND"
);
}
out:
grub_check_free
(
str
);
grub_check_free
(
hdr
);
grub_check_free
(
data
);
check_free
(
elf
,
grub_elf_close
);
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
grub_err_t
ventoy_cmd_unix_replace_conf
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
grub_uint32_t
i
;
...
...
GRUB2/MOD_SRC/grub-2.04/install.sh
View file @
f82475d9
...
...
@@ -12,14 +12,14 @@ make install
PATH
=
$PATH
:
$VT_DIR
/GRUB2/INSTALL/bin/:
$VT_DIR
/GRUB2/INSTALL/sbin/
net_modules_legacy
=
"net tftp http"
all_modules_legacy
=
"setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
all_modules_legacy
=
"
file
setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
net_modules_uefi
=
"efinet net tftp http"
all_modules_uefi
=
"setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
all_modules_uefi
=
"
file
setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
all_modules_arm64_uefi
=
"setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
all_modules_arm64_uefi
=
"
file
setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
all_modules_mips64el_uefi
=
"setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
all_modules_mips64el_uefi
=
"
file
setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
if
[
"
$1
"
=
"uefi"
]
;
then
...
...
INSTALL/grub/arm64-efi/file.mod
deleted
100644 → 0
View file @
aad15461
File deleted
INSTALL/grub/arm64-efi/moddep.lst
View file @
f82475d9
...
...
@@ -93,7 +93,7 @@ terminal:
div:
crypto:
part_bsd: part_msdos
ventoy: e
xt2
fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
ventoy: e
lf
fshelp
ext2
btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
gcry_sha512: crypto
password: crypto normal
fshelp:
...
...
INSTALL/grub/grub.cfg
View file @
f82475d9
...
...
@@ -318,13 +318,8 @@ function distro_specify_initrd_file_phase2 {
}
function ventoy_get_ghostbsd_ver {
# vt_parse_iso_create_date "$1/${chosen_path}" vt_create_date
# if regexp "^202005" "$vt_create_date"; then
# set vt_freebsd_ver=12.x
# fi
set vt_freebsd_ver=12.x
# fallback to parse version from elf /boot/kernel/kernel
set vt_freebsd_ver=xx
}
function ventoy_get_furybsd_ver {
...
...
@@ -371,6 +366,7 @@ function ventoy_get_midnightbsd_ver {
function ventoy_freebsd_proc {
set vtFreeBsdDistro=FreeBSD
set vt_freebsd_ver=xx
if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
ventoy_get_ghostbsd_ver "$1" "${chosen_path}"
...
...
@@ -421,8 +417,6 @@ function ventoy_freebsd_proc {
fi
elif vt_strstr "${chosen_path}" "MidnightBSD"; then
set vt_freebsd_ver=9.x
else
set vt_freebsd_ver=12.x
fi
set vt_freebsd_bit=64
...
...
@@ -435,6 +429,16 @@ function ventoy_freebsd_proc {
fi
done
if [ "$vt_freebsd_ver" = "xx" ]; then
if [ -e (loop)/boot/kernel/kernel ]; then
vt_unix_parse_freebsd_ver_elf (loop)/boot/kernel/kernel $vt_freebsd_bit vt_freebsd_ver
fi
if [ "$vt_freebsd_ver" = "xx" ]; then
set vt_freebsd_ver=13.x
fi
fi
if [ -n "${vtdebug_flag}" ]; then
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
fi
...
...
INSTALL/grub/i386-efi/file.mod
deleted
100644 → 0
View file @
aad15461
File deleted
INSTALL/grub/i386-efi/moddep.lst
View file @
f82475d9
...
...
@@ -120,7 +120,7 @@ ehci: cs5536 usb boot
crypto:
part_bsd: part_msdos
cs5536:
ventoy: e
xt2
fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
ventoy: e
lf
fshelp
ext2
btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
gcry_sha512: crypto
password: crypto normal
fshelp:
...
...
INSTALL/grub/i386-pc/moddep.lst
View file @
f82475d9
...
...
@@ -123,7 +123,7 @@ crypto:
part_bsd: part_msdos
cs5536: pci
biosdisk:
ventoy: e
xt2
fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
ventoy: e
lf
fshelp
ext2
btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660 acpi
lsapm:
gcry_sha512: crypto
password: crypto normal
...
...
INSTALL/grub/mips64el-efi/file.mod
deleted
100644 → 0
View file @
aad15461
File deleted
INSTALL/grub/mips64el-efi/moddep.lst
View file @
f82475d9
No preview for this file type
INSTALL/grub/x86_64-efi/file.mod
deleted
100644 → 0
View file @
aad15461
File deleted
INSTALL/grub/x86_64-efi/moddep.lst
View file @
f82475d9
...
...
@@ -120,7 +120,7 @@ ehci: cs5536 usb boot
crypto:
part_bsd: part_msdos
cs5536:
ventoy: e
xt2
fshelp btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
ventoy: e
lf
fshelp
ext2
btrfs font crypto gcry_md5 exfat udf extcmd normal video gcry_sha1 iso9660
gcry_sha512: crypto
password: crypto normal
fshelp:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment