boobypi Posted December 7, 2017 Posted December 7, 2017 Hello, Just some word to know MX10 RK3328 can have an uboot legacy 4.4 working in emmc with the defaut rk3328-evb board config. I follow the guide [RK3328_Linux-Debian_V1.1_Development_Guide-20170711.pdf]. I suggest before trying anything to be sure you have an working usb loader for your BOX (usb loader from rkbin github don't work for example). You can find it in android update firmware image, unpack it with https://github.com/TeeFirefly/rk2918_tools.git And try on box in recovery mode : To remenber information about your emmc (in case it show 0MB capacity) Be carefull with the default parameter_gpt file, it's setup 512bytes page size and if you erase you emmc will show 0MB capacity so bad!) sudo ./rkdeveloptool rfi Flash Info: Manufacturer: SAMSUNG, value=00 Flash Size: 29820 MB Block Size: 512 KB Page Size: 2 KB ECC Bits: 0 Access Time: 40 Flash CS: Flash<0> sudo ./rkdeveloptool rd 3 //reboot device in maskrom mode sudo ./rkdeveloptool db RK3328MiniLoaderAll_MX10.bin (extracted from MX10 firmware) Downloading bootloader succeeded. Now you are sure to be able to debrick the box if thing go wrong :) parameter_gpt.txt used FIRMWARE_VER: 6.0.0 MACHINE_MODEL: RK3328 MACHINE_ID: 007 MANUFACTURER: RK3328 MAGIC: 0x5041524B ATAG: 0x00200800 MACHINE: 3328 CHECK_MASK: 0x80 PWR_HLD: 0,0,A,0,1 #KERNEL_IMG: 0x00280000 #FDT_NAME: rk-kernel.dtb #RECOVER_KEY: 1,1,0,20,0 #in section; per section 2048(0x800) bytes <<===== BE CAREFULL with PAGE SIZE BEFORE ERASE CMDLINE: mtdparts=rk29xxnand:0x00001f40@0x00000040(loader1),0x00000080@0x00001f80(reserved1),0x00002000@0x00002000(reserved2),0x00002000@0x00004000(loader2),0x00002000@0x00006000(atf),0x00038000@0x00008000(boot:bootable),-@0x0040000(rootfs) Spoiler ␀DDR version 1.08 20170712 4GB In SRX DDR3 333MHz Bus Width=32 Col=11 Bank=8 Row=16 CS=1 Die Bus-Width=16 Size=4096MB ddrconfig:3 OUT Boot1 Release Time: 2017-06-12, version: 2.44 ChipType = 0x11, 230 SdmmcInit=2 0 BootCapSize=2000 UserCapSize=29820MB FwPartOffset=2000 , 2000 SdmmcInit=0 2 StorageInit ok = 20633 Raw SecureMode = 0 SecureInit read PBA: 0x4 SecureInit read PBA: 0x404 SecureInit read PBA: 0x804 SecureInit read PBA: 0xc04 SecureInit read PBA: 0x1004 SecureInit ret = 0, SecureMode = 0 LoadTrustBL No find bl30.bin No find bl32.bin Load uboot, ReadLba = 2000 Load OK, addr=0x200000, size=0x888dc RunBL31 0x10000 NOTICE: BL31: v1.3(debug):f947c7e NOTICE: BL31: Built : 09:28:45, May 31 2017 NOTICE: BL31:Rockchip release version: v1.3 INFO: ARM GICv2 driver initialized INFO: Using opteed sec cpu_context! INFO: boot cpu mask: 1 INFO: plat_rockchip_pmu_init: pd status 0xe INFO: BL31: Initializing runtime services WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK ERROR: Error initializing runtime service opteed_fast INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x200000 INFO: SPSR = 0x3c9 U-Boot 2017.09-g9ea7f39-dirty (Dec 06 2017 - 11:07:06 -1000) Model: Rockchip RK3328 EVB DRAM: 4 GiB MMC: rksdmmc@ff500000: 1, rksdmmc@ff520000: 0 Card did not respond to voltage select! mmc_init: -95, time 9 *** Warning - No block device, using default environment In: serial@ff130000 Out: serial@ff130000 Err: serial@ff130000 Model: Rockchip RK3328 EVB Net: Net Initialization Skipped No ethernet found. Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0(part 0) is current device Failed to mount ext2 filesystem... ** Unrecognized filesystem type ** Card did not respond to voltage select! mmc_init: -95, time 9 starting USB... USB0: USB EHCI 1.00 USB1: USB OHCI 1.0 USB2: Core Release: 3.10a USB3: Register 2000140 NbrPorts 2 Starting the controller USB XHCI 1.10 scanning bus 0 for devices... 2 USB Device(s) found scanning bus 1 for devices... 1 USB Device(s) found scanning bus 2 for devices... 1 USB Device(s) found scanning bus 3 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Device 0: unknown device No ethernet found. missing environment variable: pxeuuid missing environment variable: bootfile Retrieving file: pxelinux.cfg/00000000 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/0000000 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/000000 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/00000 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/0000 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/000 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/00 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/0 No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/default-arm-rockchip No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/default-arm No ethernet found. missing environment variable: bootfile Retrieving file: pxelinux.cfg/default No ethernet found. Config file not found No ethernet found. No ethernet found. => ␇␇␇␇ => => printenv arch=arm baudrate=1500000 board=evb_rk3328 board_name=evb_rk3328 boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr} boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf boot_net_usb_start=usb start boot_prefixes=/ /boot/ boot_script_dhcp=boot.scr.uimg boot_scripts=boot.scr.uimg boot.scr boot_targets=mmc0 mmc1 usb0 pxe dhcp bootcmd=run distro_bootcmd bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci; bootcmd_mmc0=setenv devnum 0; run mmc_boot bootcmd_mmc1=setenv devnum 1; run mmc_boot bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi bootcmd_usb0=setenv devnum 0; run usb_boot bootdelay=2 cpu=armv8 devnum=0 devplist=6 devtype=mmc distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done efi_dtb_prefixes=/ /dtb/ /dtb/current/ fdt_addr_r=0x01f00000 fdtcontroladdr=fcf21668 kernel_addr_r=0x02000000 load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile} mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi partitions=uuid_disk=${uuid_gpt_disk};name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};name=loader2,start=8MB,size=4MB,uuid=${uuid_gpt_loader2};name=trust,size=4M,uuid=${uuid_gpt_atf};name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};name=rootfs,size=-,uuid=B921B045-1DF0-41C3-AF44-4C6F280D3FAE; pxefile_addr_r=0x00600000 ramdisk_addr_r=0x04000000 scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi; scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done scriptaddr=0x00500000 soc=rockchip stderr=serial@ff130000 stdin=serial@ff130000 stdout=serial@ff130000 usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi vendor=rockchip Environment size: 3903/32764 bytes => arch=arm baudrate=1500000 board=evb_rk3328 board_name=evb_rk3328 boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr} boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf boot_net_usb_start=usb start boot_prefixes=/ /boot/ boot_script_dhcp=boot.scr.uimg boot_scripts=boot.scr.uimg boot.scr boot_targets=mmc0 mmc1 usb0 pxe dhcp bootcmd=run distro_bootcmd bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci; bootcmd_mmc0=setenv devnum 0; run mmc_boot bootcmd_mmc1=setenv devnum 1; run mmc_boot bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi bootcmd_usb0=setenv devnum 0; run usb_boot bootdelay=2 cpu=armv8 devnum=0 devplist=6 devtype=mmc distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done efi_dtb_prefixes=/ /dtb/ /dtb/current/ fdt_addr_r=0x01f00000 fdtcontroladdr=fcf21668 kernel_addr_r=0x02000000 load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile} mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi partitions=uuid_disk=${uuid_gpt_disk};name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};name=loader2,start=8MB,size=4MB,uuid=${uuid_gpt_loader2};name=trust,size=4M,uuid=${uuid_gpt_atf};name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};name=rootfs,size=-,uuid=B921B045-1DF0-41C3-AF44-4C6F280D3FAE; pxefile_addr_r=0x00600000 ramdisk_addr_r=0x04000000 scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi; scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done scriptaddr=0x00500000 soc=rockchip stderr=serial@ff130000 stdin=serial@ff130000 stdout=serial@ff130000 usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi vendor=rockchip Environment size: 3903/32764 bytes => help ? - alias for 'help' base - print or set address offset bdinfo - print Board Info structure boot - boot default, i.e., run 'bootcmd' bootd - boot default, i.e., run 'bootcmd' bootefi - Boots an EFI payload from memory bootelf - Boot from an ELF image in memory booti - boot arm64 Linux Image image from memory bootm - boot application image from memory bootp - boot image via network using BOOTP/TFTP protocol bootvx - Boot vxWorks from an ELF image bootz - boot Linux zImage image from memory cmp - memory compare coninfo - print console devices and information cp - memory copy crc32 - checksum calculation dhcp - boot image via network using DHCP/TFTP protocol dm - Driver model low level access echo - echo args to console editenv - edit environment variable env - environment handling commands erase - erase FLASH memory exit - exit script ext2load- load binary file from a Ext2 filesystem ext2ls - list files in a directory (default /) ext4load- load binary file from a Ext4 filesystem ext4ls - list files in a directory (default /) ext4size- determine a file's size false - do nothing, unsuccessfully fastboot- use USB or UDP Fastboot protocol fatinfo - print information about filesystem fatload - load binary file from a dos filesystem fatls - list files in a directory (default /) fatsize - determine a file's size fatwrite- write file into a dos filesystem fdt - flattened device tree utility commands flinfo - print FLASH memory information fstype - Look up a filesystem type go - start application at address 'addr' gpt - GUID Partition Table help - print command description/usage iminfo - print header information for application image imxtract- extract a part of a multi-image itest - return true/false on integer compare load - load binary file from a filesystem loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line loadx - load binary file over serial line (xmodem mode) loady - load binary file over serial line (ymodem mode) loop - infinite loop on address range ls - list files in a directory (default /) md - memory display mii - MII utility commands mm - memory modify (auto-incrementing address) mmc - MMC sub system mmcinfo - display MMC info mw - memory write (fill) nfs - boot image via network using NFS protocol nm - memory modify (constant address) part - disk partition related commands ping - send ICMP ECHO_REQUEST to network host printenv- print environment variables protect - enable or disable FLASH write protection pxe - commands to get and boot from pxe files reset - Perform RESET of the CPU rockusb - Use the rockusb Protocol run - run commands in an environment variable save - save file to a filesystem saveenv - save environment variables to persistent storage setenv - set environment variables showvar - print local hushshell variables size - determine a file's size sleep - delay execution for some time source - run script from memory sysboot - command to get and boot from syslinux files test - minimal test like /bin/sh tftpboot- boot image via network using TFTP protocol time - run commands and summarize execution time true - do nothing, successfully usb - USB sub-system usbboot - boot from USB device version - print monitor, compiler and linker version => save save saveenv => saveenv Saving Environment to MMC... Card did not respond to voltage select! mmc_init: -95, time 9 !No block device => => RK3328MiniLoaderAll.bin
boobypi Posted December 7, 2017 Author Posted December 7, 2017 In case of brick, there is 2 pad bottom emmc that can be shorted with a 10Ohm resistor or whatever near from you to put the box in maskrom mode (tested without problem). In maskrom mode you will need to load usb loader to do anything. Basicaly i done these steps mkdir rockchip/ cd rockchip/ git clone https://github.com/rockchip-linux/rkbin.git git clone https://github.com/rockchip-linux/u-boot.git git clone https://github.com/rockchip-linux/build.git sudo apt install gcc-aarch64-linux-gnu git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools //make uboot image ./mk-uboot.sh rk3328-evb //tool for flashing in maskrom mode git clone https://github.com/rockchip-linux/rkdeveloptool.git cd rkdeveloptool/ cat Readme.txt autoreconf -i ./configure make sudo ./rkdeveloptool rd 3 Reset Device OK. sudo ./rkdeveloptool db ../out/u-boot/RK3328MiniLoaderAll_MX10.bin Downloading bootloader succeeded. //editing parameter_gpt file then erasing emmc sudo ./rkdeveloptool ef //writing new partition table sudo ./rkdeveloptool gpt ../parameter_gpt.txt **********GPT Info********** NO LBA Name 00 00000040 loader1 01 00001F80 reserved1 02 00002000 reserved2 03 00004000 loader2 04 00006000 atf 05 00008000 boot 06 00040000 rootfs sudo ./rkdeveloptool wl 0x40 ../out/u-boot/idbloader.img sudo ./rkdeveloptool wl 0x4000 ../out/u-boot/uboot.img sudo ./rkdeveloptool wl 0x6000 ../out/u-boot/trust.img If i remember weel in this state the box don't want to start but wasn't in maskmode, I connect the 2 pads to short Emmc for 1 sec while connecting usb and i upgrade the loader with this cmd : sudo ./rkdeveloptool db ../out/u-boot/RK3328MiniLoaderAll_MX10.bin Downloading bootloader succeeded. sudo ./rkdeveloptool ul ../out/u-boot/RK3328MiniLoaderAll_MX10.bin Upgrading loader succeeded. Now it's booting with console at 1500000
boobypi Posted December 14, 2017 Author Posted December 14, 2017 Uboot Software is a bit deceiving for now, as example : they release an gmac driver but without phy driver and no clocks tree for gmac driver available. No documentation about clock tree configuration, internal PHY is really bad, no chip ref seriously, not well configured for aneg but using init configuration from an old amlogic phy driver (*1) is working a lot better (when you plug a cable you have a link, basicaly )...arm make new with old but they didn't tell it, just fuck. *1 https://github.com/codesnake/linux-amlogic-old/blob/master/drivers/amlogic/ethernet/phy/am_internal.c Fixing save env on emmc instead sdcard working No realease log to know what is working and what is will working maybe in next 5 years :/ sometimes i remember some taking about allwinner poor software support, i can say rockchip is same Without USB3 and better hw encoder/decoder h264, best Soc remain H3, if they can make an H3 with USB3, i will never buy another crap soc with crap sw release! But well this device can boot fine from emmc, (no check for the moment about used pins by sdcard socket) and it's can network boot with an old usb ethernet r8152 adapter well supported by uboot. make thing easier to test linux kernel and let closed enclosure!
Recommended Posts