Skip to content

Commit

Permalink
Merge pull request #1157 from spycat88/rk3326-move-dt-back-to-flash
Browse files Browse the repository at this point in the history
RK3326: move DT's back to FLASH:/
  • Loading branch information
r3claimer authored Jan 17, 2025
2 parents 6ea27a1 + abfea76 commit 5a7a848
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/apps/device-switch/scripts/RK3326/device-switch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion projects/Rockchip/bootloader/mkimage
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
31 changes: 20 additions & 11 deletions projects/Rockchip/bootloader/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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..."
Expand Down
20 changes: 10 additions & 10 deletions projects/Rockchip/devices/RK3326/packages/u-boot/config/a_boot.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a7a848

Please sign in to comment.