]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - INSTALL/tool/ventoy_lib.sh
1.0.23 release
[Ventoy.git] / INSTALL / tool / ventoy_lib.sh
index 9e4d45d887f752ac79e0ac4f19a6c939a4647ae8..f72d3fe74074cc0231de6ac2edeccf3c67e138e2 100644 (file)
@@ -52,7 +52,7 @@ check_tool_work_ok() {
         vtoyfat=vtoyfat_32
     fi
     
-    if echo 1 | ./tool/hexdump > /dev/null; then
+    if echo 1 | hexdump > /dev/null; then
         vtdebug "hexdump test ok ..."
     else
         vtdebug "hexdump test fail ..."
@@ -88,6 +88,8 @@ get_disk_part_name() {
         echo ${DISK}p${2}
     elif echo $DISK | grep -q "/dev/nvme[0-9][0-9]*n[0-9]"; then
         echo ${DISK}p${2}
+    elif echo $DISK | grep -q "/dev/mmcblk[0-9]"; then
+        echo ${DISK}p${2}
     else
         echo ${DISK}${2}
     fi
@@ -129,13 +131,13 @@ is_disk_contains_ventoy() {
     PART1_TYPE=$(dd if=$DISK bs=1 count=1 skip=450 status=none | ./tool/hexdump -n1 -e  '1/1 "%02X"')
     PART2_TYPE=$(dd if=$DISK bs=1 count=1 skip=466 status=none | ./tool/hexdump -n1 -e  '1/1 "%02X"')
     
-    if [ "$PART1_TYPE" != "EE" ]; then
-        if [ "$PART2_TYPE" != "EF" ]; then
-            vtdebug "part2 type is $PART2_TYPE not EF"
-            ventoy_false
-            return
-        fi
-    fi
+    if [ "$PART1_TYPE" != "EE" ]; then
+        if [ "$PART2_TYPE" != "EF" ]; then
+            vtdebug "part2 type is $PART2_TYPE not EF"
+            ventoy_false
+            return
+        fi
+    fi
     
     # PART1_TYPE=$(dd if=$DISK bs=1 count=1 skip=450 status=none | ./tool/hexdump -n1 -e  '1/1 "%02X"')
     # if [ "$PART1_TYPE" != "07" ]; then
@@ -345,11 +347,19 @@ format_ventoy_disk_gpt() {
         unit s \
         mkpart Ventoy ntfs $part1_start_sector $part1_end_sector \
         mkpart VTOYEFI fat16 $part2_start_sector $part2_end_sector \
-        set 2 boot on \
-        set 2 esp on \
+        set 2 msftdata on \
         set 2 hidden on \
         quit
+        
+    sync
+    
+    if ventoy_is_linux64; then
+        vtoygpt=./tool/vtoygpt_64
+    else
+        vtoygpt=./tool/vtoygpt_32
+    fi
 
+    $vtoygpt -f $DISK
     sync
 
     udevadm trigger >/dev/null 2>&1