inindev / nanopc-t6

debian arm64 linux for the nanopc-t6
GNU General Public License v3.0
19 stars 3 forks source link

Not booting from SD-card (2) #13

Closed hreuver0183 closed 1 month ago

hreuver0183 commented 1 month ago

I saw another thead with the same issue from June. However since the thread was 2 months old I decided not to hijack it so I can still close my issue independently. My hope is that you could add some comments to push me in the right direction.

Since june I believe the u-boot has progressed (upstream/experimental) to almost the 2025.01 prerelease. Also the Collabora kernels have prograssed to almost mainstream (6.11 with should have most patches is scheduled for today I believe). Also Mesa 24.2 has made it to Bookworm backports. So there has been progress upstream. A good reason for me to try to boot a NanoPC T6-LTS with your image. If it boots and installs to nvme I should be able to get a working system with mainstream kernel and GPU acceleration using panthor.

Earlier I used another image of yours to install a NanoPi R5C successfully on eMMC (back than with 6.1-kernel which was easily updated using the linux-sources-6.6 deb-files), so I have high hopes.

First some housekeeping, my attempts with the T6-LTS and my lack of results.

I put the nanopc-t6_bookworm-v12-6.7-rc7.img.xz image on a nveme (using a nvme-usb adapter) using # xd -cd nanopc-t6_bookworm-v12-6.7-rc7.img.xz | dd of=/dev/sda status=progress I used the same command to fill an SD-card with your image.

Trying to start the nvme yields nothing: the emmc boots using Android.

Trying to start the SD I get:

OPTIONS: I18n 
DDR V1.12 52218f4949 cym 23/07/06-19:46:50
LPDDR4X, 2112MHz
channel[0] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[1] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[2] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[3] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
Manufacturer ID:0x1
CH0 RX Vref:27.1%, TX Vref:22.8%,21.8%
CH1 RX Vref:26.3%, TX Vref:20.8%,21.8%
CH2 RX Vref:27.5%, TX Vref:20.8%,18.8%
CH3 RX Vref:24.2%, TX Vref:18.8%,19.8%
change to F1: 528MHz
change to F2: 1068MHz
change to F3: 1560MHz
change to F0: 2112MHz
out                       +---------------------------+                         
U-Boot SPL board init     |                           |                         
U-Boot SPL 2017.09-g824171|  Cannot open /dev/modem!  |3 - 20:53:43)            
Trying to boot from MMC2  |                           |                         
No misc partition         +---------------------------+                         
spl: partition error                                                            
Trying fit image at 0x4000 sector                                               
## Verified-boot: 0                                                             
## Checking atf-1 0x00040000 ... sha256(bb1bbbc832...) + OK                     
## Checking u-boot 0x00a00000 ... sha256(a355bcf151...) + OK                    
## Checking fdt-1 0x00ace048 ... sha256(623b221203...) + OK                     
## Checking atf-2 0x000f0000 ... sha256(30812190d0...) + OK                     
## Checking atf-3 0xff100000 ... sha256(cb7bdbec2b...) + OK                     
Jumping to U-Boot(0x00a00000) via ARM Trusted Firmware(0x00040000)              

In short, there is no starting OS. But at least it seems to respond to the SD-image.

Would you have any hints for how I could proceed to getting your image to boot? (I could try to obtain the log without /dev/modem message, but that would hardly yield extra information.)

Would there be a difference between 'xzcat' and 'xz -cd .. | dd of=..'? (I prefer using dd so I can track the progress.)

inindev commented 1 month ago

U-Boot SPL 2017.09-g824171

The image wont boot from u-boot 2017. This is a 7 year old copy of u-boot. It needs to be up-to-date.

hreuver0183 commented 1 month ago

Of course I did think of that one.

Would this be the u-boot in the SPI? If your system did boot you probably replaced that one on your system.

Did you use the method to install the armbian image from the FriendlyElec Wiki to replace it?

I think I am missing 2 steps for the installation:

inindev commented 1 month ago

Start by erasing the internal emmc so it has to boot from the external mmc. When it is booted you can become root and run cat /dev/zero > /dev/mmcblkX where X is the internal emmc device. If you issue ls -al /dev/mmc* the internal emmc device is the one that contains the boot entries:

brw-rw---- 1 root disk 179,   0 Sep 14 03:58 /dev/mmcblk1
brw-rw---- 1 root disk 179, 256 Sep 14 03:58 /dev/mmcblk1boot0
brw-rw---- 1 root disk 179, 512 Sep 14 03:58 /dev/mmcblk1boot1
crw------- 1 root root 239,   0 Sep 14 03:58 /dev/mmcblk1rpmb
hreuver0183 commented 1 month ago

Using https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6 and chapter 17.2 it seems like I can change the emmc and the spi image. Unfortunately there is only the u-boot 2017.xx. install.txt

So far no boot from the SD-card, no boot from the NVME unfortunately. I will try the FriendlyElec SD-card to see if I can use it to access the EMMC like you mentioned.

(I need to first cross the bridge of starting linux on the T6 before I can use your hints.)

inindev commented 1 month ago

If your decvice has spi flash, hold the mask button down for a couple of seconds while powering it on to bypass it.

inindev commented 1 month ago

u-boot can only be loaded from mmc, emmc, or spi. Where have you installed the 2024 u-boot? The bootstrapping process will not look on the nvme for it -- you will need to overwrite spi or emmc at some point with the 2024 u-boot.

While testing, just erase the internal emmc and spi and boot from mmc. If you do not want to boot from mmc, remove the partition on it. This will allow u-boot from the external mmc to bootstrap the nvme.

more information: https://github.com/inindev/nanopi-r6/issues/4

hreuver0183 commented 1 month ago

The current problem is I have no source for an up-to-date u-boot yet, so I could install on either emmc of spi.

I can administer an arm64 system, but the u-boot part would be a first for me. Using https://github.com/Kwiboo/u-boot-rockchip I was able to build a u-boot (on another rk3588 platform), but lacking the console I could not proceed and test if it boots the system. I'd expect it to fail on the tee-os.

First boot using the friendlyElec SD-card has succeeded. It seems I can see both the AX210 (wifi) and the NVME. Uploaded your image it boots with an error "replace bootrom" (probably due to either u-boot or dtb non-matching) but at least it tries to boot the system. Restarted with maskrom:

#  ./upgrade_tool_v2.30_for_linux/upgrade_tool SSD
Using /root/upgrade_tool_v2.30_for_linux/config.ini
List of supported storage
No=1    FLASH
No=2    EMMC(*)
No=3    SD
No=4    SD1
No=5    SPINOR
No=6    SPINAND
No=7    RAM
No=8    USB
No=9    SATA
No=10   PCIE
Input No to switch,Quit press <Q>:5

This tries to boot your image on my system with the above error. Trying to boot the FriendlyElec image again it boots with above error, a small timeout and it boots the system.

So I'd say if I could get a working u-boot on the nvme it should work. It does not ignore the nvme and it does boot after a timeout.

The above error (a little cut back):

U-Boot SPL 2017.09-g82417168bf-230508 #root (Sep 08 2023 - 20:53:43)
Trying to boot from MMC2
MMC: no card present
mmc_init: -123, time 0
spl: mmc init failed with error: -123
Trying to boot from MMC1
No bootable slots found, use lastboot.
Trying fit image at 0x4000 sector
Not fit magic
Trying fit image at 0x5000 sector
Not fit magic
A/B: no bootable slot
Trying fit image at 0x4000 sector
Not fit magic
Trying fit image at 0x5000 sector
Not fit magic
A/B: no bootable slot
Trying to boot from MTD2
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0xX != 0xX
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0xX != 0xX
..
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
Trying fit image at 0x4000 sector
Not fit magic
Trying fit image at 0x5000 sector
Not fit magic
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0xX != 0xX
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
part_get_info_efi: *** ERROR: Invalid GPT ***
GUID Partition Table Header signature is wrong: 0xX != 0xX
part_get_info_efi: *** ERROR: Invalid Backup GPT ***
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
# Reset the board to bootrom #
hreuver0183 commented 1 month ago

Via an armbian install I did get the T6 working with your image (instelling the rkspi_loader.img via the armbian tools), but it still is less mature than I was expecting. I did expect the GPU not working since you have the 6.7-kernel. Even lacking the VOP2 is no problem. However I also could not use USB2-ports and the network.

I'd guess the VOP2 and GPU will be fixed by updating the kernel to 6.10 or 6.11. The USB2 problem might just be a DTB issue (and thus also fixed with a kernel update).

It might be manageble if not for the network problem. If even a direct static IPv4 connection set up with "ip addr" and "ip route" does not work it gets for me hard to compensate. For now I'll go back to the Friendlyarm supplied SD-image to see there is nothing broken with the USB2 and network.

You helped me a lot on the way and I do hope to pick up this issue again later.

inindev commented 1 month ago

try installing a later kernel like 6.10: https://github.com/inindev/linux-rockchip/releases

wget https://github.com/inindev/linux-rockchip/releases/download/v6.10.0-rc6/linux-image-6.10.0-rc6-1-arm64_6.10.0-rc6-1_arm64.deb
sudo dpkg -i linux-image-6.10.0-rc6-1-arm64_6.10.0-rc6-1_arm64.deb
hreuver0183 commented 1 month ago

When I tried the FriendlyElec image something occured to me.

The problem I have without network is "how do I get all the packages I need?". What I am now trying is after changing the souces.list from bullseye to bookworm + changing the servers to local servers on the friendlyelec package, updating the system. That leaves all the packages (and I add linux-source-6.10 to that) in /var/archives.

Copying the /var/archives to your image (from SD to NVME) should get me a start position where the system can be used.

So my installation-route is now:

When everything is finished I hope to have a lean system which can be maintained by myself (using debian arm64). So, I am not finished with your image yet.

inindev commented 1 month ago

It should not require manual copying of files.

wget https://github.com/inindev/debian-image/releases/download/v12.6-2/nanopc-t6_bookworm-12.6.img.xz
sudo su

to copy to SD:
xzcat nanopc-t6_bookworm-12.6.img.xz > /dev/sdX

to copy to nvme:
xzcat nanopc-t6_bookworm-12.6.img.xz > /dev/nvme0n1
hreuver0183 commented 1 month ago

Ah, I did not see any file newer than the 12.6.7-rc ... Downloading again.

inindev commented 1 month ago

Also note that when booting the image for the first time, it mostly sets up, then expands the image to use the whole partition, then reboots. This one-time reboot could confusing if you do not know about it and do not have a serial console to watch what is happening.

hreuver0183 commented 1 month ago

The onetime boot is pretty usual. The 6.10.3-kernel still does not include a normal terminal though, which is still unusual for me.

I managed to get one rtl8125 and one wifi connection working. Was nmtui already installed? I saw many problems with packages which are required for nmtui, which I used to get the wifi up and running.

If I did not have some stupid cable problem it might have been a lot less work. (The wifi was up before the wired network). If I saw correctly both firmware-iwlwifi and firmware-realtek were not present in the image, but you tell me if I did not simply overlook it with the cable problems. Perhaps the old /etc/network/interfaces might have been the better way to get the wired network running.

I don't think 6.10.3 has a real advantage over the 6.7-rc-kernel here. It works, boots from nvme, I can configure a network (wifi and wired) so I am currently happy. Still lot's of things to do, but I'll end it here today.

Thanks for your image and your support.

inindev commented 1 month ago

That image does not contain a custom kernel. That is a stock debian kernel from sid: https://packages.debian.org/sid/kernel/linux-image-arm64

Linux 6.11 just went GA and I am compiling it now: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/

Check back in a couple of hours and it should be available here: https://github.com/inindev/linux-rockchip/releases

inindev commented 1 month ago

confirming that this kernel has working video: https://github.com/inindev/linux-rockchip/releases/download/v6.11.0/linux-image-6.11.0-1-arm64_6.11.0-1_arm64.deb

hreuver0183 commented 1 month ago

Looking back at the original problem: it still seems to use the u-boot 2017.xx. Just putting u-boot on the emmc is one thing, using the SPINOR is another thing. I will leave it for now since it boots.

I have been playing around a little with the 6.11-kernel and it really is an improvement:

I also found the the cpufreq settings now work (they did not with the 6.10-kernel). The pcie_aspm setting did already work before.

Really good job on 6.11.

inindev commented 1 month ago

writing to spi is straight-forward:

1. install mtd-utils

sudo apt update
sudo apt install mtd-utils

2. erase spi flash

sudo flash_erase /dev/mtd0 0 0
sudo flash_erase /dev/mtd1 0 0
sudo flash_erase /dev/mtd2 0 0
sudo flash_erase /dev/mtd3 0 0

3. write u-boot to spi flash

wget https://github.com/inindev/uboot-rockchip/releases/download/v2024.07/nanopc-t6_idbloader.img
wget https://github.com/inindev/uboot-rockchip/releases/download/v2024.07/nanopc-t6_u-boot.itb
sudo flashcp -v nanopc-t6_idbloader.img /dev/mtd0
sudo flashcp -v nanopc-t6_u-boot.itb /dev/mtd2
inindev commented 1 month ago

There are two variants of the nanopc-t6 as pertains to usb support. The original model 2301 had the two ports on back and a 4g lte port on the side. The later 2310 variant has the usb ports on the front replacing the 4g lte support. One dtb cannot serve both or an overlay file would be needed. I have been meaning to write a 2310 overlay which will delete the 4g lte support and replace it with the usb support on the front.

I did not realize you had this variant, you should be able to put a serial console on the usb-c serial port on the front.

hreuver0183 commented 1 month ago

The MTD has been flashed, your example worked :-) I included the log just for information, just in case anyone wants to know (the 6.10.9 kernel was build using linux-source-6.10.deb). [Uploading newstartup.txt…]()

As for the USB2-ports and the sound, I think they are really minor issues. I guess I bought a T6-LTS (2310) as a, sort of, desktop machine. Perhaps you bought your T6 for the LTE connection or NAS which might explain why you did not have the gpu and normal text screen already working.

That is however of no consequence for me.

As I started late in the game with the T6, almost all functionality is already available in the Debian Bookworm. For anyone who tries a similar installation for the GUI: The system should really shine after upgrading to Trixie (since it provides Mesa 24.1 or newer).

PS For one use case Bookworm and backports might work better: the system in question is used mostly offline (and connected approximately once every few months for updates). For the Mesa backport I use "home:amazingfate:mesa-bookworm-backport" (Google on it and "Armbian" if you need it.). It works but is not updated regularly.

hreuver0183 commented 1 month ago

And just like I thought the usb2 issue is just a small issue. There is no need for an overlay, since the T6 and T6 LTS can have seperate dtb files:

$ cat /proc/device-tree/model 
FriendlyElec NanoPC-T6 LTS

That is also what Linus uses in his tree (a generic dtsi, with a dts containing LTE for the T6 and USB2 for the T6 LTS).

Edit: The other open issue of sound: I tried "pavucontrol" to activate the RT5616, but it doesn't help you activating sound. When stuck try the "alsamixer" with a speaker attached to the headphone connection and a source playing sound. Why not a headphone? Chances the sound is too loud are about 80%. It zomes down to which switch will enable sound on the speaker. Adjusting the volume is second.