1
0
mirror of https://github.com/dockur/windows.git synced 2026-07-27 21:42:36 +07:00

fix: Legacy ISO boot load size (#1971)

This commit is contained in:
Kroese
2026-07-26 00:10:41 +02:00
committed by GitHub
parent 4e35ead612
commit 605f31af72
2 changed files with 136 additions and 74 deletions
+136
View File
@@ -952,6 +952,142 @@ EOF
return 0
}
buildImage() {
local dir="$1"
local failed=""
local cat="BOOT.CAT"
local log="/run/shm/iso.log"
local base size desc
if [ -f "$BOOT" ]; then
error "File $BOOT does already exist?!" && return 1
fi
base=$(basename "$BOOT")
local out="$TMP/${base%.*}.tmp"
rm -f "$out"
desc=$(printVariant "$DETECTED" "ISO")
local msg="Building $desc image"
info "$msg..." && html "$msg..."
[ -z "$LABEL" ] && LABEL="Windows"
if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then
error "Failed to locate file \"$ETFS\" in ISO image!" && return 1
fi
size=$(du -b --max-depth=0 "$dir" | cut -f1)
checkFreeSpace "$TMP" "$size" || return 1
/run/progress.sh "$out" "$size" "$msg ([P])..." &
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
genisoimage \
-o "$out" \
-b "$ETFS" \
-no-emul-boot \
-c "$cat" \
-iso-level 4 \
-J \
-l \
-D \
-N \
-joliet-long \
-relaxed-filenames \
-V "${LABEL::30}" \
-udf \
-boot-info-table \
-eltorito-alt-boot \
-eltorito-boot "$EFISYS" \
-no-emul-boot \
-allow-limited-size \
-quiet \
"$dir" 2> "$log" || failed="y"
else
case "${DETECTED,,}" in
"win2k"* | "winxp"* | "win2003"* )
genisoimage \
-o "$out" \
-b "$ETFS" \
-no-emul-boot \
-boot-load-seg 1984 \
-boot-load-size 4 \
-c "$cat" \
-iso-level 2 \
-J \
-l \
-D \
-N \
-joliet-long \
-relaxed-filenames \
-V "${LABEL::30}" \
-quiet \
"$dir" 2> "$log" || failed="y"
;;
"win9"* )
genisoimage \
-o "$out" \
-b "$ETFS" \
-J \
-r \
-V "${LABEL::30}" \
-quiet \
"$dir" 2> "$log" || failed="y"
;;
* )
genisoimage \
-o "$out" \
-b "$ETFS" \
-no-emul-boot \
-boot-load-size 4 \
-c "$cat" \
-iso-level 2 \
-J \
-l \
-D \
-N \
-joliet-long \
-relaxed-filenames \
-V "${LABEL::30}" \
-udf \
-allow-limited-size \
-quiet \
"$dir" 2> "$log" || failed="y"
;;
esac
fi
fKill "progress.sh"
if [ -n "$failed" ]; then
[ -s "$log" ] && echo "$(<"$log")"
error "Failed to build image!" && return 1
fi
local err=""
local hide="Warning: creating filesystem that does not conform to ISO-9660."
[ -s "$log" ] && err="$(<"$log")"
[[ "$err" != "$hide" ]] && echo "$err"
mv -f "$out" "$BOOT" || return 1
if ! setOwner "$BOOT"; then
warn "Failed to set the owner for \"$BOOT\" !"
fi
return 0
}
extractBootImage() {
local iso="$1"
-74
View File
@@ -1114,80 +1114,6 @@ removeImage() {
return 0
}
buildImage() {
local dir="$1"
local failed=""
local cat="BOOT.CAT"
local log="/run/shm/iso.log"
local base size desc
if [ -f "$BOOT" ]; then
error "File $BOOT does already exist?!" && return 1
fi
base=$(basename "$BOOT")
local out="$TMP/${base%.*}.tmp"
rm -f "$out"
desc=$(printVariant "$DETECTED" "ISO")
local msg="Building $desc image"
info "$msg..." && html "$msg..."
[ -z "$LABEL" ] && LABEL="Windows"
if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then
error "Failed to locate file \"$ETFS\" in ISO image!" && return 1
fi
size=$(du -b --max-depth=0 "$dir" | cut -f1)
checkFreeSpace "$TMP" "$size" || return 1
/run/progress.sh "$out" "$size" "$msg ([P])..." &
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -V "${LABEL::30}" \
-udf -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -allow-limited-size -quiet "$dir" 2> "$log" || failed="y"
else
case "${DETECTED,,}" in
"win2k"* | "winxp"* | "win2003"* )
genisoimage -o "$out" -b "$ETFS" -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -c "$cat" -iso-level 2 -J -l -D -N -joliet-long \
-relaxed-filenames -V "${LABEL::30}" -quiet "$dir" 2> "$log" || failed="y" ;;
"win9"* )
genisoimage -o "$out" -b "$ETFS" -J -r -V "${LABEL::30}" -quiet "$dir" 2> "$log" || failed="y" ;;
* )
genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames -V "${LABEL::30}" \
-udf -allow-limited-size -quiet "$dir" 2> "$log" || failed="y" ;;
esac
fi
fKill "progress.sh"
if [ -n "$failed" ]; then
[ -s "$log" ] && echo "$(<"$log")"
error "Failed to build image!" && return 1
fi
local err=""
local hide="Warning: creating filesystem that does not conform to ISO-9660."
[ -s "$log" ] && err="$(<"$log")"
[[ "$err" != "$hide" ]] && echo "$err"
mv -f "$out" "$BOOT" || return 1
if ! setOwner "$BOOT"; then
warn "Failed to set the owner for \"$BOOT\" !"
fi
return 0
}
bootWindows() {
ARGS=$(readState "$STORAGE/windows.args") || return 1