Mic92 / nixos-aarch64-images

Build NixOS images for various ARM single computer boards
70 stars 20 forks source link

Unable to boot on RockPro64 #3

Closed Kreyren closed 2 years ago

Kreyren commented 3 years ago

Installed using:

$ nix-build -A rock64
$ sfdisk --dump result
$ sudo dd if=./result of=/dev/sdb iflag=direct oflag=direct bs=16M status=progress conv=sync
$ [kreyren@leonid:~]$ nix-shell -p picocom --run "sudo picocom /dev/ttyUSB0 -b 1500000"
picocom v3.2a

port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 1500000
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : /nix/store/p7h8vawj56b80g2nwvnp8jbjbarqkzpp-lrzsz-0.12.20/bin/sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready

Partitioning: image

Additional info

SPI is disabled through GPIO

eMMC is not installed

Board draws 12VDC0.20A

Using woodpecker for the serial console

Kreyren commented 3 years ago

CC @Mic92

Kreyren commented 3 years ago

Relevant: https://github.com/Mic92/nixos-aarch64-images/issues/1

CC @ajgrf any relevant info appreciated

ajgrf commented 3 years ago

The default kernel in NixOS 20.09 is too old for the RockPro64. I had to update this line to use a newer kernel before it worked for me. I think it would work if you just bumped it to NixOS 21.05.

Kreyren commented 3 years ago
[kreyren@leonid:~/Repositories/nixos-aarch64-images]$ nix-build -A rock64
these derivations will be built:
  /nix/store/6mazswhjjvp4aj8lff0kf13xkd5f7f0m-nixos-sd-image-21.05.1817.2262d7863a6-aarch64-linux.img.zst.drv
  /nix/store/7bsarixi692g1mxcbzvcbygan4fawq04-aarch64-image.drv
  /nix/store/jjiplapri49f0yq06983l30094zc3xsl-manifest.json.drv
  /nix/store/kb4l89885rna06js00pwl8v4k5sc620m-image.drv
building '/nix/store/6mazswhjjvp4aj8lff0kf13xkd5f7f0m-nixos-sd-image-21.05.1817.2262d7863a6-aarch64-linux.img.zst.drv'...

trying https://hydra.nixos.org/build/148774499/download/1/nixos-sd-image-21.05.1817.2262d7863a6-aarch64-linux.img.zst
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  717M  100  717M    0     0  7930k      0  0:01:32  0:01:32 --:--:-- 9867k
building '/nix/store/7bsarixi692g1mxcbzvcbygan4fawq04-aarch64-image.drv'...
patching sources
installing
post-installation fixup
building '/nix/store/jjiplapri49f0yq06983l30094zc3xsl-manifest.json.drv'...
building '/nix/store/kb4l89885rna06js00pwl8v4k5sc620m-image.drv'...
patching sources
configuring
no configure script, doing nothing
building
/nix/store/ar1dn2gsijf52wqcxyfg57kbvzp6vypm-build-image.py /nix/store/rdl2nn7cqskfbmn1zlqn3485f1gsqi10-manifest.json /nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image
sfdisk /nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image <<'EOF'
label: gpt
unit: sectors
first-lba: 64

/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image: name="idbloader", start=0x40, size=0x3fc0, type="0FC63DAF-8483-4772-8E79-3D69D8477DE4"
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image: name="uboot", start=0x4000, size=0x4000, type="0FC63DAF-8483-4772-8E79-3D69D8477DE4"
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image: name="nixos", start=0x8000, type="0FC63DAF-8483-4772-8E79-3D69D8477DE4", attrs="LegacyBIOSBootable"
EOF
Checking that no-one is using this disk right now ... OK

Disk /nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image: 3.11 GiB, 3340030464 bytes, 6523497 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: D93FA1D1-9EAF-434A-8052-AE341DABB888).
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image1: Created a new partition 1 of type 'Linux filesystem' and of size 8 MiB.
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image2: Created a new partition 2 of type 'Linux filesystem' and of size 8 MiB.
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image3: Created a new partition 3 of type 'Linux filesystem' and of size 3.1 GiB.
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image4: Done.

New situation:
Disklabel type: gpt
Disk identifier: D93FA1D1-9EAF-434A-8052-AE341DABB888

Device                                             Start     End Sectors  Size Type
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image1    64   16383   16320    8M Linu
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image2 16384   32767   16384    8M Linu
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image3 32768 6523463 6490696  3.1G Linu

The partition table has been altered.
Syncing disks.
$ dd if=/nix/store/sxbyhdzj4884v5v2mmfhi5cshpl287xq-uboot-rock64-rk3328_defconfig-2021.04/idbloader.img of=/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image skip=0 seek=32768 status=progress iflag=direct,count_bytes,skip_bytes oflag=direct,seek_bytes bs=16M conv=fsync,notrunc count=8355840
0+1 records in
0+1 records out
107683 bytes (108 kB, 105 KiB) copied, 0.00371483 s, 29.0 MB/s
$ dd if=/nix/store/sxbyhdzj4884v5v2mmfhi5cshpl287xq-uboot-rock64-rk3328_defconfig-2021.04/u-boot.itb of=/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image skip=0 seek=8388608 status=progress iflag=direct,count_bytes,skip_bytes oflag=direct,seek_bytes bs=16M conv=fsync,notrunc count=8388608
0+1 records in
0+1 records out
789504 bytes (790 kB, 771 KiB) copied, 0.0178586 s, 44.2 MB/s
$ dd if=/nix/store/n4fdnp7nkv0s18w5vf844ijj4pyi0a4h-aarch64-image of=/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image skip=39845888 seek=16777216 status=progress iflag=direct,count_bytes,skip_bytes oflag=direct,seek_bytes bs=16M conv=fsync,notrunc count=3323236352
3321888768 bytes (3.3 GB, 3.1 GiB) copied, 71 s, 46.6 MB/s
198+1 records in
198+1 records out
3323236352 bytes (3.3 GB, 3.1 GiB) copied, 71.3672 s, 46.6 MB/s
$ sfdisk --verify /nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image:
No errors detected.
Header version: 1.0
Using 3 out of 128 partitions.
A total of 0 free sectors is available in 0 segments (the largest is (null)).
post-installation fixup
/nix/store/0iyy7k1knjqcj8zasl25lng8rf5qnh3a-image

[kreyren@leonid:~/Repositories/nixos-aarch64-images]$ sudo dd if=./result of=/dev/sdb conv=sync status=progress 
[sudo] password for kreyren: 
3333259776 bytes (3.3 GB, 3.1 GiB) copied, 877 s, 3.8 MB/s 
6523497+0 records in
6523497+0 records out
3340030464 bytes (3.3 GB, 3.1 GiB) copied, 886.78 s, 3.8 MB/s

@ajgrf Same issue

ajgrf commented 3 years ago

Do you have any of the output from trying to boot? If you can't get anything from the serial console you could just give it the PC treatment with an HDMI monitor & USB keyboard.

Kreyren commented 3 years ago

Do you have any of the output from trying to boot? @ajgrf

No output

If you can't get anything from the serial console you could just give it the PC treatment with an HDMI monitor & USB keyboard. @ajgrf

No video output either.. seems to fail at the BIOS phase

Kreyren commented 3 years ago
[kreyren@leonid:~]$ sudo fdisk -l /dev/sdb
[sudo] password for kreyren: 
GPT PMBR size mismatch (6523496 != 61951999) will be corrected by write.
The backup GPT table is not on the end of the device.
Disk /dev/sdb: 29.54 GiB, 31719424000 bytes, 61952000 sectors
Disk model: Storage Device  
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: D93FA1D1-9EAF-434A-8052-AE341DABB888

Device     Start     End Sectors  Size Type
/dev/sdb1     64   16383   16320    8M Linux filesystem
/dev/sdb2  16384   32767   16384    8M Linux filesystem
/dev/sdb3  32768 6523463 6490696  3.1G Linux filesystem
ajgrf commented 3 years ago

OK, well I don't really know what else to suggest. I suppose if you can wait a few days I will try to build a working image again over the weekend.

Kreyren commented 3 years ago

FWIW it boots and starts the installation on debian

Kreyren commented 3 years ago
[kreyren@leonid:~]$ nix-shell -p picocom --run "sudo picocom /dev/ttyUSB0 -b 1500000"
[sudo] password for kreyren: 
picocom v3.2a

port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 1500000
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : /nix/store/p7h8vawj56b80g2nwvnp8jbjbarqkzpp-lrzsz-0.12.20/bin/sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready
DDR Version 1.26 20210628
In
channel 0
CS = 0
MR0=0x98
MR4=0x1
MR5=0xFF
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0x0
channel 1
CS = 0
MR0=0x98
MR4=0x1
MR5=0xFF
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0x0
channel 0 training pass!
channel 1 training pass!
change freq to 416MHz 0,1
Channel 0: LPDDR4,416MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
Channel 1: LPDDR4,416MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=16 Size=1024MB
256B stride
channel 0
CS = 0
MR0=0x98
MR4=0x1
MR5=0xFF
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0x0
channel 1
CS = 0
MR0=0x98
MR4=0x1
MR5=0xFF
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0x0
channel 0 training pass!
channel 1 training pass!
channel 0, cs 0, advanced training done
channel 1, cs 0, advanced training done
change freq to 856MHz 1,0
ch 0 ddrconfig = 0x101, ddrsize = 0x20
ch 1 ddrconfig = 0x101, ddrsize = 0x20
pmugrf_os_reg[2] = 0x3281F281, stride = 0x9
ddr_set_rate to 328MHZ
ddr_set_rate to 666MHZ
ddr_set_rate to 928MHZ
channel 0, cs 0, advanced training done
channel 1, cs 0, advanced training done
ddr_set_rate to 416MHZ, ctl_index 0
ddr_set_rate to 856MHZ, ctl_index 1
support 416 856 328 666 928 MHz, current 856MHz
OUT

U-Boot SPL 2021.07-00854-ge013b7270106 (Jul 26 2021 - 17:58:54 -0400)
Trying to boot from MMC2

U-Boot 2021.07-00854-ge013b7270106 (Jul 26 2021 - 17:58:54 -0400)

SoC: Rockchip rk3399
Reset cause: POR
Model: Pine64 RockPro64 v2.1
DRAM:  2 GiB
PMIC:  RK808 
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: ff, ff, ff
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial
Out:   vidconsole
Err:   vidconsole
Model: Pine64 RockPro64 v2.1
Net:   eth0: ethernet@fe300000
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3a0000: USB OHCI 1.0
Bus usb@fe3c0000: USB EHCI 1.00
Bus usb@fe3e0000: USB OHCI 1.0
Bus dwc3: usb maximum-speed not found
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:3...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
692 bytes read in 6 ms (112.3 KiB/s)
1:  NixOS - Default
Retrieving file: /boot/extlinux/../nixos/0avjs0xfcjkhnnv6zcqfr2i7miv9ijli-initrd-linux-5.10.52-initrd
8210128 bytes read in 356 ms (22 MiB/s)
Retrieving file: /boot/extlinux/../nixos/2xgc4ljvras2j0gp0kik9hkrk3kzylyg-linux-5.10.52-Image
43661824 bytes read in 1817 ms (22.9 MiB/s)
append: init=/nix/store/iwl96rdx5yvlm5jvnbxx3kw6rz5z12fq-nixos-system-nixos-21.05.1817.2262d7863a6/init console=ttyS0,115200n8 console=ttyAMA0,115200n8 console=tty0 loglevel=7
Retrieving file: /boot/extlinux/../nixos/2xgc4ljvras2j0gp0kik9hkrk3kzylyg-linux-5.10.52-dtbs/rockchip/rk3399-rockpro64.dtb
56812 bytes read in 13 ms (4.2 MiB/s)
Moving Image from 0x2080000 to 0x2200000, end=4c50000
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000

With u-boot and idbloader from debian (still hangs)^

ajgrf commented 3 years ago

OK, I just realized you are building an image for the Rock64. Try running nix-build -A rockPro64 instead.

Kreyren commented 3 years ago
[kreyren@leonid:~/Repositories/nixos-aarch64-images]$ nix-build -A rockPro64
these derivations will be built:
  /nix/store/dlf1v49wdmnvlf4vc2j6x4jlsjcpjpza-manifest.json.drv
  /nix/store/jzsr7kr9m0sgrw8a53nk6dv4pavkx8nf-image.drv
these paths will be fetched (0.33 MiB download, 1.08 MiB unpacked):
  /nix/store/0gik53sisisp2njrcmpb42hbrng352yg-uboot-rockpro64-rk3399_defconfig-2021.04
copying path '/nix/store/0gik53sisisp2njrcmpb42hbrng352yg-uboot-rockpro64-rk3399_defconfig-2021.04' from 'https://cache.nixos.org'...
building '/nix/store/dlf1v49wdmnvlf4vc2j6x4jlsjcpjpza-manifest.json.drv'...
building '/nix/store/jzsr7kr9m0sgrw8a53nk6dv4pavkx8nf-image.drv'...
patching sources
configuring
no configure script, doing nothing
building
/nix/store/ar1dn2gsijf52wqcxyfg57kbvzp6vypm-build-image.py /nix/store/c0ls14i54ny09avlzqfs9pck0hi9rpc5-manifest.json /nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image
sfdisk /nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image <<'EOF'
label: gpt
unit: sectors
first-lba: 64

/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image: name="idbloader", start=0x40, size=0x3fc0, type="0FC63DAF-8483-4772-8E79-3D69D8477DE4"
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image: name="uboot", start=0x4000, size=0x4000, type="0FC63DAF-8483-4772-8E79-3D69D8477DE4"
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image: name="nixos", start=0x8000, type="0FC63DAF-8483-4772-8E79-3D69D8477DE4", attrs="LegacyBIOSBootable"
EOF
Checking that no-one is using this disk right now ... OK

Disk /nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image: 3.11 GiB, 3340030464 bytes, 6523497 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 2979B46E-7333-CF4B-8301-35E1292A2CFF).
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image1: Created a new partition 1 of type 'Linux filesystem' and of size 8 MiB.
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image2: Created a new partition 2 of type 'Linux filesystem' and of size 8 MiB.
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image3: Created a new partition 3 of type 'Linux filesystem' and of size 3.1 GiB.
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image4: Done.

New situation:
Disklabel type: gpt
Disk identifier: 2979B46E-7333-CF4B-8301-35E1292A2CFF

Device                                             Start     End Sectors  Size Type
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image1    64   16383   16320    8M Linu
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image2 16384   32767   16384    8M Linu
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image3 32768 6523463 6490696  3.1G Linu

The partition table has been altered.
Syncing disks.
$ dd if=/nix/store/0gik53sisisp2njrcmpb42hbrng352yg-uboot-rockpro64-rk3399_defconfig-2021.04/idbloader.img of=/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image skip=0 seek=32768 status=progress iflag=direct,count_bytes,skip_bytes oflag=direct,seek_bytes bs=16M conv=fsync,notrunc count=8355840
0+1 records in
0+1 records out
165039 bytes (165 kB, 161 KiB) copied, 0.00443387 s, 37.2 MB/s
$ dd if=/nix/store/0gik53sisisp2njrcmpb42hbrng352yg-uboot-rockpro64-rk3399_defconfig-2021.04/u-boot.itb of=/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image skip=0 seek=8388608 status=progress iflag=direct,count_bytes,skip_bytes oflag=direct,seek_bytes bs=16M conv=fsync,notrunc count=8388608
0+1 records in
0+1 records out
961744 bytes (962 kB, 939 KiB) copied, 0.016191 s, 59.4 MB/s
$ dd if=/nix/store/n4fdnp7nkv0s18w5vf844ijj4pyi0a4h-aarch64-image of=/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image skip=39845888 seek=16777216 status=progress iflag=direct,count_bytes,skip_bytes oflag=direct,seek_bytes bs=16M conv=fsync,notrunc count=3323236352
3288334336 bytes (3.3 GB, 3.1 GiB) copied, 54 s, 60.7 MB/s
198+1 records in
198+1 records out
3323236352 bytes (3.3 GB, 3.1 GiB) copied, 54.7533 s, 60.7 MB/s
$ sfdisk --verify /nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image:
No errors detected.
Header version: 1.0
Using 3 out of 128 partitions.
A total of 0 free sectors is available in 0 segments (the largest is (null)).
post-installation fixup
/nix/store/icm7c1af9j10psvrmrlif60ncwf0nass-image

[kreyren@leonid:~/Repositories/nixos-aarch64-images]$ sudo dd if=./result of=/dev/sdb conv=sync status=progress
3339526656 bytes (3.3 GB, 3.1 GiB) copied, 879 s, 3.8 MB/s 
6523497+0 records in
6523497+0 records out
3340030464 bytes (3.3 GB, 3.1 GiB) copied, 880.747 s, 3.8 MB/s

[kreyren@leonid:~]$ nix-shell -p picocom --run "sudo picocom /dev/ttyUSB0 -b 1500000"
[sudo] password for kreyren: 
picocom v3.2a

port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 1500000
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : /nix/store/p7h8vawj56b80g2nwvnp8jbjbarqkzpp-lrzsz-0.12.20/bin/sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready

U-Boot TPL 2021.04 (Apr 05 2021 - 15:03:29)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS=1 Die BW=16 Size=1024MB
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2021.04 (Apr 05 2021 - 15:03:29 +0000)
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC2
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Doesn't boot, output captured with pin 10 connected before pressing RESET

EDIT: Added output from build and dd

Mic92 commented 3 years ago

I am also bumping the nixos image here: https://github.com/Mic92/nixos-aarch64-images/pull/6

Mic92 commented 3 years ago

@Kreyren did you managed to get it booting now? I saw your modification in the wiki?

Kreyren commented 3 years ago

@Mic92 No, still unable to boot

Kreyren commented 3 years ago

See https://github.com/Mic92/nixos-aarch64-images/issues/3#issuecomment-889602091 for the current status

Kreyren commented 3 years ago

FWIW I am building this on x86_64-linux

image

Mic92 commented 3 years ago

Is this maybe a broken flash?

U-Boot SPL 2021.04 (Apr 05 2021 - 15:03:29 +0000)
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC1
mmc_load_image_raw_sector: mmc block read error
Trying to boot from MMC2
mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
Mic92 commented 3 years ago

At least the boot loader itself seems functional. I am not familar enough with uboot to know what might cause a read error.

Kreyren commented 3 years ago

CC top 3 contributors of u-boot @sig20 @masahir0y @xypron

Kreyren commented 3 years ago

@Mic92 Are you sure that this can be built on amd64/i686 ? (i was unable to build u-boot on this system due to the platform incompatibility)

Mic92 commented 3 years ago

I can build pkgsCross.aarch64-multiplatform.ubootRockPro64 and pkgsCross.aarch64-multiplatform.ubootRock64 on nixpkgs de5a599492add2f0c5d5fcd1f3123da623eb3998

Kreyren commented 3 years ago

Can you build it for me and sent me the build result? I want to verify that it's not issue related to the used system.

Mic92 commented 3 years ago
$ nix copy --no-check-sigs --to /tmp/cache $(nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.ubootRockPro64)
$ tar -czvf /tmp/cache.tgz /tmp/cache

https://dl.thalheim.io/hJ1pmznB_bj-E2mmCgsXyQ/cache.tgz

Kreyren commented 3 years ago
U-Boot 2021.04 (Apr 05 2021 - 15:03:29 +0000)

SoC: Rockchip rk3399
Reset cause: POR
Model: Pine64 RockPro64 v2.1
DRAM:  2 GiB
PMIC:  RK808 
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: ff, ff, ff
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial
Out:   vidconsole
Err:   vidconsole
Model: Pine64 RockPro64 v2.1
Net:   eth0: ethernet@fe300000
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3a0000: USB OHCI 1.0
Bus usb@fe3c0000: USB EHCI 1.00
Bus usb@fe3e0000: USB OHCI 1.0
Bus dwc3: usb maximum-speed not found
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
** Invalid partition 1 **
rockchip_pcie pcie@f8000000: PCIe link training gen1 timeout!

Device 0: unknown device

Device 0: unknown device
rockchip_pcie pcie@f8000000: failed to find ep-gpios property
ethernet@fe300000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY ethernet@fe300000
missing environment variable: pxeuuid
missing environment variable: bootfile
...

Seems to get past the bootloder now, but hangs

Installed using:

nix-build '<nixpkgs>' -A pkgsCross.aarch64-multiplatform.ubootRockPro64
...

[kreyren@leonid:~/Repositories/nixos-aarch64-images/result]$ ls
idbloader.img  nix-support  u-boot.itb

[kreyren@leonid:~/Repositories/nixos-aarch64-images/result]$ sudo dd if=./idbloader.img of=/dev/sdb conv=fsync,notrunc bs=512 seek=64 status=progress
[sudo] password for kreyren: 
322+1 records in
322+1 records out
165039 bytes (165 kB, 161 KiB) copied, 0.0738824 s, 2.2 MB/s

[kreyren@leonid:~/Repositories/nixos-aarch64-images/result]$ sudo dd if=./u-boot.itb of=/dev/sdb conv=fsync,notrunc bs=512 seek=16384 status=progress
1878+1 records in
1878+1 records out
961768 bytes (962 kB, 939 KiB) copied, 0.878893 s, 1.1 MB/s
Kreyren commented 3 years ago
U-Boot 2021.04 (Apr 05 2021 - 15:03:29 +0000)

SoC: Rockchip rk3399
Reset cause: POR
Model: Pine64 RockPro64 v2.1
DRAM:  2 GiB
PMIC:  RK808 
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: ff, ff, ff
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial
Out:   vidconsole
Err:   vidconsole
Model: Pine64 RockPro64 v2.1
Net:   eth0: ethernet@fe300000
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3a0000: USB OHCI 1.0
Bus usb@fe3c0000: USB EHCI 1.00
Bus usb@fe3e0000: USB OHCI 1.0
Bus dwc3: usb maximum-speed not found
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
** Invalid partition 1 **
rockchip_pcie pcie@f8000000: PCIe link training gen1 timeout!

Device 0: unknown device

Device 0: unknown device
rockchip_pcie pcie@f8000000: failed to find ep-gpios property
Speed: 1000, full duplex
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 23
*** Unhandled DHCP Option in OFFER/ACK: 23
DHCP client bound to address 192.168.0.157 (95 ms)
*** Warning: no boot file name; using 'C0A8009D.img'
Using ethernet@fe300000 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.157
Filename 'C0A8009D.img'.
Load address: 0x800800
Loading: T T T T T T T T T T 
Retry count exceeded; starting again
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/01-4e-cf-b2-ea-31-49
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.157
Filename 'pxelinux.cfg/01-4e-cf-b2-ea-31-49'.
Load address: 0x600000
Loading: T T T T T T T T T T 
Retry count exceeded; starting again
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A8009D
Speed: 1000, full duplex
Using ethernet@fe300000 device
...

Got further now... seems to be trying to boot using pxe?

Mic92 commented 3 years ago

It is not clear from your log if you also flashed nixos to the sdcard?

switch to partitions #0, OK
mmc1 is current device
** Invalid partition 1 *

This looks like it does not find any partition. It only tries pxe as a fallback.

Kreyren commented 3 years ago

It is not clear from your log if you also flashed nixos to the sdcard? @Mic92

Just did the dd of idbloader.img and u-boot.itb that doesn't include nixos?

If no then how do i flash it?

Kreyren commented 3 years ago

Made it to work! Now it seems to not boot, bcs i had my PSU current limited on 0.40A where the boot needs 0.64A

Mic92 commented 3 years ago

If manually flashing the bootloader worked, why was the actual nixos image not working than? Did you change anything?

Kreyren commented 3 years ago

I think that combination of me using current limiting and building u-boot on unsupported platform (x86-64-linux) without the cross compiling caused this issue, but I am still working on it.

Currently not sure why the installed image is not preserving the configuration, but keeps the /etc/nixos that I gave it? (I've created user kreyren and kodi config, but those do not preserve after reboot)

Mic92 commented 3 years ago

I think that combination of me using current limiting and building u-boot on unsupported platform (x86-64-linux) without the cross compiling caused this issue, but I am still working on it.

Currently not sure why the installed image is not preserving the configuration, but keeps the /etc/nixos that I gave it? (I've created user kreyren and kodi config, but those do not preserve after reboot)

Is your actual /boot partition not mounted when you installing updates?

Mic92 commented 3 years ago

I also build the uboot image I posted on x86_64.

hodlwave commented 2 years ago

Hi @Mic92,

I am getting the same hanging error as posted above when I try to boot my RockPro64 the NixOS image that I copied to my SD card (pasted @Kreyren's logs because I can't access my own but they're basically identical):

Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:3...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
692 bytes read in 6 ms (112.3 KiB/s)
1:  NixOS - Default
Retrieving file: /boot/extlinux/../nixos/0avjs0xfcjkhnnv6zcqfr2i7miv9ijli-initrd-linux-5.10.52-initrd
8210128 bytes read in 356 ms (22 MiB/s)
Retrieving file: /boot/extlinux/../nixos/2xgc4ljvras2j0gp0kik9hkrk3kzylyg-linux-5.10.52-Image
43661824 bytes read in 1817 ms (22.9 MiB/s)
append: init=/nix/store/iwl96rdx5yvlm5jvnbxx3kw6rz5z12fq-nixos-system-nixos-21.05.1817.2262d7863a6/init console=ttyS0,115200n8 console=ttyAMA0,115200n8 console=tty0 loglevel=7
Retrieving file: /boot/extlinux/../nixos/2xgc4ljvras2j0gp0kik9hkrk3kzylyg-linux-5.10.52-dtbs/rockchip/rk3399-rockpro64.dtb
56812 bytes read in 13 ms (4.2 MiB/s)
Moving Image from 0x2080000 to 0x2200000, end=4c50000
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000

I built the nix image that targets the RockPro64 (i.e. $ nix-build -A rockPro64) so that's not the issue. Do you have any idea how I might fix this?

Here's the sfdisk dump for reference:

$ sfdisk --dump result
label: gpt
label-id: DD818A7F-82E7-774A-B4AC-CA9E5C2971E6
device: result
unit: sectors
first-lba: 64
last-lba: 6523463
sector-size: 512

result1 : start=          64, size=       16320, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=1D78A73E-A7C0-DC4C-9B75-F137822226FE, name="idbloader"
result2 : start=       16384, size=       16384, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=CD5F3C77-BB0C-FF42-BD66-B2E0B9781567, name="uboot"
result3 : start=       32768, size=     6490696, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=97581DF4-E89E-274E-854F-D5F2CCE1EB3E, name="nixos", attrs="LegacyBIOSBootable"
jtrees commented 2 years ago

It hangs for me too and looks just the same as @hodlwave posted.

Mic92 commented 2 years ago

Maybe it's an issue with the uboot? I remember that we had on raspberry pi once a problem that uboot no longer allocated enough memory to load the kernel. One could try to borrow idbloader and uboot from a different distribution. I don't own this particular hardware myself so I cannot test.

jtrees commented 2 years ago

Yeah, I just tried installing and booting into Armbian and that worked right away so perhaps that's a candidate? I'm not sure exactly how to "borrow idbloader and uboot" from there though.

Do you have any pointers on what to look up to figure it out? I'm still pretty new to this stuff (bootloaders and ARM in general).

jtrees commented 2 years ago

I got it working. Noticed I was using the stable channel the whole time, but unstable has some newer uboot stuff. This line here got me an image that booted successfully:

NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos-unstable:$NIX_PATH" nix-build -A rockPro64
Mic92 commented 2 years ago

OK I added a hint that one needs nixpkgs-unstable: https://github.com/Mic92/nixos-aarch64-images#supported-boards

hodlwave commented 2 years ago

The nixos-unstable channel worked for me too. Thank you both!

stites commented 2 years ago

works for me too! a quick comment -- it looks like eMMC does not work for me -- I needed to pull out an old SD card. Not sure why this would be an issue.