Skip to content

Commit 57f45de

Browse files
committed
Merge tag 'x86_build_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 build fix from Borislav Petkov: - A single fix to hdimage when using older versions of mtools * tag 'x86_build_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot: Fix make hdimage with older versions of mtools
2 parents 158405e + 067595d commit 57f45de

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

arch/x86/boot/genimage.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,13 @@ efiarch() {
120120
}
121121

122122
# Get the combined sizes in bytes of the files given, counting sparse
123-
# files as full length, and padding each file to a 4K block size
123+
# files as full length, and padding each file to cluster size
124+
cluster=16384
124125
filesizes() {
125126
local t=0
126127
local s
127128
for s in $(ls -lnL "$@" 2>/dev/null | awk '/^-/{ print $5; }'); do
128-
t=$((t + ((s+4095)/4096)*4096))
129+
t=$((t + ((s+cluster-1)/cluster)*cluster))
129130
done
130131
echo $t
131132
}
@@ -230,14 +231,14 @@ genhdimage() {
230231
ptype='-T 0xef' # EFI system partition, no GPT
231232
fi
232233
sizes=$(filesizes "$FBZIMAGE" "${FDINITRDS[@]}" "$efishell")
233-
# Allow 1% + 1 MiB for filesystem and partition table overhead,
234-
# syslinux, and config files
234+
# Allow 1% + 2 MiB for filesystem and partition table overhead,
235+
# syslinux, and config files; this is probably excessive...
235236
megs=$(((sizes + sizes/100 + 2*1024*1024 - 1)/(1024*1024)))
236237
$dd if=/dev/zero of="$FIMAGE" bs=$((1024*1024)) count=$megs 2>/dev/null
237-
mpartition -I -c -s 32 -h 64 -t $megs $ptype -b 512 -a h:
238+
mpartition -I -c -s 32 -h 64 $ptype -b 64 -a p:
238239
$dd if="$mbr" of="$FIMAGE" bs=440 count=1 conv=notrunc 2>/dev/null
239-
mformat -v 'LINUX_BOOT' -s 32 -h 64 -t $megs h:
240-
syslinux --offset $((512*512)) "$FIMAGE"
240+
mformat -v 'LINUX_BOOT' -s 32 -h 64 -c $((cluster/512)) -t $megs h:
241+
syslinux --offset $((64*512)) "$FIMAGE"
241242
do_mcopy h:
242243
}
243244

arch/x86/boot/mtools.conf.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ drive v:
1414
drive w:
1515
file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter
1616

17-
# Hard disk
17+
# Hard disk (h: for the filesystem, p: for format - old mtools bug?)
1818
drive h:
19+
file="@OBJ@/hdimage" offset=32768 mformat_only
20+
drive p:
1921
file="@OBJ@/hdimage" partition=1 mformat_only
20-

0 commit comments

Comments
 (0)