Skip to content

Commit 1bf68c9

Browse files
authored
Merge branch 'ventoy:master' into master
2 parents e29c3b3 + 2dafe75 commit 1bf68c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+611
-440
lines changed

.github/workflows/ci.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Run docker-compose up
17-
run: docker-compose up
18-
- uses: actions/upload-artifact@v3
16+
- name: Run docker compose up
17+
run: docker compose up
18+
- uses: actions/upload-artifact@v4
1919
with:
2020
name: ventoy-windows
2121
path: INSTALL/ventoy-*windows*
22-
- uses: actions/upload-artifact@v3
22+
- uses: actions/upload-artifact@v4
2323
with:
2424
name: ventoy-linux
2525
path: INSTALL/ventoy-*linux*
26-
- uses: actions/upload-artifact@v3
26+
- uses: actions/upload-artifact@v4
2727
with:
2828
name: ventoy-livecd
2929
path: INSTALL/ventoy-*livecd*
30-
- uses: actions/upload-artifact@v3
30+
- uses: actions/upload-artifact@v4
3131
with:
3232
name: SHA256SUM
3333
path: INSTALL/sha256.txt
34-
- uses: actions/upload-artifact@v3
34+
- uses: actions/upload-artifact@v4
3535
with:
3636
name: xxx-build-log
3737
path: DOC/build.log

Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
FROM centos:7
22

3-
RUN yum -y -q install \
3+
RUN sed -i \
4+
-e 's/^mirrorlist/#mirrorlist/' \
5+
-e 's/^#baseurl/baseurl/' \
6+
-e 's/mirror\.centos\.org/vault.centos.org/' \
7+
/etc/yum.repos.d/*.repo && \
8+
yum -y -q install \
49
libXpm net-tools bzip2 wget vim gcc gcc-c++ samba dos2unix glibc-devel glibc.i686 glibc-devel.i686 \
510
mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \
611
flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \

GRUB2/MOD_SRC/grub-2.04/grub-core/loader/linux.c

+19-8
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,22 @@ insert_dir (const char *name, struct dir **root,
128128
n->name = grub_strndup (cb, ce - cb);
129129
if (ptr)
130130
{
131+
/*
132+
* Create the substring with the trailing NUL byte
133+
* to be included in the cpio header.
134+
*/
135+
char *tmp_name = grub_strndup (name, ce - name);
136+
if (!tmp_name) {
137+
grub_free (n->name);
138+
grub_free (n);
139+
return grub_errno;
140+
}
131141
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
132-
ptr = make_header (ptr, name, ce - name,
142+
ptr = make_header (ptr, tmp_name, ce - name + 1,
133143
040777, 0);
144+
grub_free (tmp_name);
134145
}
135-
size += ALIGN_UP ((ce - (char *) name)
146+
size += ALIGN_UP ((ce - (char *) name + 1)
136147
+ sizeof (struct newc_head), 4);
137148
*head = n;
138149
cur = n;
@@ -183,7 +194,7 @@ grub_initrd_init (int argc, char *argv[],
183194
}
184195
initrd_ctx->size
185196
+= ALIGN_UP (sizeof (struct newc_head)
186-
+ grub_strlen (initrd_ctx->components[i].newc_name),
197+
+ grub_strlen (initrd_ctx->components[i].newc_name) + 1,
187198
4);
188199
initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
189200
&root, 0);
@@ -194,7 +205,7 @@ grub_initrd_init (int argc, char *argv[],
194205
else if (newc)
195206
{
196207
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
197-
+ sizeof ("TRAILER!!!") - 1, 4);
208+
+ sizeof ("TRAILER!!!"), 4);
198209
free_dir (root);
199210
root = 0;
200211
newc = 0;
@@ -217,7 +228,7 @@ grub_initrd_init (int argc, char *argv[],
217228
{
218229
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
219230
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
220-
+ sizeof ("TRAILER!!!") - 1, 4);
231+
+ sizeof ("TRAILER!!!"), 4);
221232
free_dir (root);
222233
root = 0;
223234
}
@@ -269,14 +280,14 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
269280
ptr += insert_dir (initrd_ctx->components[i].newc_name,
270281
&root, ptr);
271282
ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
272-
grub_strlen (initrd_ctx->components[i].newc_name),
283+
grub_strlen (initrd_ctx->components[i].newc_name) + 1,
273284
0100777,
274285
initrd_ctx->components[i].size);
275286
newc = 1;
276287
}
277288
else if (newc)
278289
{
279-
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1,
290+
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"),
280291
0, 0);
281292
free_dir (root);
282293
root = 0;
@@ -308,7 +319,7 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
308319
{
309320
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
310321
ptr += ALIGN_UP_OVERHEAD (cursize, 4);
311-
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0);
322+
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"), 0, 0);
312323
}
313324
free_dir (root);
314325
root = 0;

GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,8 @@ typedef struct vhd_footer_t
861861
grub_uint8_t savedst; // Saved state
862862
}vhd_footer_t;
863863

864-
#define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
864+
#define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
865+
#define VDI_IMAGE_FILE_INFO2 "<<< Oracle VirtualBox Disk Image >>>\n"
865866

866867
/** Image signature. */
867868
#define VDI_IMAGE_SIGNATURE (0xbeda107f)

GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c

+18-5
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,25 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
536536
{
537537
grub_file_seek(file, 0);
538538
grub_file_read(file, &vdihdr, sizeof(vdihdr));
539-
if (vdihdr.u32Signature == VDI_IMAGE_SIGNATURE &&
540-
grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0)
539+
if (vdihdr.u32Signature == VDI_IMAGE_SIGNATURE)
541540
{
542-
offset = 2 * 1048576;
543-
g_img_trim_head_secnum = offset / 512;
544541
grub_snprintf(type, sizeof(type), "vdi");
542+
if (grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0)
543+
{
544+
offset = 2 * 1048576;
545+
g_img_trim_head_secnum = offset / 512;
546+
debug("VDI V1\n");
547+
}
548+
else if (grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO2, grub_strlen(VDI_IMAGE_FILE_INFO2)) == 0)
549+
{
550+
offset = 2 * 1048576;
551+
g_img_trim_head_secnum = offset / 512;
552+
debug("VDI V2\n");
553+
}
554+
else
555+
{
556+
debug("invalid file info <%s>\n", vdihdr.szFileInfo);
557+
}
545558
}
546559
else
547560
{
@@ -568,7 +581,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
568581
if (gpt->MBR.Byte55 != 0x55 || gpt->MBR.ByteAA != 0xAA)
569582
{
570583
grub_env_set(args[1], "unknown");
571-
debug("invalid mbr signature: 0x%x 0x%x\n", gpt->MBR.Byte55, gpt->MBR.ByteAA);
584+
debug("invalid mbr signature: 0x%x 0x%x offset=%d\n", gpt->MBR.Byte55, gpt->MBR.ByteAA, offset);
572585
goto end;
573586
}
574587

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
. /ventoy/hook/ventoy-hook-lib.sh
21+
22+
if is_ventoy_hook_finished; then
23+
exit 0
24+
fi
25+
26+
vtlog "####### $0 $* ########"
27+
28+
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
29+
30+
wait_for_usb_disk_ready
31+
32+
vtdiskname=$(get_ventoy_disk_name)
33+
if [ "$vtdiskname" = "unknown" ]; then
34+
vtlog "ventoy disk not found"
35+
PATH=$VTPATH_OLD
36+
exit 0
37+
fi
38+
39+
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
40+
41+
PATH=$VTPATH_OLD
42+
43+
set_ventoy_hook_finish
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
$SED "/Mount.*cdrom/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/devuan-disk.sh" -i /init
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
. /ventoy/hook/ventoy-hook-lib.sh
21+
22+
vtlog "mount ventoy.iso"
23+
mkdir -p /root/cdrom >>$VTLOG 2>&1
24+
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso /root/cdrom >>$VTLOG 2>&1
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
. /ventoy/hook/ventoy-hook-lib.sh
21+
22+
vtlog "####### $0 $* ########"
23+
24+
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
25+
26+
27+
ventoy_run_fuse() {
28+
vtlog "ventoy_run_fuse $*"
29+
30+
mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso
31+
32+
vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
33+
vtoy_fuse_iso -f $VTOY_PATH/ventoy_dm_table -m $VTOY_PATH/mnt/fuse
34+
35+
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
36+
}
37+
38+
39+
wait_for_usb_disk_ready
40+
41+
vtdiskname=$(get_ventoy_disk_name)
42+
if [ "$vtdiskname" = "unknown" ]; then
43+
vtlog "ventoy disk not found"
44+
PATH=$VTPATH_OLD
45+
exit 0
46+
fi
47+
48+
ventoy_run_fuse $vtdiskname
49+
50+
if [ -f /ventoy/autoinstall ]; then
51+
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
52+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/ventoy/busybox/sh
2+
#************************************************************************************
3+
# Copyright (c) 2020, longpanda <admin@ventoy.net>
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License as
7+
# published by the Free Software Foundation; either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, see <http://www.gnu.org/licenses/>.
17+
#
18+
#************************************************************************************
19+
20+
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
21+
echo "Here before mountroot ..." >> $VTLOG
22+
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/truenas-disk.sh" -i /init
23+
$SED "/^mountroot$/i\\export LIVEMEDIA=/dev/mapper/ventoy" -i /init
24+
$SED "/^mountroot$/i\\export LIVE_MEDIA=/dev/mapper/ventoy" -i /init
25+
$SED "/^mountroot$/i\\export FROMISO=$VTOY_PATH/mnt/fuse/ventoy.iso" -i /init
26+
$SED "/exec *run-init/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/truenas-bottom.sh" -i /init
27+
fi

IMG/cpio/ventoy/hook/debian/ventoy-hook.sh

+8
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ ventoy_get_debian_distro() {
110110
echo 'pyabr'; return
111111
fi
112112

113+
if [ -e /devuan-logo.txt ]; then
114+
echo 'devuan'; return
115+
fi
116+
117+
if $GREP -q 'truenas' /proc/version; then
118+
echo 'truenas'; return
119+
fi
120+
113121
echo 'default'
114122
}
115123

0 commit comments

Comments
 (0)