I previously posted about a problem with my Sylvania G netbook (original model GNET13001 with a VIA C7-M CPU, not the Meso) that I recently upgraded to a 32GB KingSpec 1.8″ ZIF SSD, where it would boot Windows XP just fine, but a Windows 7 installation on the same hard drive would do something extremely unusual: the system would not only fail to boot Windows 7, but the BIOS would not even load and execute the MBR at all, skipping the hard drive ENTIRELY in the boot order.
I figured this out late last night, powered by coffee, Doritos, and forum posts to distract me periodically. The major difference between XP and Windows 7 is the partitioning and MBR code, and the Windows 7 MBR code boots up Windows XP just fine, leaving partition tables as the most likely culprit. I modified the MBR assembly code to output a message indicating that the MBR was loaded and executed, and then halt the system. This way I would be certain that the MBR was executing at all and wouldn’t wonder if the code was somehow tripping over something that caused it to kick right back out. With a partition spanning the full disk, my message showed up. That was expected; XP worked fine, and the partition table was set up in the same fashion that it was under XP. Then, to test and see if we had some sort of issue relating to the cylinder/head/sector geometry values in the raw partition table data, I tweaked the values in the table to be slightly different, and saw no change. Then, to see if we were dealing with a problem with the starting sector for partition 1 being 2048 under Windows 7 instead of 63 under XP, I gradually bumped the partition entry up; first to 64, then 100, 200, 400, 1000, 2000, 2047, and 2048. None of these partition starting sectors caused the boot process to fail. Then, I started trimming the ending of the partition. From 31.6GB to 15GB, then to 4GB. No change, it still tried to boot.
I changed the ending cylinder from near 1000 all the way down to 100 and it stopped booting. YES!
From there, it was simply some intelligent logical bisection of the numbers: 200 failed, but 400 worked. Since 256 is 2^8 (powers of two being very significant) I tried 250, 255, and 256, which also failed. A greater jump straight to 300 passed, though; it was at that point that I realized I was dancing around another important number in terms of computer memory: 2,097,152 KB (4,194,304 512-byte sectors) which is also a power of 2, and happened to be right between the sector counts of 256 and 300 cylinders (these equations are in C/H/S format, and I’m ignoring the first 2048 or so skipped sectors just to annoy you):
256*255*63 = 4,112,640 sectors
300*255*63 = 4,819,500 sectors
With this new information, I changed over to LBA (sector) entry instead, and made the TOTAL number of sectors in this partition 4,194,303. It failed to boot.
When I set the total number of sectors in the first partition to 4,194,304 sectors (exactly 2GB), the Sylvania G loaded and executed the MBR normally, where just one sector less would cause the entire hard drive to be skipped in the boot order.
This effectively means that a stock Windows 7 can never boot on this system without major trickery. I consider this a very severe and stupid BIOS bug. What I don’t understand is how it is possible that this check even exists in the first place. (Edit 2017-03-12: I realized it could be for skipping a small “utility partition” like older laptops do, but that’s what the partition table ACTIVE flag is used for already.) The computer would have to read the MBR from the hard drive into memory and intentionally check the first partition’s size for a minimum amount to make this bug happen, so someone either at VIA, Phoenix (it’s a Phoenix BIOS), or Sylvania (Digital Gadgets, Inc.) had to go out of their way to put this bug into place. Worse yet, there are absolutely no BIOS updates in existence for the Sylvania G, and never will be, so this bug is permanent. Fortunately, if your first partition is larger than 2GB in size, you can blissfully ignore this problem, which means that Linux installations using a compatible partitioning scheme, Windows XP, and Windows Vista all should run on the Sylvania G without hitting this problem at all. Windows 7 is effectively not an option, though. In the next few days, I plan to attempt to overcome this bug and get Windows 7 working on the Sylvania G anyway, as a personal challenge if nothing else.
I am left to ponder what other systems might be having this same issue. The BIOS has no business whatsoever attempting to “verify” my partition table of choice, in my opinion, and I want to know at what point and for what purpose this bug/misfeature was introduced. If anyone has a system that seems to skip the hard drive in the boot order with Windows 7, when Windows Vista or especially Windows XP would work just fine, please leave a comment below with your experiences and insights. I’d love to engage in a discussion with anyone else who feels they may have hit this type of bug.
UPDATE: I have verified that the problem boils down to one single check against the LBA “number of sectors” in partition 1 on the drive being equal to 0x400000 (4194304) or higher, and nothing more. I was able to get Windows 7 to boot normally by copying everything from partition 1 into partition 2, deleting partition 1, then using a hex editor to change byte 0x1CC to 0x40. Since all other parts of partition 1’s table entry are zeroed out, it isn’t seen as a valid partition on the disk, but the BIOS is only checking the DWORD value at 0x1CA-0x1CD to be 0x400000 or greater, so it simultaneously bypasses the bug/misfeature in the BIOS and doesn’t confuse the MBR nor Windows 7 at all, as the partition structure is completely valid. If I was adventurous, I’d shuffle the partition down to sector 2048 and reclaim the missing 100MB, but since I’d lose that space under Windows 7’s out-of-the-box partitioning scheme anyway, and it’s 0.1GB of a 31.6GB SSD, that kind of capacity loss isn’t significant at all.
Since the workaround is as simple as using a dummy entry where partition 1 is supposed to be, this trick should work for any operating system. Just start partitions at number 2 instead of 1, and apply the change 1 with a hex editor when you’re done, and you can have a tiny “first” partition without consequence! The only time you’ll ever need to redo the hack is if you run something that rewrites that portion of the partition table.