linux raw boot

This commit is contained in:
longpanda 2020-09-27 17:23:50 +08:00
parent 4f840ed673
commit bf4e014023
12 changed files with 195 additions and 55 deletions

View File

@ -56,6 +56,7 @@ int g_initrd_img_count = 0;
int g_valid_initrd_count = 0; int g_valid_initrd_count = 0;
int g_default_menu_mode = 0; int g_default_menu_mode = 0;
int g_filt_dot_underscore_file = 0; int g_filt_dot_underscore_file = 0;
int g_sort_case_sensitive = 0;
static grub_file_t g_old_file; static grub_file_t g_old_file;
static int g_ventoy_last_entry_back; static int g_ventoy_last_entry_back;
@ -1021,6 +1022,8 @@ int ventoy_cmp_img(img_info *img1, img_info *img2)
c1 = *s1; c1 = *s1;
c2 = *s2; c2 = *s2;
if (0 == g_sort_case_sensitive)
{
if (grub_islower(c1)) if (grub_islower(c1))
{ {
c1 = c1 - 'a' + 'A'; c1 = c1 - 'a' + 'A';
@ -1030,6 +1033,40 @@ int ventoy_cmp_img(img_info *img1, img_info *img2)
{ {
c2 = c2 - 'a' + 'A'; c2 = c2 - 'a' + 'A';
} }
}
if (c1 != c2)
{
break;
}
}
return (c1 - c2);
}
static int ventoy_cmp_subdir(char *name1, char *name2)
{
char *s1, *s2;
int c1 = 0;
int c2 = 0;
for (s1 = name1, s2 = name2; *s1 && *s2; s1++, s2++)
{
c1 = *s1;
c2 = *s2;
if (0 == g_sort_case_sensitive)
{
if (grub_islower(c1))
{
c1 = c1 - 'a' + 'A';
}
if (grub_islower(c2))
{
c2 = c2 - 'a' + 'A';
}
}
if (c1 != c2) if (c1 != c2)
{ {
@ -1375,7 +1412,7 @@ static img_info * ventoy_get_min_iso(img_iterator_node *node)
while (img && (img_iterator_node *)(img->parent) == node) while (img && (img_iterator_node *)(img->parent) == node)
{ {
if (img->select == 0 && (NULL == minimg || grub_strcmp(img->name, minimg->name) < 0)) if (img->select == 0 && (NULL == minimg || ventoy_cmp_img(img, minimg) < 0))
{ {
minimg = img; minimg = img;
} }
@ -1397,7 +1434,7 @@ static img_iterator_node * ventoy_get_min_child(img_iterator_node *node)
while (child && child->parent == node) while (child && child->parent == node)
{ {
if (child->select == 0 && (NULL == Minchild || grub_strcmp(child->dir, Minchild->dir) < 0)) if (child->select == 0 && (NULL == Minchild || ventoy_cmp_subdir(child->dir, Minchild->dir) < 0))
{ {
Minchild = child; Minchild = child;
} }
@ -1631,6 +1668,12 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
g_filt_dot_underscore_file = 1; g_filt_dot_underscore_file = 1;
} }
strdata = ventoy_get_env("VTOY_SORT_CASE_SENSITIVE");
if (strdata && strdata[0] == '1' && strdata[1] == 0)
{
g_sort_case_sensitive = 1;
}
device_name = grub_file_get_device_name(args[0]); device_name = grub_file_get_device_name(args[0]);
if (!device_name) if (!device_name)
{ {
@ -1725,9 +1768,9 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
"}\n", "<--"); "}\n", "<--");
} }
default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");
if (g_default_menu_mode == 0) if (g_default_menu_mode == 0)
{ {
default_image = ventoy_get_env("VTOY_DEFAULT_IMAGE");
if (default_image) if (default_image)
{ {
img_len = grub_strlen(default_image); img_len = grub_strlen(default_image);

View File

@ -28,6 +28,7 @@
#define VTOY_FILT_MIN_FILE_SIZE 32768 #define VTOY_FILT_MIN_FILE_SIZE 32768
#define VTOY_SIZE_1GB 1073741824 #define VTOY_SIZE_1GB 1073741824
#define VTOY_SIZE_1MB (1024 * 1024)
#define VTOY_SIZE_512KB (512 * 1024) #define VTOY_SIZE_512KB (512 * 1024)
#define VTOY_SIZE_1KB 1024 #define VTOY_SIZE_1KB 1024
@ -788,7 +789,6 @@ extern grub_uint8_t g_ventoy_chain_type;
extern int g_vhdboot_enable; extern int g_vhdboot_enable;
extern ventoy_gpt_info *g_ventoy_part_info; extern ventoy_gpt_info *g_ventoy_part_info;
#define ventoy_unix_fill_virt(new_data, new_len) \ #define ventoy_unix_fill_virt(new_data, new_len) \
{ \ { \
data_secs = (new_len + 2047) / 2048; \ data_secs = (new_len + 2047) / 2048; \

View File

@ -49,6 +49,7 @@ static int g_vhdboot_bcd_len = 0;
static int g_vhdboot_isolen = 0; static int g_vhdboot_isolen = 0;
static char *g_vhdboot_totbuf = NULL; static char *g_vhdboot_totbuf = NULL;
static char *g_vhdboot_isobuf = NULL; static char *g_vhdboot_isobuf = NULL;
static grub_uint64_t g_img_trim_head_secnum = 0;
static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen) static int ventoy_vhd_find_bcd(int *bcdoffset, int *bcdlen)
{ {
@ -273,6 +274,71 @@ grub_err_t ventoy_cmd_load_vhdboot(grub_extcmd_context_t ctxt, int argc, char **
return 0; return 0;
} }
static int ventoy_raw_trim_head(grub_uint64_t offset)
{
grub_uint32_t i;
grub_uint32_t memsize;
grub_uint32_t imgstart = 0;
grub_uint32_t imgsecs = 0;
grub_uint64_t sectors = 0;
grub_uint64_t cursecs = 0;
grub_uint64_t delta = 0;
if ((!g_img_chunk_list.chunk) || (!offset))
{
debug("image chunk not ready %p %lu\n", g_img_chunk_list.chunk, (ulong)offset);
return 0;
}
debug("image trim head %lu\n", (ulong)offset);
for (i = 0; i < g_img_chunk_list.cur_chunk; i++)
{
cursecs = g_img_chunk_list.chunk[i].disk_end_sector + 1 - g_img_chunk_list.chunk[i].disk_start_sector;
sectors += cursecs;
if (sectors >= offset)
{
delta = cursecs - (sectors - offset);
break;
}
}
if (sectors < offset || i >= g_img_chunk_list.cur_chunk)
{
debug("Invalid size %lu %lu\n", (ulong)sectors, (ulong)offset);
return 0;
}
if (sectors == offset)
{
memsize = (g_img_chunk_list.cur_chunk - (i + 1)) * sizeof(ventoy_img_chunk);
grub_memmove(g_img_chunk_list.chunk, g_img_chunk_list.chunk + i + 1, memsize);
g_img_chunk_list.cur_chunk -= (i + 1);
}
else
{
g_img_chunk_list.chunk[i].disk_start_sector += delta;
g_img_chunk_list.chunk[i].img_start_sector += (grub_uint32_t)(delta / 4);
if (i > 0)
{
memsize = (g_img_chunk_list.cur_chunk - i) * sizeof(ventoy_img_chunk);
grub_memmove(g_img_chunk_list.chunk, g_img_chunk_list.chunk + i, memsize);
g_img_chunk_list.cur_chunk -= i;
}
}
for (i = 0; i < g_img_chunk_list.cur_chunk; i++)
{
imgsecs = g_img_chunk_list.chunk[i].img_end_sector + 1 - g_img_chunk_list.chunk[i].img_start_sector;
g_img_chunk_list.chunk[i].img_start_sector = imgstart;
g_img_chunk_list.chunk[i].img_end_sector = imgstart + (imgsecs - 1);
imgstart += imgsecs;
}
return 0;
}
grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args) grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int i; int i;
@ -281,11 +347,12 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
vhd_footer_t vhdfoot; vhd_footer_t vhdfoot;
VDIPREHEADER vdihdr; VDIPREHEADER vdihdr;
char type[16] = {0}; char type[16] = {0};
ventoy_mbr_head mbr;
ventoy_gpt_info *gpt; ventoy_gpt_info *gpt;
(void)ctxt; (void)ctxt;
g_img_trim_head_secnum = 0;
if (argc != 4) if (argc != 4)
{ {
return 0; return 0;
@ -316,6 +383,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0) grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0)
{ {
offset = 2 * 1048576; offset = 2 * 1048576;
g_img_trim_head_secnum = offset / 512;
grub_snprintf(type, sizeof(type), "vdi"); grub_snprintf(type, sizeof(type), "vdi");
} }
else else
@ -330,27 +398,30 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
if (offset >= 0) if (offset >= 0)
{ {
grub_file_seek(file, offset); gpt = grub_zalloc(sizeof(ventoy_gpt_info));
grub_file_read(file, &mbr, sizeof(mbr)); if (!gpt)
if (mbr.Byte55 != 0x55 || mbr.ByteAA != 0xAA)
{ {
grub_env_set(args[1], "unknown"); grub_env_set(args[1], "unknown");
debug("invalid mbr signature: 0x%x 0x%x\n", mbr.Byte55, mbr.ByteAA);
goto end; goto end;
} }
if (mbr.PartTbl[0].FsFlag == 0xEE) grub_file_seek(file, offset);
grub_file_read(file, gpt, sizeof(ventoy_gpt_info));
if (gpt->MBR.Byte55 != 0x55 || gpt->MBR.ByteAA != 0xAA)
{
grub_env_set(args[1], "unknown");
debug("invalid mbr signature: 0x%x 0x%x\n", gpt->MBR.Byte55, gpt->MBR.ByteAA);
goto end;
}
if (grub_memcmp(gpt->Head.Signature, "EFI PART", 8) == 0)
{ {
grub_env_set(args[2], "gpt"); grub_env_set(args[2], "gpt");
debug("part type: %s\n", "GPT"); debug("part type: %s\n", "GPT");
gpt = grub_zalloc(sizeof(ventoy_gpt_info)); if (gpt->MBR.PartTbl[0].FsFlag == 0xEE)
if (gpt)
{ {
grub_file_seek(file, offset);
grub_file_read(file, gpt, sizeof(ventoy_gpt_info));
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
if (grub_memcmp(gpt->PartTbl[i].PartType, "Hah!IdontNeedEFI", 16) == 0) if (grub_memcmp(gpt->PartTbl[i].PartType, "Hah!IdontNeedEFI", 16) == 0)
@ -364,14 +435,22 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
break; break;
} }
} }
grub_free(gpt);
} }
} }
else else
{ {
grub_env_set(args[2], "mbr"); grub_env_set(args[2], "mbr");
debug("part type: %s\n", "MBR"); debug("part type: %s\n", "MBR");
for (i = 0; i < 4; i++)
{
if (gpt->MBR.PartTbl[i].FsFlag == 0xEF)
{
debug("part %d is esp part in MBR mode\n", i);
grub_env_set(args[3], "1");
break;
}
}
} }
} }
else else
@ -380,6 +459,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
} }
end: end:
grub_check_free(gpt);
grub_file_close(file); grub_file_close(file);
VENTOY_CMD_RETURN(GRUB_ERR_NONE); VENTOY_CMD_RETURN(GRUB_ERR_NONE);
} }
@ -403,6 +483,11 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
return 1; return 1;
} }
if (g_img_trim_head_secnum > 0)
{
ventoy_raw_trim_head(g_img_trim_head_secnum);
}
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]); file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
if (!file) if (!file)
{ {
@ -450,8 +535,14 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
disk = file->device->disk; disk = file->device->disk;
chain->disk_drive = disk->id; chain->disk_drive = disk->id;
chain->disk_sector_size = (1 << disk->log_sector_size); chain->disk_sector_size = (1 << disk->log_sector_size);
chain->real_img_size_in_bytes = file->size; chain->real_img_size_in_bytes = file->size;
chain->virt_img_size_in_bytes = (file->size + 2047) / 2048 * 2048; if (g_img_trim_head_secnum > 0)
{
chain->real_img_size_in_bytes -= g_img_trim_head_secnum * 512;
}
chain->virt_img_size_in_bytes = chain->real_img_size_in_bytes;
chain->boot_catalog = 0; chain->boot_catalog = 0;
/* part 3: image chunk */ /* part 3: image chunk */
@ -459,7 +550,7 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
chain->img_chunk_num = g_img_chunk_list.cur_chunk; chain->img_chunk_num = g_img_chunk_list.cur_chunk;
grub_memcpy((char *)chain + chain->img_chunk_offset, g_img_chunk_list.chunk, img_chunk_size); grub_memcpy((char *)chain + chain->img_chunk_offset, g_img_chunk_list.chunk, img_chunk_size);
grub_file_seek(file, 0); grub_file_seek(file, g_img_trim_head_secnum * 512);
grub_file_read(file, chain->boot_catalog_sector, 512); grub_file_read(file, chain->boot_catalog_sector, 512);
grub_file_close(file); grub_file_close(file);

Binary file not shown.

View File

@ -477,6 +477,7 @@ function uefi_linux_menu_func {
distro_specify_initrd_file distro_specify_initrd_file
vt_linux_initrd_count vtcount vt_linux_initrd_count vtcount
if [ $vtcount -eq 0 ]; then if [ $vtcount -eq 0 ]; then
distro_specify_initrd_file_phase2 distro_specify_initrd_file_phase2
@ -991,26 +992,28 @@ function vhd_unsupport_menuentry {
} }
function vtoyboot_common_func { function vtoyboot_common_func {
set efigrubpart=0 set AltBootPart=0
set vtoysupport=0 set vtoysupport=0
vt_get_vtoy_type ${1} vtoytype parttype efigrubpart vt_get_vtoy_type ${1} vtoytype parttype AltBootPart
if vt_str_begin $vtoytype vhd; then if vt_str_begin $vtoytype vhd; then
set vtoysupport=1 set vtoysupport=1
elif [ "$vtoytype" = "raw" ]; then elif [ "$vtoytype" = "raw" ]; then
set vtoysupport=1 set vtoysupport=1
elif [ "$vtoytype" = "vdi" ]; then
set vtoysupport=1
fi fi
if [ $vtoysupport -eq 1 ]; then if [ $vtoysupport -eq 1 ]; then
if [ "$grub_platform" = "pc" ]; then if [ "$grub_platform" = "pc" ]; then
if [ "$parttype" = "gpt" -a $efigrubpart -eq 0 ]; then if [ "$parttype" = "gpt" -a $AltBootPart -eq 0 ]; then
echo "The OS in the vdisk was created in UEFI mode, but current is Legacy BIOS mode." echo "The OS in the vdisk was created in UEFI mode, but current is Legacy BIOS mode."
echo "虚拟磁盘内的系统是在UEFI模式下创建的而当前系统是Legacy BIOS模式可能无法正常启动。" echo "虚拟磁盘内的系统是在UEFI模式下创建的而当前系统是Legacy BIOS模式可能无法正常启动。"
ventoy_pause ventoy_pause
fi fi
else else
if [ "$parttype" = "mbr" ]; then if [ "$parttype" = "mbr" -a $AltBootPart -eq 0 ]; then
echo "The OS in the vdisk was created in Legacy BIOS mode, but current is UEFI mode." echo "The OS in the vdisk was created in Legacy BIOS mode, but current is UEFI mode."
echo "虚拟磁盘内的系统是在Legacy BIOS模式下创建的而当前系统是UEFI模式可能无法正常启动。" echo "虚拟磁盘内的系统是在Legacy BIOS模式下创建的而当前系统是UEFI模式可能无法正常启动。"
ventoy_pause ventoy_pause
@ -1321,7 +1324,7 @@ function img_unsupport_menuentry {
############################################################# #############################################################
############################################################# #############################################################
set VENTOY_VERSION="1.0.21" set VENTOY_VERSION="1.0.22"
# Default menu display mode, you can change it as you want. # Default menu display mode, you can change it as you want.
# 0: List mode # 0: List mode

Binary file not shown.

View File

@ -17,6 +17,7 @@ print_usage() {
echo '' echo ''
} }
RESERVE_SIZE_MB=0 RESERVE_SIZE_MB=0
while [ -n "$1" ]; do while [ -n "$1" ]; do
if [ "$1" = "-i" ]; then if [ "$1" = "-i" ]; then
@ -75,6 +76,7 @@ if [ -n "$RESERVE_SPACE" ]; then
fi fi
fi fi
#check access
if dd if="$DISK" of=/dev/null bs=1 count=1 >/dev/null 2>&1; then if dd if="$DISK" of=/dev/null bs=1 count=1 >/dev/null 2>&1; then
vtdebug "root permission check ok ..." vtdebug "root permission check ok ..."
else else
@ -85,34 +87,33 @@ fi
vtdebug "MODE=$MODE FORCE=$FORCE RESERVE_SPACE=$RESERVE_SPACE RESERVE_SIZE_MB=$RESERVE_SIZE_MB" vtdebug "MODE=$MODE FORCE=$FORCE RESERVE_SPACE=$RESERVE_SPACE RESERVE_SIZE_MB=$RESERVE_SIZE_MB"
if ! check_tool_work_ok; then #check tools
if check_tool_work_ok; then
vtdebug "check tool work ok"
else
vterr "Some tools can not run in current system. Please check log.txt for detail." vterr "Some tools can not run in current system. Please check log.txt for detail."
exit 1 exit 1
fi fi
#check mountpoint
grep "^$DISK" /proc/mounts | while read mtline; do grep "^$DISK" /proc/mounts | while read mtline; do
mtpnt=$(echo $mtline | awk '{print $2}') mtpnt=$(echo $mtline | awk '{print $2}')
vtdebug "Trying to umount $mtpnt ..." vtdebug "Trying to umount $mtpnt ..."
umount $mtpnt >/dev/null 2>&1 umount $mtpnt >/dev/null 2>&1
done done
if swapon -s | grep -q "^${DISK}[0-9]"; then
swapon -s | grep "^${DISK}[0-9]" | awk '{print $1}' | while read line; do
vtdebug "Trying to swapoff $line ..."
swapoff $line
done
fi
if grep "$DISK" /proc/mounts; then if grep "$DISK" /proc/mounts; then
vterr "$DISK is already mounted, please umount it first!" vterr "$DISK is already mounted, please umount it first!"
exit 1 exit 1
fi fi
#check swap partition
if swapon --help 2>&1 | grep -q '^ \-s,'; then
if swapon -s | grep -q "^${DISK}[0-9]"; then if swapon -s | grep -q "^${DISK}[0-9]"; then
vterr "$DISK is used as swap, please swapoff it first!" vterr "$DISK is used as swap, please swapoff it first!"
exit 1 exit 1
fi fi
fi
if [ "$MODE" = "install" ]; then if [ "$MODE" = "install" ]; then
@ -122,7 +123,8 @@ if [ "$MODE" = "install" ]; then
if parted -v > /dev/null 2>&1; then if parted -v > /dev/null 2>&1; then
PARTTOOL='parted' PARTTOOL='parted'
else else
vterr "parted is not found in the system, Ventoy can't create new partition." vterr "parted is not found in the system, Ventoy can't create new partitions without it."
vterr "You should install \"GNU parted\" first."
exit 1 exit 1
fi fi
else else
@ -131,7 +133,7 @@ if [ "$MODE" = "install" ]; then
elif fdisk -v >/dev/null 2>&1; then elif fdisk -v >/dev/null 2>&1; then
PARTTOOL='fdisk' PARTTOOL='fdisk'
else else
vterr "Both parted and fdisk are not found in the system, Ventoy can't create new partition." vterr "Both parted and fdisk are not found in the system, Ventoy can't create new partitions."
exit 1 exit 1
fi fi
fi fi
@ -202,7 +204,6 @@ if [ "$MODE" = "install" ]; then
fi fi
fi fi
if [ $disk_sector_num -le $VENTOY_SECTOR_NUM ]; then if [ $disk_sector_num -le $VENTOY_SECTOR_NUM ]; then
vterr "No enough space in disk $DISK" vterr "No enough space in disk $DISK"
exit 1 exit 1
@ -251,13 +252,13 @@ if [ "$MODE" = "install" ]; then
if [ -n "$VTGPT" ]; then if [ -n "$VTGPT" ]; then
echo -en '\x22' | dd status=none of=$DISK conv=fsync bs=1 count=1 seek=92 echo -en '\x22' | dd status=none of=$DISK conv=fsync bs=1 count=1 seek=92
./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34 xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34
echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none
else else
./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1 xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
fi fi
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector
#disk uuid #disk uuid
./tool/vtoy_gen_uuid | dd status=none conv=fsync of=${DISK} seek=384 bs=1 count=16 ./tool/vtoy_gen_uuid | dd status=none conv=fsync of=${DISK} seek=384 bs=1 count=16
@ -339,7 +340,7 @@ else
if [ "$PART1_TYPE" = "EE" ]; then if [ "$PART1_TYPE" = "EE" ]; then
vtdebug "This is GPT partition style ..." vtdebug "This is GPT partition style ..."
./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34 xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34
echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none
else else
vtdebug "This is MBR partition style ..." vtdebug "This is MBR partition style ..."
@ -354,10 +355,10 @@ else
echo -en '\x80' | dd of=$DISK conv=fsync bs=1 count=1 seek=446 status=none echo -en '\x80' | dd of=$DISK conv=fsync bs=1 count=1 seek=446 status=none
echo -en '\x00' | dd of=$DISK conv=fsync bs=1 count=1 seek=462 status=none echo -en '\x00' | dd of=$DISK conv=fsync bs=1 count=1 seek=462 status=none
fi fi
./tool/xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1 xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
fi fi
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
sync sync

View File

@ -52,7 +52,7 @@ check_tool_work_ok() {
vtoyfat=vtoyfat_32 vtoyfat=vtoyfat_32
fi fi
if echo 1 | ./tool/hexdump > /dev/null; then if echo 1 | hexdump > /dev/null; then
vtdebug "hexdump test ok ..." vtdebug "hexdump test ok ..."
else else
vtdebug "hexdump test fail ..." vtdebug "hexdump test fail ..."
@ -88,6 +88,8 @@ get_disk_part_name() {
echo ${DISK}p${2} echo ${DISK}p${2}
elif echo $DISK | grep -q "/dev/nvme[0-9][0-9]*n[0-9]"; then elif echo $DISK | grep -q "/dev/nvme[0-9][0-9]*n[0-9]"; then
echo ${DISK}p${2} echo ${DISK}p${2}
elif echo $DISK | grep -q "/dev/mmcblk[0-9]"; then
echo ${DISK}p${2}
else else
echo ${DISK}${2} echo ${DISK}${2}
fi fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.