Allow non-legacy RockPi-S images to boot from their built-in EMMC (aka SDNAND) chips (#4002)

This moves the console from UART2 to UART0 because it
relies on a upgraded Radxa loader blob that only supports console on UART0.
Discussion at:
https://forum.armbian.com/topic/11228-rock-pi-s-rk3308-cpu-is-it-supported-by-anything/page/3
This commit is contained in:
brentr
2022-07-16 01:37:37 -07:00
committed by GitHub
parent d06e43f104
commit 663be6550f
5 changed files with 72 additions and 4 deletions

View File

@@ -4,6 +4,6 @@ BOARDFAMILY="rockpis"
BOOTCONFIG="rock-pi-s-rk3308_defconfig"
DEFAULT_CONSOLE="serial"
MODULES_LEGACY="g_serial"
SERIALCON="ttyS2"
SERIALCON="ttyS0"
KERNEL_TARGET="legacy,current,edge"
BOOT_FDT_FILE="rockchip/rk3308-rock-pi-s.dtb"

View File

@@ -2,6 +2,26 @@ source "${BASH_SOURCE%/*}/include/rockchip64_common.inc"
BOOTPATCHDIR="u-boot-rockchip64"
BOOTENV_FILE='rockpis.txt'
OVERLAY_PREFIX='rk3308'
BOOTSCRIPT=boot-rockpis.cmd:boot.cmd
#comment out line below for an image that will NOT boot from the built-in SDNAND
IDBLOADER_BLOB=$SRC/packages/blobs/rockchip/rk3308_idbloader_ddr589MHz_uart0_m0_v2.06.136sd.bin
#The SDNAND capabilty IDBLOADER_BLOB requires the U-Boot and Linux serial console on UART0
#Linux will hang on reboot if the console remains on UART2
#Note: IDBLOADER_BLOB is derived from
# https://dl.radxa.com/rockpis/images/loader/rk3308_loader_ddr589MHz_uart0_m0_v2.06.136sd.bin
#by using the rkdeveloptool to "upgrade" the previous DDR_BLOB loader on the SDNAND
#To recreate it, build the image with IDBLOADER_BLOB unset and boot Rock PI-S in MASKROM mode
#On your host (connected to the RockPi-S's USB-C port):
# rdeveloptool db rk3308_loader_ddr589MHz_uart0_m0_v2.06.136sd.bin
# rdeveloptool wl 0 newly_built_image.img
# rdeveloptool ul rk3308_loader_ddr589MHz_uart0_m0_v2.06.136sd.bin #this writes 280 sectors
#Then, reset the RockPi-S to boot from SDNAND. Using that running image:
# dd if=/dev/mmcblk0 of=rk3308_idbloader_ddr589MHz_uart0_m0_v2.06.136sd.bin skip=64 count=280
case $BRANCH in
@@ -17,6 +37,7 @@ case $BRANCH in
KERNELSOURCE='https://github.com/piter75/rockchip-kernel'
KERNELBRANCH='branch:rockpis-develop-4.4'
KERNELDIR='linux-rockchip64'
unset IDBLOADER_BLOB
;;
@@ -27,9 +48,17 @@ prepare_boot_configuration
uboot_custom_postprocess()
{
# TODO: remove this diversion from common caused by different loaderimage params
loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x600000 --size 1024 1
tools/mkimage -n rk3308 -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin
loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x600000 --size 1024 1 &&
if [ -r "$IDBLOADER_BLOB" ]; then
echo "Installing $IDBLOADER_BLOB"
echo "Capable of booting from built-in SDNAND"
cp $IDBLOADER_BLOB idbloader.bin
else
[ "$IDBLOADER_BLOB" ] && echo "Missing $IDBLOADER_BLOB"
echo "WARNING: This image will not boot from built-in SDNAND"
tools/mkimage -n rk3308 -T rksd -d $RKBIN_DIR/$DDR_BLOB idbloader.bin &&
cat $RKBIN_DIR/$MINILOADER_BLOB >> idbloader.bin
fi &&
trust_merger --replace bl31.elf $RKBIN_DIR/$BL31_BLOB trust.ini
}

View File

@@ -0,0 +1,39 @@
diff --git a/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi b/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi
index 40bb917b..973c9b27 100644
--- a/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi
+++ b/arch/arm/dts/rk3308-rock-pi-s-u-boot.dtsi
@@ -10,7 +10,7 @@
};
};
-&uart2 {
+&uart0 {
u-boot,dm-pre-reloc;
clock-frequency = <24000000>;
status = "okay";
diff --git a/arch/arm/dts/rk3308-rock-pi-s.dts b/arch/arm/dts/rk3308-rock-pi-s.dts
index 678e7d70..581892bd 100644
--- a/arch/arm/dts/rk3308-rock-pi-s.dts
+++ b/arch/arm/dts/rk3308-rock-pi-s.dts
@@ -12,7 +12,7 @@
compatible = "radxa,rockpis", "rockchip,rk3308";
chosen {
- stdout-path = "serial2:1500000n8";
+ stdout-path = "serial0:1500000n8";
};
leds {
diff --git a/configs/rock-pi-s-rk3308_defconfig b/configs/rock-pi-s-rk3308_defconfig
index 2b4ab51d..15a7e49a 100644
--- a/configs/rock-pi-s-rk3308_defconfig
+++ b/configs/rock-pi-s-rk3308_defconfig
@@ -12,7 +12,7 @@ CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
CONFIG_TARGET_EVB_RK3308=y
CONFIG_SPL_STACK_R_ADDR=0xc00000
CONFIG_PRE_CON_BUF_ADDR=0x0f200000
-CONFIG_DEBUG_UART_BASE=0xFF0C0000
+CONFIG_DEBUG_UART_BASE=0xFF0A0000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_DEFAULT_DEVICE_TREE="rk3308-rock-pi-s"