- A single fix to hdimage when using older versions of mtools

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmF/tr8ACgkQEsHwGGHe
 VUq+DA//eiUyNSOWaKQKO7NvRZ8p3qcqJ3FI8wbTBbEzq94R9BP+duS9KtYbc4H9
 40aD7pFkzBP0mqcF3zshV4XjF3Vt1RS6RvSO4sANULZ9jmPPmpvXu38f15LbRoJL
 NfBVtoruiRjPAL+xnrSu780XDR0cwb7Smpp9yL9TQAx2sRYWGP90wkpiYv0ATFaH
 zdblmihu37l2MdWzIqOZEZTOOtXCVXDQjV66OqDtUJe4ud3L5yr31Yu+34dMEXKh
 W2rnzQUe5tdUnF3So8slxGLU3JUcb+9PTydCipi4Kt4ycD1gA/dvACuT2ZBu4me/
 vGjU7rgZmqgmojWeSMDCaeHyEnzH66n4tf74Oom2/PxaPKWzHArhzWwxlDrqyf1H
 Xu2qXTvrCmeeLxuj9pzVMIRFi5+lzs7hlhAottASHuDvxxlxCjGYsChVOOzpWbZq
 tSwrwT4SU18b5xxw4zM+5BcdtpLQnM4KFI+3iL/N8zEgpFw1eJgzDzFzXQV3/17D
 8ADw1Lt2snmCaRlelWbtF31yxpdqqZ/cRSQkqZhmXVAjY88TknmIaS55ykozsXa5
 E2THrKkj8ZfOIdbYNu14D3YlQuv/pNk0TR/I7zYQ3teV1ax43TWiKd8Nkq1oa03s
 flHYGW/o9rVHl+CALkVi0gpUzAmeSnvDHrKZ78374wvx2pW9b1A=
 =GBar
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2021-11-01 15:14:20 -07:00
commit 57f45de791
2 changed files with 11 additions and 9 deletions

View File

@ -120,12 +120,13 @@ efiarch() {
}
# Get the combined sizes in bytes of the files given, counting sparse
# files as full length, and padding each file to a 4K block size
# files as full length, and padding each file to cluster size
cluster=16384
filesizes() {
local t=0
local s
for s in $(ls -lnL "$@" 2>/dev/null | awk '/^-/{ print $5; }'); do
t=$((t + ((s+4095)/4096)*4096))
t=$((t + ((s+cluster-1)/cluster)*cluster))
done
echo $t
}
@ -230,14 +231,14 @@ genhdimage() {
ptype='-T 0xef' # EFI system partition, no GPT
fi
sizes=$(filesizes "$FBZIMAGE" "${FDINITRDS[@]}" "$efishell")
# Allow 1% + 1 MiB for filesystem and partition table overhead,
# syslinux, and config files
# Allow 1% + 2 MiB for filesystem and partition table overhead,
# syslinux, and config files; this is probably excessive...
megs=$(((sizes + sizes/100 + 2*1024*1024 - 1)/(1024*1024)))
$dd if=/dev/zero of="$FIMAGE" bs=$((1024*1024)) count=$megs 2>/dev/null
mpartition -I -c -s 32 -h 64 -t $megs $ptype -b 512 -a h:
mpartition -I -c -s 32 -h 64 $ptype -b 64 -a p:
$dd if="$mbr" of="$FIMAGE" bs=440 count=1 conv=notrunc 2>/dev/null
mformat -v 'LINUX_BOOT' -s 32 -h 64 -t $megs h:
syslinux --offset $((512*512)) "$FIMAGE"
mformat -v 'LINUX_BOOT' -s 32 -h 64 -c $((cluster/512)) -t $megs h:
syslinux --offset $((64*512)) "$FIMAGE"
do_mcopy h:
}

View File

@ -14,7 +14,8 @@ drive v:
drive w:
file="@OBJ@/fdimage" cylinders=80 heads=2 sectors=36 filter
# Hard disk
# Hard disk (h: for the filesystem, p: for format - old mtools bug?)
drive h:
file="@OBJ@/hdimage" offset=32768 mformat_only
drive p:
file="@OBJ@/hdimage" partition=1 mformat_only