Convert RK3326 boot.ini to a template to support using boot scripts for other devices.

This commit is contained in:
fewtarius 2023-09-07 22:57:40 +00:00
parent cf79c25f8d
commit 7c53818107
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
6 changed files with 58 additions and 67 deletions

View file

@ -86,39 +86,20 @@ fi
;;
esac
#Create boot.scr
if [ "${BOOT_INI}" == true ]
then
echo "boot: create boot.ini..."
cat >${INSTALL}/usr/share/bootloader/boot.ini <<EOF
odroidgoa-uboot-config
setenv bootargs "boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@ ${EXTRA_CMDLINE}"
setenv loadaddr "0x02000000"
setenv dtb_loadaddr "0x01f00000"
load mmc 1:1 \${loadaddr} KERNEL
if test \${hwrev} = 'v11'; then
if gpio input c22; then
load mmc 1:1 \${dtb_loadaddr} rk3326-odroid-go2-v11.dtb
else
load mmc 1:1 \${dtb_loadaddr} rk3326-anbernic-rg351m.dtb
echo "image: create boot.scr..."
if [ -e "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/boot/boot.scr" ]
then
cp ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/boot/boot.scr ${INSTALL}/usr/share/bootloader/boot.scr
sed -i "s~@EXTRA_CMDLINE@~${EXTRA_CMDLINE}~g" ${INSTALL}/usr/share/bootloader/boot.scr
sed -i "s~@PKG_LOAD_ADDR@~${PKG_LOAD_ADDR}~g" ${INSTALL}/usr/share/bootloader/boot.scr
sed -i "s~@DTB_LOAD_ADDR@~${DTB_LOAD_ADDR}~g" ${INSTALL}/usr/share/bootloader/boot.scr
else
echo "ERROR: No boot.scr found in ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/boot/."
exit 1
fi
elif test \${hwrev} = 'v10-go3'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-odroid-go3.dtb
elif test \${hwrev} = 'v10'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-odroid-go2.dtb
elif test \${hwrev} = 'rg351v'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-anbernic-rg351v.dtb
elif test \${hwrev} = 'rg351mp'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-anbernic-rg351mp.dtb
fi
booti \${loadaddr} - \${dtb_loadaddr}
EOF
fi
if [ "${EXT_LINUX_CONF}" == true ]

View file

@ -46,40 +46,23 @@ case "${PKG_SOC}" in
;;
esac
#Create boot.ini
#Create boot.scr
if [ "${BOOT_INI}" == true ]
then
echo "image: create boot.ini..."
cat >"${LE_TMP}/boot.ini" <<EOF
odroidgoa-uboot-config
setenv bootargs "boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} ${EXTRA_CMDLINE}"
setenv loadaddr "0x02000000"
setenv dtb_loadaddr "0x01f00000"
load mmc 1:1 \${loadaddr} KERNEL
if test \${hwrev} = 'v11'; then
if gpio input c22; then
load mmc 1:1 \${dtb_loadaddr} rk3326-odroid-go2-v11.dtb
echo "image: create boot.scr..."
if [ -e "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/boot/boot.scr" ]
then
cp ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/boot/boot.scr ${LE_TMP}/boot.scr
sed -i "s~@BOOT_UUID@~${BOOT_UUID}~g" ${LE_TMP}/boot.scr
sed -i "s~@DISK_UUID@~${DISK_UUID}~g" ${LE_TMP}/boot.scr
sed -i "s~@EXTRA_CMDLINE@~${EXTRA_CMDLINE}~g" ${LE_TMP}/boot.scr
sed -i "s~@PKG_LOAD_ADDR@~${PKG_LOAD_ADDR}~g" ${LE_TMP}/boot.scr
sed -i "s~@DTB_LOAD_ADDR@~${DTB_LOAD_ADDR}~g" ${LE_TMP}/boot.scr
mcopy -so "${LE_TMP}/boot.scr" ::
else
load mmc 1:1 \${dtb_loadaddr} rk3326-anbernic-rg351m.dtb
echo "ERROR: No boot.scr found in ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/boot/."
exit 1
fi
elif test \${hwrev} = 'v10-go3'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-odroid-go3.dtb
elif test \${hwrev} = 'v10'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-odroid-go2.dtb
elif test \${hwrev} = 'rg351v'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-anbernic-rg351v.dtb
elif test \${hwrev} = 'rg351mp'; then
load mmc 1:1 \${dtb_loadaddr} rk3326-anbernic-rg351mp.dtb
fi
booti \${loadaddr} - \${dtb_loadaddr}
EOF
mcopy -so "${LE_TMP}/boot.ini" ::
fi
mkdir -p "${LE_TMP}/extlinux"

View file

@ -28,8 +28,8 @@ if [ -n "${UBOOT_CONFIG}" ]; then
esac
fi
if [ -f ${INSTALL}/usr/share/bootloader/boot.ini ]; then
cp -a ${INSTALL}/usr/share/bootloader/boot.ini ${RELEASE_DIR}/3rdparty/bootloader
if [ -f ${INSTALL}/usr/share/bootloader/boot.scr ]; then
cp -a ${INSTALL}/usr/share/bootloader/boot.scr ${RELEASE_DIR}/3rdparty/bootloader
fi
LINUX_DTS_DIR=$(get_build_dir linux)/arch/${TARGET_KERNEL_ARCH}/boot/dts/

View file

@ -65,12 +65,12 @@ for all_conf in $CONFS; do
-i $BOOT_ROOT/extlinux/${conf}
done
if [ -f $SYSTEM_ROOT/usr/share/bootloader/boot.ini ]; then
echo "Updating boot.ini..."
cp -p $SYSTEM_ROOT/usr/share/bootloader/boot.ini $BOOT_ROOT/boot.ini &>/dev/null
if [ -f $SYSTEM_ROOT/usr/share/bootloader/boot.scr ]; then
echo "Updating boot.scr..."
cp -p $SYSTEM_ROOT/usr/share/bootloader/boot.scr $BOOT_ROOT/boot.scr &>/dev/null
sed -e "s/@BOOT_UUID@/$BOOT_UUID/" \
-e "s/@DISK_UUID@/$DISK_UUID/" \
-i $BOOT_ROOT/boot.ini
-i $BOOT_ROOT/boot.scr
fi
# update device tree

View file

@ -0,0 +1,26 @@
odroidgoa-uboot-config
setenv bootargs "boot=UUID=@BOOT_UUID@ disk=UUID=@DISK_UUID@ @EXTRA_CMDLINE@
setenv loadaddr "@PKG_LOAD_ADDR@"
setenv dtb_loadaddr "@DTB_LOAD_ADDR@"
load mmc 1:1 ${loadaddr} KERNEL
if test ${hwrev} = 'v11'; then
if gpio input c22; then
load mmc 1:1 ${dtb_loadaddr} rk3326-odroid-go2-v11.dtb
else
load mmc 1:1 ${dtb_loadaddr} rk3326-anbernic-rg351m.dtb
fi
elif test ${hwrev} = 'v10-go3'; then
load mmc 1:1 ${dtb_loadaddr} rk3326-odroid-go3.dtb
elif test ${hwrev} = 'v10'; then
load mmc 1:1 ${dtb_loadaddr} rk3326-odroid-go2.dtb
elif test ${hwrev} = 'rg351v'; then
load mmc 1:1 ${dtb_loadaddr} rk3326-anbernic-rg351v.dtb
elif test ${hwrev} = 'rg351mp'; then
load mmc 1:1 ${dtb_loadaddr} rk3326-anbernic-rg351mp.dtb
fi
booti ${loadaddr} - ${dtb_loadaddr}

View file

@ -38,7 +38,8 @@
PKG_DATAFILE="$PKG_RKBIN/bin/rk33/rk3326_ddr_333MHz_v1.15.bin"
PKG_LOADER="$PKG_RKBIN/bin/rk33/rk3326_miniloader_v1.28.bin"
PKG_BL31="$PKG_RKBIN/bin/rk33/rk3326_bl31_v1.22.elf"
PKG_LOAD_ADDR="0x00200000"
PKG_LOAD_ADDR="0x02000000"
DTB_LOAD_ADDR="0x01f00000"
BOOT_INI=true
BOOT_PART="1:1"
EXT_LINUX_CONF=false