Skip to content

Commit

Permalink
amlogic: rework bootloader files for U-Boot 2024.04
Browse files Browse the repository at this point in the history
  • Loading branch information
chewitt committed Mar 24, 2024
1 parent d763c1e commit 7098547
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 31 deletions.
26 changes: 5 additions & 21 deletions projects/Amlogic/bootloader/mkimage
Expand Up @@ -26,7 +26,7 @@ mkimage_bootini(){
mkimage_uEnv(){
echo "image: creating uEnv.ini"
cat << EOF > "${LE_TMP}/uEnv.ini"
dtb_name=/dtb/${DTB}
dtb_name=/amlogic/${DTB}
bootargs=boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} quiet ${EXTRA_CMDLINE}
EOF
mcopy -s "${LE_TMP}/uEnv.ini" ::
Expand All @@ -38,7 +38,7 @@ mkimage_extlinux(){
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
LABEL ${DISTRO}
LINUX /${KERNEL_NAME}
FDT /${DTB}
FDT /amlogic/${DTB}
APPEND boot=LABEL=${DISTRO_BOOTLABEL} disk=LABEL=${DISTRO_DISKLABEL} quiet ${EXTRA_CMDLINE}
EOF
mcopy -s -o "${LE_TMP}/extlinux" ::
Expand All @@ -50,31 +50,15 @@ mkimage_extlinux_fdtdir(){
cat << EOF > "${LE_TMP}/extlinux/extlinux.conf"
LABEL ${DISTRO}
LINUX /${KERNEL_NAME}
FDTDIR /
FDTDIR /amlogic/
APPEND boot=LABEL=${DISTRO_BOOTLABEL} disk=LABEL=${DISTRO_DISKLABEL} quiet ${EXTRA_CMDLINE}
EOF
mcopy -s -o "${LE_TMP}/extlinux" ::
}

mkimage_dtb(){
if [ "$DTB" != "@@DTB_NAME@@" ]; then
echo "image: copying device tree"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/$DTB" ::
if [ "$DTB" = "meson-g12b-odroid-n2.dtb" ]; then
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/meson-g12b-odroid-n2-plus.dtb" ::
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/meson-g12b-odroid-n2l.dtb" ::
elif [ "$DTB" = "meson-g12b-gtking.dtb" ]; then
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/meson-g12b-gtking-pro.dtb" ::
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/meson-g12b-gsking-x.dtb" ::
elif [ "$DTB" = "meson-gxl-s905x-libretech-cc.dtb" ]; then
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/meson-gxl-s905x-libretech-cc-v2.dtb" ::
elif [ "$DTB" = "meson-sm1-odroid-c4.dtb" ]; then
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb/meson-sm1-odroid-hc4.dtb" ::
fi
else
echo "image: copying device trees"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/dtb" ::
fi
echo "image: copying device trees"
mcopy -s -o "${RELEASE_DIR}/3rdparty/bootloader/amlogic" ::
}

case "${UBOOT_SYSTEM}" in
Expand Down
15 changes: 8 additions & 7 deletions projects/Amlogic/bootloader/release
Expand Up @@ -11,14 +11,15 @@ mkdir -p "$DSTDIR"
cp -av "${FOUND_PATH}" "$DSTDIR/boot.ini"
fi

mkdir -p "$DSTDIR/dtb"
mkdir -p "$DSTDIR/amlogic"
ln -sf "$DSTDIR/amlogic" "$DSTDIR/dtb"
case ${DEVICE:-$PROJECT} in
AMLGX)
cp -a "$SRCDIR"/*gxbb*.dtb "$DSTDIR/dtb"
cp -a "$SRCDIR"/*gxl*.dtb "$DSTDIR/dtb"
cp -a "$SRCDIR"/*gxm*.dtb "$DSTDIR/dtb"
cp -a "$SRCDIR"/*g12a*.dtb "$DSTDIR/dtb"
cp -a "$SRCDIR"/*g12b*.dtb "$DSTDIR/dtb"
cp -a "$SRCDIR"/*sm1*.dtb "$DSTDIR/dtb"
cp -a "$SRCDIR"/*gxbb*.dtb "$DSTDIR/amlogic"
cp -a "$SRCDIR"/*gxl*.dtb "$DSTDIR/amlogic"
cp -a "$SRCDIR"/*gxm*.dtb "$DSTDIR/amlogic"
cp -a "$SRCDIR"/*g12a*.dtb "$DSTDIR/amlogic"
cp -a "$SRCDIR"/*g12b*.dtb "$DSTDIR/amlogic"
cp -a "$SRCDIR"/*sm1*.dtb "$DSTDIR/amlogic"
;;
esac
15 changes: 12 additions & 3 deletions projects/Amlogic/bootloader/update.sh
Expand Up @@ -22,7 +22,16 @@
# mount $BOOT_ROOT rw
mount -o remount,rw $BOOT_ROOT

# update extlinux device trees
# update /amlogic device trees
if [ -d $BOOT_ROOT/amlogic ]; then
for dtbfile in $BOOT_ROOT/amlogic/*.dtb ; do
dtb=$(basename $dtbfile)
echo "Updating $dtb"
cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/amlogic/ 2>/dev/null || true
done
fi

# update /extlinux device trees
if [ -f $BOOT_ROOT/extlinux/extlinux.conf ]; then
for dtbfile in $BOOT_ROOT/*.dtb ; do
dtb=$(basename $dtbfile)
Expand All @@ -31,8 +40,8 @@
done
fi

# update box device trees
if [ -f $BOOT_ROOT/uEnv.ini ]; then
# update /dtb device trees
if [ -d $BOOT_ROOT/dtb ]; then
for dtbfile in $BOOT_ROOT/dtb/*.dtb ; do
dtb=$(basename $dtbfile)
echo "Updating $dtb"
Expand Down

0 comments on commit 7098547

Please sign in to comment.