Skip to content
Snippets Groups Projects
boot-alt.scr.cfg 1.48 KiB
Newer Older

if fatload mmc ${current_partition} ${loadaddr} boot-alt.cfg  && env import -t ${loadaddr} ${filesize}; then

    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
            true
        else
            echo 'Failed to load devicetree ${devicetree}'
        fi
    fi

    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

    initrd=-
    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}'
    fi
else
    echo 'No valid boot-alt.cfg found'
fi;