Open mrbluecoat opened 1 year ago
Hi @mrbluecoat
The NanoPi R5C looks like an interesting piece of hardware! As FriendlyELEC already offers Debian support it should be fairly straightforward to extend edi-boot-shim for it. However, it still takes a considerable amount of time to properly support such a board with the A/B setup I usually do for a robust OTA update. Furthermore I would have to order such a device from China and this might take quite a while. What kind of use case are you planning to do? Is your primary goal to have a robust A/B update available for this device?
Is your primary goal to have a robust A/B update available for this device?
Yes. No rush, though. Thanks in advance for your consideration!
OK, I ordered a R5C and a R6C. Shipping will take quite a while. Let's see if it is easy to support that kind of boards (I do not have too much spare time currently).
If successful, then the R6C will become my new GitHub actions runner: https://www.get-edi.io/Building-and-Testing-OS-Images-with-GitHub-Actions/
Awesome!
The hardware has arrived! Now I need to get familiar with the software setup (and free up some spare time).
Useful links:
NanoPi R5C wiki: https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R5C Rockchip boot flow: https://opensource.rock-chips.com/wiki_Boot_option SD Card image build: https://github.com/friendlyarm/sd-fuse_rk3568 Kernel: https://github.com/friendlyarm/kernel-rockchip/commits/nanopi5-v5.10.y_opt U-Boot documentation: https://u-boot.readthedocs.io/en/latest/board/rockchip/rockchip.html U-Boot: https://github.com/friendlyarm/uboot-rockchip/tree/nanopi5-v2017.09 Upstream setup: https://github.com/inindev/nanopi-r5 Upstream kernel support: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/arm64/boot/dts/rockchip/rk3568-nanopi-r5c.dts?h=v6.4-rc1&id=05620031408ac6cfc6d5c048431827e49aa0ade1
R5C/R5S related U-Boot changes:
Environment with upstream U-Boot:
debian@nanopi5-arm64:~$ sudo fw_printenv
arch=arm
baudrate=1500000
board=evb_rk3568
board_name=evb_rk3568
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 -q ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr -q ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc1 mmc0 pxe dhcp
bootcmd=run distro_bootcmd
bootcmd_dhcp=devtype=dhcp; 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 -q ${fdt_addr_r};;
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_pxe=dhcp; if pxe get; then pxe boot; fi
bootdelay=2
cpu=armv8
cpuid#=54474e4b38340000000000000006170d
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
eth1addr=6e:a5:f6:a3:d6:60
ethaddr=6e:a5:f6:a3:d6:61
fdt_addr_r=0x0a100000
fdtcontroladdr=edf15490
fdtfile=rk3568-nanopi-r5c.dtb
kernel_addr_r=0x02080000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0xc00800
mmc_boot=if mmc dev ${devnum}; then 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=0x00e00000
ramdisk_addr_r=0x0a200000
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 part uuid ${devtype} ${devnum}:${distro_bootpart} distro_bootpart_uuid ; run scan_dev_for_boot; fi; done; setenv devplist
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;run boot_efi_bootmgr;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_binae
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo EXTLINUX 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=0x00c00000
serial#=27017cacd25474f7
soc=rk3568
stderr=serial@fe660000
stdin=serial@fe660000
stdout=serial@fe660000
vendor=rockchip
MMC enumeration with upstream U-Boot:
=> mmc list
mmc@fe2b0000: 1
mmc@fe310000: 0 (eMMC)
U-Boot modifications (downstream variant):
lueschem@ubuntu-bionic:~/workspace/sd-fuse_rk3568/out/uboot-rk3568$ diff configs/nanopi5_defconfig defconfig
10,11d9
< CONFIG_DM_DMC=y
< CONFIG_ROCKCHIP_DMC_FSP=y
63a62
> CONFIG_CMD_GPT_RENAME=y
86a86
> CONFIG_ENV_IS_IN_MMC=y
161a162,163
> CONFIG_DM_DMC=y
> CONFIG_ROCKCHIP_DMC_FSP=y
167d168
< CONFIG_BAUDRATE=1500000
Built on Ubuntu 18.04 (Python2 dependency).
CROSS_COMPILE=aarch64-linux-gnu-
seems to work.
Flashing u-boot:
# incorrect: sudo dd if=out/uboot-rk3568/rk356x_spl_loader_v1.15.112.bin of=/dev/mmcblk0 seek=64 bs=512 conv=notrunc,fsync
sudo dd if=out/uboot-rk3568/uboot.img of=/dev/mmcblk0p1 bs=1M conv=notrunc,fsync
Environment with downstream U-Boot:
pi@NanoPi-R5C:~$ sudo fw_printenv
arch=arm
autoload=no
baudrate=1500000
board=nanopi5
board_name=nanopi5
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
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=mmc1 mmc0 mtd2 mtd1 mtd0 usb0 pxe dhcp
bootargs=storagemedia=sd androidboot.storagemedia=sd androidboot.mode=normal androidboot.dtbo_idx=1
bootcmd=boot_fit;boot_android ${devtype} ${devnum};bootrkp;run distro_bootcmd;
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_mtd0=setenv devnum 0; run mtd_boot
bootcmd_mtd1=setenv devnum 1; run mtd_boot
bootcmd_mtd2=setenv devnum 2; run mtd_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=1
cpu=armv8
devnum=1
devtype=mmc
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
dtb_name=rk3568-nanopi5-rev02.dtb
eth1addr=46:32:2c:32:d8:fe
ethaddr=42:32:2c:32:d8:fe
fdt_addr_r=0x08300000
fdtcontroladdr=0x8300000
kernel_addr_c=0x04080000
kernel_addr_r=0x00280000
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
partitions=uuid_disk=${uuid_gpt_disk};name=uboot,start=8MB,size=4MB,uuid=${uuid_gpt_loader2};name=trust,size=4M,uuid=${uuid_gpt_atf};name=misc,size=4MB,uuid=${uuid_gpt_misc};name=resource,size=16MB,uuid=${uuid_gpt_resource};name=kernel,size=32M,uuid=${uuid_gpt_kernel};name=boot,size=32M,bootable,uuid=${uuid_gpt_boot};name=recovery,size=32M,uuid=${uuid_gpt_recovery};name=backup,size=112M,uuid=${uuid_gpt_backup};name=cache,size=512M,uuid=${uuid_gpt_cache};name=system,size=2048M,uuid=${uuid_gpt_system};name=metadata,size=16M,uuid=${uuid_gpt_metadata};name=vendor,size=32M,uuid=${uuid_gpt_vendor};name=oem,size=32M,uuid=${uuid_gpt_oem};name=frp,size=512K,uuid=${uuid_gpt_frp};name=security,size=2M,uuid=${uuid_gpt_security};name=userdata,size=-,uuid=${uuid_gpt_userdata};
pxefile_addr_r=0x00e00000
ramdisk_addr_r=0x0a200000
rkimg_bootdev=if mmc dev 1 && rkimgtest mmc 1; then setenv devtype mmc; setenv devnum 1; echo Boot from SDcard;elif mmc dev 0; then setenv devtype mmc; setenv devnum 0;elif rksfc dev 1; then setenv devtype spinor; setenv devnum 1;fi;
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;
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_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=0x00c00000
serial#=ba62d1a20f2264d4
soc=rockchip
stderr=serial,vidconsole
stdout=serial,vidconsole
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
vendor=rockchip
Environment (upstream u-boot):
debian@nanopi5-arm64:~$ cat /etc/fw_env.config /dev/mmcblk1 0x3f8000 0x1f000
Any chance you could add a template for the NanoPi R5C?