vbox6: force C/H/S disk geometry from calculation

Some Ubuntu installations (e.g., 20.04) create installation disks with
strange C/H/S MBR partitions like 3988/255/2. Normally, VirtualBox reads
the MBR to guess disk geometry information for the virtual BIOS.
Unfortuantely, the strange values from Ubuntu lead to a heavy
virtual-disk activity on boot. Therefore, this commit forces the use of
calculated values based on the assumption that large disks use LBA
addressing anyway.

Fixes #4978
This commit is contained in:
Christian Helmuth 2023-08-08 12:35:57 +02:00
parent 9e41848927
commit 65d9607ece
3 changed files with 25 additions and 1 deletions

View File

@ -1 +1 @@
f5ebf8e03d4b29d3c186212bdc2d324bb31c5274
d57e9deed61e070270fa153e610e3081f996ee24

View File

@ -0,0 +1,23 @@
--- a/src/virtualbox6/src/VBox/Devices/PC/DevPcBios.cpp.orig
+++ b/src/virtualbox6/src/VBox/Devices/PC/DevPcBios.cpp
@@ -604,6 +604,7 @@
RT_NOREF1(pBase);
PDMMEDIAGEOMETRY LCHSGeometry;
+#if 0 /* Genode */
int rc = pHardDisk->pfnBiosGetLCHSGeometry(pHardDisk, &LCHSGeometry);
if ( rc == VERR_PDM_GEOMETRY_NOT_SET
|| LCHSGeometry.cCylinders == 0
@@ -627,6 +628,12 @@
|| LCHSGeometry.cSectors == 0
|| LCHSGeometry.cSectors > 63)
{
+#else
+ /* always calculate geometry */
+ int rc = VINF_SUCCESS;
+ {
+ {
+#endif /* Genode */
uint64_t cSectors = pHardDisk->pfnGetSize(pHardDisk) / 512;
if (cSectors / 16 / 63 <= 1024)
{

View File

@ -12,3 +12,4 @@ audio.patch
gcc-12.patch
pgmphys.patch
sup_ioctl_query_func_size.patch
disk_geometry.patch