Skip to content
Snippets Groups Projects
boot-alt.scr.cfg 3.01 KiB
Newer Older
if fatload mmc ${current_partition} ${loadaddr} boot-alt.cfg  && env import -t ${loadaddr} ${filesize}; then

    if test -n ${custom_boot_script}; then
        echo "Running custom bootscript ..."
        fatload mmc ${current_partition} ${loadaddr} ${custom_boot_script}
        source ${loadaddr}
    fi

    if test -n ${cmdline}; then
        echo "Kernel cmdline: ${cmdline}"
        setenv bootargs ${cmdline}
    fi

    if test -n ${devicetree};then
        echo "Loading devicetree ${devicetree} ..."
        if fatload mmc ${current_partition} ${fdt_addr} ${devicetree}; then
            fdt addr ${fdt_addr}
            version_to_fdt

            if test -n ${overlays}; then
                for ov in ${overlays}; do
                    echo "Overlaying ${ov} ..."
                    if fatload mmc ${current_partition} ${loadaddr} ${ov}; then
                        fdt resize ${filesize} && fdt apply ${loadaddr}
                    else
                        echo "Failed to load overlay ${ov}"
                    fi
                done
            fi
            if test -n ${cpu_temp_grade}; then
                if test "${cpu_temp_grade}" = "industrial"; then
                    temp_overlay="${soc_type}-industrial-temp-overlay"
                fi
                if test "${cpu_temp_grade}" = "extcommercial"; then
                    temp_overlay="${soc_type}-industrial-temp-overlay"
                fi
                if test "${cpu_temp_grade}" = "automotive"; then
                    temp_overlay="${soc_type}-automotive-temp-overlay"
            if test ! ${temp_overlay} = "none"; then

                fatload mmc ${current_partition} ${loadaddr} "${temp_overlay}.dtbo"
                if test $? = 1; then

                    fatload mmc ${current_partition} ${loadaddr} "${temp_overlay}.dtb"
                    if test $? = 1; then
                        echo "No temp overlay applied for ${cpu_temp_grade} grade"
                        temp_overlay="none"
                    fi
            if test ! ${temp_overlay} = "none"; then
                echo "Overlaying ${temp_overlay} ..."
                fdt resize ${filesize} && fdt apply ${loadaddr}
            fi
            echo "Failed to load devicetree ${devicetree}"
    if test -n ${initramfs}; then
        echo "Loading initramfs ${initramfs} ..."
        if fatload mmc ${current_partition} ${initrd_addr} ${initramfs}; then
            initrd=${initrd_addr}:${filesize}
        else
            echo "Failed to load initramfs ${initramfs}"
        fi
    fi

    # Fallback if not set in config file
    if test -z ${kernel}; then
        kernel=linuximage
    fi

    echo "Load kernel ${kernel}"
    if fatload mmc ${current_partition} ${loadaddr} ${kernel}; then
        booti ${loadaddr} ${initrd} ${fdt_addr}
    else
        echo "Unable to load kernel ${kernel}"
    echo "No valid boot-alt.cfg found"