diff --git a/packages/apps/device-switch/scripts/RK3326/device-switch b/packages/apps/device-switch/scripts/RK3326/device-switch index f9108dd766..969756ae05 100644 --- a/packages/apps/device-switch/scripts/RK3326/device-switch +++ b/packages/apps/device-switch/scripts/RK3326/device-switch @@ -7,11 +7,11 @@ mount -o remount,rw /flash case $1 in R33S) - sed -i '/rk3326-gameconsole-r3/c\ load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-gameconsole-r33s.dtb' /flash/boot.ini + sed -i '/rk3326-gameconsole-r3/c\ load mmc 1:1 ${dtb_loadaddr} rk3326-gameconsole-r33s.dtb' /flash/boot.ini rm -r /storage/remappings/* ;; R36S) - sed -i '/rk3326-gameconsole-r3/c\ load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-gameconsole-r36s.dtb' /flash/boot.ini + sed -i '/rk3326-gameconsole-r3/c\ load mmc 1:1 ${dtb_loadaddr} rk3326-gameconsole-r36s.dtb' /flash/boot.ini rm -r /storage/remappings/* ;; esac diff --git a/projects/Rockchip/bootloader/mkimage b/projects/Rockchip/bootloader/mkimage index 06acf70857..9c7765f745 100644 --- a/projects/Rockchip/bootloader/mkimage +++ b/projects/Rockchip/bootloader/mkimage @@ -50,7 +50,11 @@ EOF mkimage_dtb() { if [ -d ${RELEASE_DIR}/3rdparty/bootloader/device_trees ]; then echo "image: copying device trees..." - mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/device_trees :: + if [ "${DEVICE}" = "RK3326" ]; then + mcopy ${RELEASE_DIR}/3rdparty/bootloader/device_trees/*.dtb :: + else + mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/device_trees :: + fi fi if [ -d ${RELEASE_DIR}/3rdparty/bootloader/overlays ]; then echo "image: copying device tree overlays..." diff --git a/projects/Rockchip/bootloader/update.sh b/projects/Rockchip/bootloader/update.sh index 2f96de11d2..17a15bcab7 100755 --- a/projects/Rockchip/bootloader/update.sh +++ b/projects/Rockchip/bootloader/update.sh @@ -17,6 +17,7 @@ fi # mount $BOOT_ROOT rw mount -o remount,rw $BOOT_ROOT +DT_SOC=$($SYSTEM_ROOT/usr/bin/dtsoc | cut -f2 -d,) DT_ID=$($SYSTEM_ROOT/usr/bin/dtname) if [ -n "$DT_ID" ]; then case $DT_ID in @@ -25,25 +26,33 @@ if [ -n "$DT_ID" ]; then esac fi -### Migrate device trees to subfolder - remove in the future -if [ ! -d "$BOOT_ROOT/device_trees" ]; then - mkdir $BOOT_ROOT/device_trees - mv $BOOT_ROOT/*.dtb $BOOT_ROOT/device_trees +### Migrate device trees to subfolder (except RK326) - remove in the future +if [ "$DT_SOC" = "rk3326" ]; then + if [ -d "$BOOT_ROOT/device_trees" ]; then + mv $BOOT_ROOT/device_trees/*.dtb $BOOT_ROOT + rm -rf $BOOT_ROOT/device_trees + fi if [ -f "$BOOT_ROOT/boot.ini" ]; then - ! grep -q "device_trees" $BOOT_ROOT/boot.ini && - sed -i 's/${dtb_loadaddr} /${dtb_loadaddr} device_trees\//g' $BOOT_ROOT/boot.ini + grep -q "device_trees" $BOOT_ROOT/boot.ini && + sed -i 's/${dtb_loadaddr} device_trees\//${dtb_loadaddr} /g' $BOOT_ROOT/boot.ini fi - if [ -f "$BOOT_ROOT/extlinux/extlinux.conf" ]; then - if ! grep -q "device_trees" $BOOT_ROOT/extlinux/extlinux.conf; then - sed -i 's/FDT /FDT \/device_trees/g' $BOOT_ROOT/extlinux/extlinux.conf - sed -i 's/FDTDIR \//FDTDIR \/device_trees/g' $BOOT_ROOT/extlinux/extlinux.conf +else + if [ ! -d "$BOOT_ROOT/device_trees" ]; then + mkdir $BOOT_ROOT/device_trees + mv $BOOT_ROOT/*.dtb $BOOT_ROOT/device_trees + if [ -f "$BOOT_ROOT/extlinux/extlinux.conf" ]; then + if ! grep -q "device_trees" $BOOT_ROOT/extlinux/extlinux.conf; then + sed -i 's/FDT /FDT \/device_trees/g' $BOOT_ROOT/extlinux/extlinux.conf + sed -i 's/FDTDIR \//FDTDIR \/device_trees/g' $BOOT_ROOT/extlinux/extlinux.conf + fi fi fi fi ### echo "Updating device trees..." -cp -f $SYSTEM_ROOT/usr/share/bootloader/device_trees/* $BOOT_ROOT/device_trees +[ "$DT_SOC" = "rk3326" ] && DT_LOC=$BOOT_ROOT || DT_LOC=$BOOT_ROOT/device_trees +cp -f $SYSTEM_ROOT/usr/share/bootloader/device_trees/* $DT_LOC if [ -d $SYSTEM_ROOT/usr/share/bootloader/overlays ]; then echo "Updating device tree overlays..." diff --git a/projects/Rockchip/devices/RK3326/packages/u-boot/config/a_boot.ini b/projects/Rockchip/devices/RK3326/packages/u-boot/config/a_boot.ini index 6c4f772744..a0ea88250d 100644 --- a/projects/Rockchip/devices/RK3326/packages/u-boot/config/a_boot.ini +++ b/projects/Rockchip/devices/RK3326/packages/u-boot/config/a_boot.ini @@ -11,26 +11,26 @@ load mmc 1:1 ${loadaddr} KERNEL if test ${hwrev} = 'v11'; then if gpio input c22; then if gpio input d9; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-powkiddy-rgb10.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-powkiddy-rgb10.dtb else - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-odroid-go2-v11.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-odroid-go2-v11.dtb fi else - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-anbernic-rg351m.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-anbernic-rg351m.dtb fi elif test ${hwrev} = 'v10-go3'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-odroid-go3.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-odroid-go3.dtb elif test ${hwrev} = 'v10'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-odroid-go2.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-odroid-go2.dtb elif test ${hwrev} = 'rg351v'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-anbernic-rg351v.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-anbernic-rg351v.dtb elif test ${hwrev} = 'r33s'; then -# load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-powkiddy-rgb20s.dtb - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-gameconsole-r33s.dtb +# load mmc 1:1 ${dtb_loadaddr} rk3326-powkiddy-rgb20s.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-gameconsole-r33s.dtb elif test ${hwrev} = 'xu10'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-magicx-xu10.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-magicx-xu10.dtb elif test ${hwrev} = 'chi'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-gameforce-chi.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-gameforce-chi.dtb fi if load mmc 1:1 ${dtbo_loadaddr} overlays/mipi-panel.dtbo; then diff --git a/projects/Rockchip/devices/RK3326/packages/u-boot/config/b_boot.ini b/projects/Rockchip/devices/RK3326/packages/u-boot/config/b_boot.ini index f26c642791..0d74cac4fe 100644 --- a/projects/Rockchip/devices/RK3326/packages/u-boot/config/b_boot.ini +++ b/projects/Rockchip/devices/RK3326/packages/u-boot/config/b_boot.ini @@ -9,9 +9,9 @@ setenv dtbo_loadaddr "0x01e00000" load mmc 1:1 ${loadaddr} KERNEL if test ${hwrev} = 'r33s'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-powkiddy-rgb10x.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-powkiddy-rgb10x.dtb elif test ${hwrev} = 'xu10'; then - load mmc 1:1 ${dtb_loadaddr} device_trees/rk3326-magicx-xu-mini-m.dtb + load mmc 1:1 ${dtb_loadaddr} rk3326-magicx-xu-mini-m.dtb fi if load mmc 1:1 ${dtbo_loadaddr} overlays/mipi-panel.dtbo; then