tfirst 发表于 2023-5-18 17:18:48

RK3588Q从外挂的SSD引导系统

本帖最后由 tfirst 于 2023-5-18 17:32 编辑

RK3588Q从外挂的SSD引导系统硬件:AIO-3588Q+Samsung SSD(nvme,1TB)软件:buildroot (sdk 版本:v1.0.6f.)按照文档《Rockchip Developer Guide Dual StorageCN》(Rockchip_Developer_Guide_Dual_Storage_CN.pdf)中的步骤,在uboot及kernel中进行dts设置如下:1、 在内核中修改rk3588-firefly-aio-3588q.dtsi文件中的宏M2_SATA_OR_PCIE为0。2、 在uboot中:rk3588-u-boot.dtsi文件,       chosen{            stdout-path= &uart2;            //u-boot,spl-boot-order = &sdmmc, &sdhci, &spi_nand, &spi_nor;            u-boot,spl-boot-order= &sdhci, &spi_nand, &spi_nor;       };在根节点上添加如下:       vcc12v_dcin:vcc12v_dcin {             u-boot,dm-pre-reloc;            compatible= "regulator-fixed";            regulator-name= "vcc12v_dcin";            regulator-always-on;            regulator-boot-on;            //status= "okay";            regulator-min-microvolt= <12000000>;            regulator-max-microvolt= <12000000>;       };          vcc_sata_pwr_en:vcc-sata-pwr-en-regulator {             u-boot,dm-pre-reloc;            compatible= "regulator-fixed";            regulator-name= "vcc_sata_pwr_en";            regulator-min-microvolt= <3300000>;            regulator-max-microvolt= <3300000>;                     regulator-boot-on;            regulator-always-on;            enable-active-high;            status= "okay";            gpio= <&pca9555 PCA_IO1_2 GPIO_ACTIVE_HIGH>;            startup-delay-us= <5000>;            vin-supply= <&vcc12v_dcin>;                };并使能相应模块&combphy0_ps {       u-boot,dm-pre-reloc;       status= "okay";};/* pca9555 *//*&pca9555{        u-boot,dm-pre-reloc;       status= "okay"; };*/ &pcie2x1l2 {       u-boot,dm-pre-reloc;       reset-gpios=<&pca9555 PCA_IO1_6GPIO_ACTIVE_HIGH>;       vpcie3v3-supply= <&vcc_sata_pwr_en>;       status= "okay";}; &i2c6 {       u-boot,dm-pre-reloc;       clock-frequency= <400000>;       status= "okay";       pinctrl-names= "default";       pinctrl-0= <&i2c6m0_xfer>;              pca9555_1:gpio@20 {            u-boot,dm-pre-reloc;       compatible = "nxp,pca9555";       reg = <0x20>;       gpio-controller;      #gpio-cells = <2>;       gpio-group-num = <300>;       status = "okay";   };              pca9555:gpio@21 {             u-boot,dm-pre-reloc;            compatible= "nxp,pca9555";             reg= <0x21>;             gpio-controller;            #gpio-cells= <2>;             gpio-group-num= <200>;             status= "okay";       };};&pcfg_pull_none_smt {       u-boot,dm-spl;       bias-disable;       input-schmitt-enable;};在pinctrl节点中,添加:       i2c6{            u-boot,dm-spl;            i2c6m0_xfer:i2c6m0-xfer {                     u-boot,dm-spl;                     rockchip,pins=                            /*i2c6_scl_m0 */                            <0RK_PD0 9 &pcfg_pull_none_smt>,                            /*i2c6_sda_m0 */                            <0RK_PC7 9 &pcfg_pull_none_smt>;            };       };修改firefly-linux.config文件:CONFIG_OF_U_BOOT_REMOVE_PROPS="clock-namesinterrupt-parent assigned-clocks assigned-clock-ratesassigned-clock-parents" 并添加如下内容:CONFIG_CMD_I2C=yCONFIG_CMD_PCI=yCONFIG_NVME=yCONFIG_PCI=yCONFIG_DM_PCI=yCONFIG_DM_PCI_COMPAT=yCONFIG_PCIE_DW_ROCKCHIP=yCONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=yCONFIG_PHY_ROCKCHIP_SNPS_PCIE3=yCONFIG_DM_REGULATOR_FIXED=yCONFIG_ROCKCHIP_BOOTDEV="nvme 0"CONFIG_EMBED_KERNEL_DTB_ALWAYS=y#CONFIG_EMBED_KERNEL_DTB_PATH="dts/kern.dtb"CONFIG_SPL_FIT_IMAGE_KB=2560 将编译内核时编译出来的dtb拷贝到u-boot/dts/kern.dtb中。 修改完成后,重新编译,可以在uboot中识别出ssd。信息如下:=> pci scanScanning PCI devices on bus 0BusDevFun VendorId   DeviceId   Device Class       Sub-Class_____________________________________________________________00.00.000x1d87   0x3588   Bridge device         0x04=> Scanning PCI devices on bus 0BusDevFun VendorId   DeviceId   Device Class       Sub-Class_____________________________________________________________00.00.000x1d87   0x3588   Bridge device         0x04=> pci 1Scanning PCI devices on bus 1BusDevFun VendorId   DeviceId   Device Class       Sub-Class_____________________________________________________________01.00.000x144d   0xa809   Mass storage controller 0x08=> Scanning PCI devices on bus 1BusDevFun VendorId   DeviceId   Device Class       Sub-Class_____________________________________________________________01.00.000x144d   0xa809   Mass storage controller 0x08=> nvme scan=> nvme detailsBlk device 0: Optional Admin CommandSupport:       Namespace Management/Attachment: no       Firmware Commit/Image download: yes       Format NVM: yes       Security Send/Receive: yesBlk device 0: Optional NVM Command Support:       Reservation: yes       Save/Select field in the Set/Get features: no       Write Zeroes: yes       Dataset Management: no       Write Uncorrectable: yesBlk device 0: Format NVM Attributes:       Support Cryptographic Erase: yes       Support erase a particular namespace: Yes       Support format a particular namespace: NoBlk device 0: LBA Format Support:Blk device 0: End-to-End DataProtectCapabilities:       As last eight bytes: No       As first eight bytes: No       Support Type3: No       Support Type2: No       Support Type1: NoBlk device 0: Metadata capabilities:      As part of a separate buffer: No       As part of an extended data LBA: No=> Blk device 0: Optional Admin CommandSupport:       Namespace Management/Attachment: no       Firmware Commit/Image download: yes       Format NVM: yes       Security Send/Receive: yesBlk device 0: Optional NVM Command Support:       Reservation: yes       Save/Select field in the Set/Get features: no       Write Zeroes: yes       Dataset Management: no       Write Uncorrectable: yesBlk device 0: Format NVM Attributes:       Support Cryptographic Erase: yes       Support erase a particular namespace: Yes       Support format a particular namespace: NoBlk device 0: LBA Format Support:Blk device 0: End-to-End DataProtectCapabilities:       As last eight bytes: No       As first eight bytes: No       Support Type3: No       Support Type2: No       Support Type1: NoBlk device 0: Metadata capabilities:       As part of a separate buffer: No       As part of an extended data LBA: No=> nvme infoDevice 0: Vendor: 0x144d Rev: 3B4QFXO7Prod: S649NL0W205605E            Type: Hard Disk         Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)=>
使用RKDevTool.exe(v2.96)烧录各个固件:
其中: parameter_emmc.txt文件的内容如下:FIRMWARE_VER: 1.0MACHINE_MODEL: RK3588MACHINE_ID: 007MANUFACTURER: RK3588MAGIC: 0x5041524BATAG: 0x00200800MACHINE: 0xffffffffCHECK_MASK: 0x80PWR_HLD: 0,0,A,0,1TYPE: GPTCMDLINE: mtdparts=rk29xxnand:0x00004000@0x00004000(uboot)
parameter_nvme.txt文件的内容如下:FIRMWARE_VER: 1.0MACHINE_MODEL: RK3588MACHINE_ID: 007MANUFACTURER: RK3588MAGIC: 0x5041524BATAG: 0x00200800MACHINE: 0xffffffffCHECK_MASK: 0x80PWR_HLD: 0,0,A,0,1TYPE: GPTCMDLINE: mtdparts=rk29xxnand:0x00002000@0x00008000(misc),0x00080000@0x0000a000(boot:bootable),0x00040000@0x0008a000(recovery),0x00010000@0x000ca000(backup),0x00c00000@0x000da000(rootfs),-@0x0cda000(userdata:grow)uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9
在进行分区配置时,会如下错误。
点击“执行”按钮后,软件会报错:”xxx” did not find matchpartition(xxx分别为:misc、boot、recovery、backup、rootfs、userdata)
不理会错误,重新进入maskrom模式后,选择“强制按地址写”,从软件的日志上看,似乎可以正确烧录。烧录完成后,自动重启,串口打印如下信息:doneSaving random seed: OKrealpath: /dev/block/by-name: No such fileor directoryWill now mount all partitions in /etc/fstabstrings: : No such file or directoryNote: Will skip fsck, remove /.skip_fsck toenableLog saved to /tmp/mountall.logStarting network: cmdline=storagemedia=nvmeandroidboot.storagemedia=nvme androidboot.mode=normalstoragenode=/pcie@fe190000androidboot.verifiedbootstate=orange ro rootwaitearlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 irqchip.gicv3_pseudo_nmi=0root=PARTLABEL=rootfs rootfstype=ext4 overlayroot=device:dev=PARTLABEL=userdata,fstype=ext4,mkfs=1coherent_pool=1m systemd.gpt_auto=0 cgroup_enable=memory swapaccount=1
read console from cmdline is /dev/ttyFIQ0Starting recovery on Thu May 18 09:00:192023
Recovery System have UI defined.failed to read font: res=-1, fall back tothe compiled-in fontOKDebug: configfs_initrotate degree: 0 - none, 1 - right, 2 -down, 3 - left.current rotate degree is : 0mkdir: can't create directory'/sys/kernel/config/usb_gadget/rockchip/functions/uac1.gs0': No such file ordirectorymkdir: can't create directory'/sys/kernel/config/usb_gadget/rockchip/functions/uac2.gs0': No such file ordirectory[   7.857208] file system registeredmkdir: can't create directory'/sys/kernel/config/usb_gadget/rockchip/functions/mtp.gs0': No such file ordirectory[   7.864041] using random self ethernet address[   7.864085] using random host ethernet address[   7.868268] Mass Storage Function, version: 2009/09/11[   7.868334] LUN: removable file: (no medium)mkdir: can't create directory'/sys/kernel/config/usb_gadget/rockchip/functions/hid.usb0': No such file ordirectory[   7.898766] read descriptors[   7.898825] read strings[   8.158843] rk_hdmirx fdee0000.hdmirx-controller:hdmirx_cancel_cpu_limit_freq freq qos nod add[   8.171203] rk-pcie fe150000.pcie: PCIe Link Fail[   8.171217] rk-pcie fe150000.pcie: failed to initialize hostStarting input-event-daemon:input-event-daemon: Start parsing /etc/input-event-daemon.conf...input-event-daemon: Adding device:/dev/input/event0...input-event-daemon: Adding device:/dev/input/event1...input-event-daemon: Adding device:/dev/input/event2...input-event-daemon: Adding device:/dev/input/event3...input-event-daemon: Adding device:/dev/input/event4...input-event-daemon: Start listening on 5devices...done# [    9.106625] dwc3 fc000000.usb: device reset[   9.231491] android_work: sent uevent USB_STATE=CONNECTED[   9.410018] dwc3 fc000000.usb: device resetrecovery filesystem table=========================0(null) /tmp ramdisk (null) (null) (null)1/dev/root / ext4 rw,noauto 0 12proc /proc proc defaults 0 03devpts /dev/pts devpts defaults,gid=5,mode=620 0 04tmpfs /dev/shm tmpfs mode=0777 0 05tmpfs /tmp tmpfs mode=1777 0 06tmpfs /run tmpfs mode=0755,nosuid,nodev 0 07sysfs /sys sysfs defaults 0 08/dev/block/by-name/misc /misc emmc defaults 0 09/dev/block/by-name/userdata /userdata ext4 defaults 0 010/dev/block/by-name/oem /oem ext2 defaults 0 011/dev/sda1 /mnt/usb_storage vfat defaults 0 012/dev/mmcblk1p1 /mnt/external_sd vfat defaults 0 013/dev/block/by-name/oem /oem ext2 defaults 0 214/dev/block/by-name/userdata /userdata ext4 defaults 0 2
executing '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0stat /dev/block/by-name/misc try 1: No suchfile or directory[   9.494680] usb 4-1: new SuperSpeed Gen 1 USB device number 2 usingxhci-hcd[   9.519634] usb 4-1: New USB device found, idVendor=05e3, idProduct=0620,bcdDevice=93.91[   9.519701] usb 4-1: New USB device strings: Mfr=1, Product=2,SerialNumber=0[   9.519716] usb 4-1: Product: USB3.2 Hub[   9.519729] usb 4-1: Manufacturer: GenesysLogic[   9.548335] hub 4-1:1.0: USB hub found[   9.548757] hub 4-1:1.0: 4 ports detected[   9.574729] android_work: sent uevent USB_STATE=CONFIGURED[   9.638183] usb 3-1: new high-speed USB device number 2 using xhci-hcd[   9.781305] usb 3-1: New USB device found, idVendor=05e3, idProduct=0610,bcdDevice=93.91[   9.781352] usb 3-1: New USB device strings: Mfr=1, Product=2,SerialNumber=0[   9.781365] usb 3-1: Product: USB2.1 Hub[   9.781376] usb 3-1: Manufacturer: GenesysLogic[   9.836774] hub 3-1:1.0: USB hub found[   9.837194] hub 3-1:1.0: 4 ports detectedstat /dev/block/by-name/misc try 2: No suchfile or directorystat /dev/block/by-name/misc try 3: No suchfile or directorystat /dev/block/by-name/misc try 4: No suchfile or directorystat /dev/block/by-name/misc try 5: No suchfile or directorystat /dev/block/by-name/misc try 6: No suchfile or directorystat /dev/block/by-name/misc try 7: No suchfile or directorystat /dev/block/by-name/misc try 8: No suchfile or directorystat /dev/block/by-name/misc try 9: No suchfile or directorystat /dev/block/by-name/misc try 10: Nosuch file or directoryfailed to stat /dev/block/by-name/miscemmc_point is /dev/mmcblk0sd_point is (null)sd_point_2 is (null)Recovery start....................read cmdline>>> Boot from non-SDcardexecuting '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY devices is not MTD.stat /dev/block/by-name/misc try 1: No suchfile or directorystat /dev/block/by-name/misc try 2: No suchfile or directorystat /dev/block/by-name/misc try 3: No suchfile or directorystat /dev/block/by-name/misc try 4: No suchfile or directorystat /dev/block/by-name/misc try 5: No suchfile or directorystat /dev/block/by-name/misc try 6: No suchfile or directorystat /dev/block/by-name/misc try 7: No suchfile or directorystat /dev/block/by-name/misc try 8: No suchfile or directorystat /dev/block/by-name/misc try 9: No suchfile or directorystat /dev/block/by-name/misc try 10: Nosuch file or directoryfailed to stat /dev/block/by-name/miscRECOVERY Can't open/dev/block/by-name/misc(No such file or directory)executing '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY failed to mount /userdata (Nosuch file or directory)RECOVERY Can't mount/userdata/recovery/commandexecuting '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY devices is not MTD.Command: "/usr/bin/recovery"
finish_recovery Enter.....executing '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY failed to mount /userdata (Nosuch file or directory)RECOVERY Can't mount/userdata/recovery/logRECOVERY Can't open/userdata/recovery/logexecuting '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY failed to mount /userdata (Nosuch file or directory)RECOVERY Can't mount/userdata/recovery/last_logRECOVERY Can't open/userdata/recovery/last_logexecuting '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY devices is not MTD.executing '/usr/bin/relink-block.sh'executed '/usr/bin/relink-block.sh' doneexecuted '/usr/bin/relink-block.sh' return0RECOVERY failed to mount /userdata (Nosuch file or directory)RECOVERY Can't unlink/userdata/recovery/command
发现没有进入weston桌面,也没有发现其他分区:# # ls /dev/block/179:0   179:64   253:0    7:0   7:2      7:4      7:6   by-name179:321:0      259:0    7:1   7:3      7:5      7:7# ls /dev/block/by-name/misc# ls /dev/nvme0nvme0   nvme0n1# ls /dev/nvme*/dev/nvme0    /dev/nvme0n1#
除了uboot.img外,其他同样的镜像文件,烧录到emmc上,使用emmc启动引导,可以正常进入weston桌面。
不知道是什么原因。开机启动日志见附件

loading 发表于 2023-5-19 17:41:48

如果不强制按地址写呢? (没有的就不烧录,把前面勾选去掉)

tfirst 发表于 2023-5-19 22:25:08

本帖最后由 tfirst 于 2023-5-22 09:15 编辑

loading 发表于 2023-5-19 17:41
如果不强制按地址写呢? (没有的就不烧录,把前面勾选去掉)
“把前面勾选去掉”———把哪些去掉?每个分区都要。
如果不强制按地址写,有时会报错,会报说“超过flash大小的错误”,但是每个分区的大小实际都大于每一个镜像文件的大小的。偶尔又不会报这个错误,不知道为啥?但是在没报错的情况下烧录完成后,自动重启进入recovery模式,此时可以看到nvme0被分成了好几个分区,并进行格式化,recovery完成后自动重启,kernel就再也无法引导了,直接进入uboo命令行模式,此时用part list nvme 0去查看分区情况,返回错误,没有分区信息,用part list emmc 0去查看emmc的分区,可以看到如第一个parameter.txt文件所示的分区,但是如果在烧录完成后,人为介入,使进入uboot命令行模式去查看nvme的分区信息,此时是可以看到如第二个parameter.txt所示的那些分区,所以怀疑是recovery模式破坏了分区信息,但是将wipeoff 的misc镜像换成blank的镜像烧录进去后,启动就只能进入uboot命令行模式,而不能正常引导kernel。
对这个recovery不熟悉,不知道该是哪里破坏了分区信息,能否指导一下?(我也尝试更换recovery程序去调试,结果即使没有做任何改动,仅仅是将rk3588*.cpio.gz解压,然后再压缩,去替换制作recovery.img文件所需要的那个rk3588*.cpio.gz文件,制作出来的recovery.img文件烧录进入后,就只能进入uboot命令行模式,而不能正常引导kernel,不知道制作这个cpio文件该用什么命令?)
另外,关于不强制按地址写,有时会报比flash大的错误问题,不知道是不是跟emmc刷过misc、kernel、recovery等分区的原因?目前还没有找到规律。

补充:通过《瑞芯微开发工具》V2.96的高级功能,去擦除emmc,再烧录,会报如下图所示的错误,无法烧录。



loading 发表于 2023-5-22 09:44:02

tfirst 发表于 2023-5-19 22:25
“把前面勾选去掉”———把哪些去掉?每个分区都要。
如果不强制按地址写,有时会报错,会报说“超过fl ...

我目前也在尝试spinor+sata 方式,也是进入recovery 模式,进不到系统

tfirst 发表于 2023-5-22 10:33:54

loading 发表于 2023-5-22 09:44
我目前也在尝试spinor+sata 方式,也是进入recovery 模式,进不到系统

我的是buildroot,不是android系统。
你的分区文件是不是跟我的那两个pameter类似:写进emmc的分区只有uboot分区,写进nvme的分区是除了uboot之外的分区?
你的不强制写,能烧录进行吗?之前怀疑是emmc烧录过全部分区,所以导致不强制写pcie,就写不进去,但是经过验证,我擦除了emmc后,再烧录,就是会报错。偶尔能烧录,都不知道怎么才能烧录进去,现在如果不强制写的话,一直都烧录不进去。

loading 发表于 2023-5-22 12:48:55

我的也是Linux,buildroot、Debian 都有,我没有emmc(spinor,你可以理解为你的emmc),我不强制是可以烧录的(你也可以看下那文档里面也没有强制)。
parameter 我参考了文档的:
我是怀疑跟这个有关:
RECOVERY devices is not MTD.
stat /dev/block/by-name/misc try 1: No suchfile or directory

loading 发表于 2023-5-22 12:49:18

parameter 我参考了文档的:
mtdparts=sfc_nor:0x00040000@0x00180000(vnvm),0x00600000@0x00200000(uboot)

tfirst 发表于 2023-5-22 13:48:00

loading 发表于 2023-5-22 12:49
parameter 我参考了文档的:
mtdparts=sfc_nor:0x00040000@0x00180000(vnvm),0x00600000@0x00200000(uboot ...

用了这个参数,会有弹框(”xxx” did not find matchpartition)提示吗?

loading 发表于 2023-5-22 15:45:03

tfirst 发表于 2023-5-22 13:48
用了这个参数,会有弹框(”xxx” did not find matchpartition)提示吗?

不会,都正常,烧录工具也要添加vnvm

tfirst 发表于 2023-5-22 15:53:22

loading 发表于 2023-5-22 15:45
不会,都正常,烧录工具也要添加vnvm

那听奇怪的。为啥我的会有弹框提示呢?我的第一个Parameter.txt文件根据你的提示改成:
mtdparts=rk29xxnand:0x00000200@00001c0(vnvm),0x00004000@0x00004000(uboot)
第二个parameter.txt文件是去除了uboot分区之后的,如下:
mtdparts=rk29xxnand:0x00002000@0x00008000(misc),0x00080000@0x0000a000(boot:bootable),0x00040000@0x0008a000(recovery),0x00010000@0x000ca000(backup),0x00c00000@0x000da000(rootfs),-@0x0cda000(userdata:grow)
在烧录的时候还是有一个错误弹框:“misc” did not find matchpartition”的提示。

为啥呢?
页: [1] 2 3
查看完整版本: RK3588Q从外挂的SSD引导系统