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
72f5710b
Commit
72f5710b
authored
May 12, 2024
by
longpanda
Browse files
Fix arch iso boot issue (#2825 #2824)
parent
ee7da60d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
IMG/cpio/ventoy/init_chain
IMG/cpio/ventoy/init_chain
+33
-2
No files found.
IMG/cpio/ventoy/init_chain
View file @
72f5710b
...
...
@@ -112,6 +112,28 @@ ventoy_unpack_initrd() {
done
}
vtfile_head_zero
()
{
local
vsize
local
voffset
local
vfile
local
vzero
local
vdump
voffset
=
0
vfile
=
$1
vsize
=
$(
stat
-c
'%s'
${
vfile
}
)
vzero
=
$(
hexdump
-n
512
-e
'512/1 "%02X"'
$vfile
)
while
[
$voffset
-lt
$vsize
]
;
do
vdump
=
$(
hexdump
-s
$voffset
-n
512
-e
'512/1 "%02X"'
$vfile
)
if
[
"
$vdump
"
!=
"
$vzero
"
]
;
then
echo
$voffset
return
fi
voffset
=
$(
$BUSYBOX_PATH
/expr
$voffset
+ 512
)
done
echo
0
}
# This export is for busybox cpio command
export
EXTRACT_UNSAFE_SYMLINKS
=
1
...
...
@@ -131,13 +153,22 @@ for vtfile in $(ls /initrd*); do
#only for cpio,cpio,...,initrd sequence, initrd,cpio or initrd,initrd sequence is not supported
while
[
-e
${
vtfile
}
_tmp
]
&&
[
$(
stat
-c
'%s'
${
vtfile
}
_tmp
)
-gt
512
]
;
do
mv
${
vtfile
}
_tmp
$vtfile
vtdump
=
$(
hexdump
-n
512
-e
'512/1 "%02X"'
$vtfile
)
vtmagic
=
$(
echo
$vtdump
|
sed
's/^\(00\)*//'
)
let
vtoffset
=
"(
${#
vtdump
}
-
${#
vtmagic
}
)/2"
if
[
-z
"
$vtmagic
"
]
;
then
echo
"terminate with all zero data file"
>>
$VTLOG
break
vtHeadZero
=
$(
vtfile_head_zero
$vtfile
)
if
[
$vtHeadZero
-gt
0
]
;
then
vtdump
=
$(
hexdump
-s
$vtHeadZero
-n
512
-e
'512/1 "%02X"'
$vtfile
)
vtmagic
=
$(
echo
$vtdump
|
sed
's/^\(00\)*//'
)
let
vtoffset
=
"(
${#
vtdump
}
-
${#
vtmagic
}
)/2+
$vtHeadZero
"
echo
"skip head
$vtHeadZero
zeros with magic
${
vtmagic
:0:4
}
"
>>
$VTLOG
else
echo
"terminate with all zero data file"
>>
$VTLOG
break
fi
fi
ventoy_unpack_initramfs
$vtfile
$vtoffset
${
vtmagic
:0:4
}
${
vtfile
}
_tmp
...
...
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