I’m currently no longer able to boot from SD. I’ve been able in the past to do the installation as usual, SD->NAND->EMMC, for reasons unknown (maybe uboot environment?). Attempting to boot from SD (all 4 switches in the UP position) just gives me this:
spi-nand: spi_nand spi_nand@1: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@1: 128 MiB, block size: 128 KiB, page size: 2048, O4
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: 00, ef, aa
'spi-nand0' is now active device
* spi-nand0
- device: spi_nand@1
- parent: spi@1100a000
- driver: spi_nand
- type: NAND flash
- block size: 0x20000 bytes
- page size: 0x800 bytes
- OOB size: 64 bytes
- OOB available: 24 bytes
- 0x000000000000-0x000008000000 : "spi-nand0"
- 0x000000000000-0x000000080000 : "bl2"
- 0x000000080000-0x000000380000 : "factory"
- 0x000000380000-0x000000580000 : "fip"
- 0x000000580000-0x000008000000 : "ubi"
Press ENTER to return to menu
Uboot can see the card:
MT7986> mmcinfo
Device: mmc@11230000
Manufacturer ID: 2
OEM: 544d
Name: SA16G
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.5 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
But thinks its partition table is bad:
MT7986> mmc part
## Unknown partition table type 0
Its possible that I may have inadvertenly selected
a. Reset all settings to factory defaults.
In the boot menu while navigating, and this may be the cause of my issue. I am able to successfully boot from NAND and eMMC, but it has the older, broken, image, which is not of very much use to me.
There seems to be issues when writing the (latest?) sdcard images. For whatever reason, using either dd or Etcher, linux complained that GPT is damaged. Using gdisk to “fix” the partition table allows me to boot from these SD cards. I dont know if that is a “leftover” from the sd card, which was previously used somewhere else…
However, I just did the following
created a new GPT partition table on the device, with a cleared partition 1
wrote the snapshot image with Etcher
On the machine where I just wrote the image, dmesg shows “Alternate GPT is invalid, using primary GPT”
Indeed, the R3 spews messages about invalid GPT partition, and doesn’t boot from this card
Take the sdcard, “correct” the GPT table with gdisk under Linux, reinsert into R3
Then, I can boot from SD.
I didn’t have this issue when I originally installed a few days ago, where I bascially did the same thing without issue.
I had the same issue with new Samsung Pro micro SD card which came with GPT partition table from the factory. Writing using dd didn’t clear the table at the end of the device, which then confused U-Boot.
Hi Frank-w and thanks for your reply. I am experiencing the following issue with the Ubuntu 22.04 server image you provided. How have you solved the problem?
I am leaving here some info about the problem in case someone runs into it.
When I write the image I am able to boot the OS straight away, but as soon as I power cycle I get this on the serial console
F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 103F 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 300C 0028
F5: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
** No partition table - mmc 0 **
Couldn't find partition mmc 0:5
## Error: "initrd" not defined
mmc - MMC sub system
[...]
sd available
jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: 00, ef, aa
Failed to initialize SPI flash at 0:0 (error 0)
NAND available
sd nand
fit=bpi-r3.itb
** No partition table - mmc 0 **
Couldn't find partition mmc 0:5
Can't set block device
MT7986>
Plugging the sd card into another PC and running fdisk or gdisk returns the following errors related to the partition table.
userk@dopamine:~/$ sudo fdisk -l /dev/sdd
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdd: 119.2 GiB, 127984992256 bytes, 249970688 sectors
Disk model: MassStorageClass
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: FCB519F7-173A-4AF3-B570-FD1701EFC7AC
Device Start End Sectors Size Type
/dev/sdd1 34 8191 8158 4M Linux filesystem
/dev/sdd2 8192 9215 1024 512K Linux filesystem
/dev/sdd3 9216 13311 4096 2M Linux filesystem
/dev/sdd4 13312 17407 4096 2M Linux filesystem
/dev/sdd5 17408 222207 204800 100M Linux filesystem
/dev/sdd6 222208 12805120 12582913 6G Linux filesystem
When I run gdisk
userk@dopamine:~/$ sudo gdisk /dev/sdd
GPT fdisk (gdisk) version 1.0.5
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
I even tried to print the partition table using the p option of gdisk and write the changes with w but nothing I get the same issue.
When I backup the GPT partition table using the command you suggested returns:
userk@dopamine:~/$ sudo sgdisk --backup=bpi-r3_sgdisk.gpt /dev/sdd
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
The operation has completed successfully.
When I restore the GPT partition table from the file sgdisk returns the following:
userk@dopamine:~/$ sudo sgdisk --load-backup=bpi-r3_sgdisk.gpt /dev/sdd
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
If I insert the microSD card the serial console returns a Kernel Panic error
Bl2 is the first stage bootloader after bootrom on board (which shows your current output). Bl2 is part of atf and loads uboot fip (u-boot bundled with another part of atf).
Which image do you use? Your last trace had linux running so bl2,uboot and kernel was found…only your root in cmdline is missing…this is normally set in uboot (in my images/uboot is defined via environment)
newboot=run checkrd; run setbootconf; run buildargs;if printenv fit;then setenv kernel ${fit};if run loadkernel; then bootm ${kaddr}${bootconf}; fi;fi;
buildargs=setenv bootargs "board=${board} earlycon=uart8250,mmio32,0x11002000 ${bootopts} root=${root}"
root=/dev/mmcblk0p6 rootfstype=ext4 rootwait
so bootargs (and your cmdline) should be filled with “root=/dev/mmcblk0p6 rootfstype=ext4 rootwait” by calling buildargs by newboot (which is used by default)