Schizophrenic GPT implementation in first generation Armada 370 u-boot
March 05, 2022 11:30AM
It appears u-boot in my Shuttle KS10 has a weird GPT implementation. When trying to boot from a 4TB disk, I get this:
Reset IDE: 
Marvell Serial ATA Adapter
Integrated Sata device found
  Device 0 @ 0 0:
Model: TOSHIBA HDWD240                          Firm: KQ000A   Ser#:         Z9J1S0I9S5HH
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 1718295.8 MB = 1678.0 GB (-775897424 x 512)

GPT: last_usable_lba incorrect: 1D1C0BE8E > D1C0BEB0
get_partition_info_efi: *** ERROR: Invalid GPT ***
** Bad partition 1 **
So when detecting the disk it strips bit 32, yielding 0xD1C0BEB0 sectors. But when interpreting the GPT table, it uses the real size, and then complains they differ.
I tried a hybrid MBR, but u-boot is too smart to fall for that. It recognizes the protective MBR, and goes for the GPT table.
When providing both a valid GPT and a valid MBR only describing the boot partition, (the latter can be done by using fdisk -t mbr <device>) u-boot uses the MBR, and loads kernel + initramfs (jay!), but Linux freaks out and won't find any partitions, and so no rootfs.
Remedy: add a 'gpt' to the kernel commandline, to tell it to use GPT when both a valid MBR and a valid GPT table are found.
https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html
Re: Schizophrenic GPT implementation in first generation Armada 370 u-boot
March 05, 2022 05:04PM
Nice trick!

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: