# env_k1-x.txt
fdt_addr_r=0x1F000000
fdtoverlay_addr_r=0x01000000
kernel_addr_r=0x10000000
kernel_comp_addr_r=0x18000000
pxefile_addr_r=0x0c200000
ramdisk_addr_r=0x20000000
scriptaddr=0x0c100000

stdout=serial,vidconsole
stderr=serial,vidconsole

bootcmd= \
    setenv fdtfile {{{fdt_file}}}; \
    nvme scan; \
    usb start; \
    if load usb 0:5 ${kernel_addr_r} {{{kernel_name}}}; then \
        setenv devtype usb; setenv devnum 0; setenv bootpart 5; \
        setenv boot_type "boot=live components"; \
    elif load nvme 0:5 ${kernel_addr_r} vmlinuz-6.6.63; then \
        setenv devtype nvme; setenv devnum 0; setenv bootpart 5; \
        setenv boot_type "root=/dev/nvme0n1p6 rootwait rw"; \
    elif load nvme 0:5 ${kernel_addr_r} {{{kernel_name}}}; then \
        setenv devtype nvme; setenv devnum 0; setenv bootpart 5; \
        setenv boot_type "root=/dev/nvme0n1p6 rootwait rw"; \
    elif load mmc 1:5 ${kernel_addr_r} {{{kernel_name}}}; then \
        setenv devtype mmc; setenv devnum 1; setenv bootpart 5; \
        setenv boot_type "boot=live components"; \
    elif load mmc 0:5 ${kernel_addr_r} {{{kernel_name}}}; then \
        setenv devtype mmc; setenv devnum 0; setenv bootpart 5; \
        setenv boot_type "boot=live components"; \
    fi; \
    echo "--- Booting MuseBook from ${devtype} ${devnum}:${bootpart} ---"; \
    load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} {{{fdt_dir}}}/${fdtfile}; \
    if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} initrd.img-6.6.63; then true; else load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} {{{initrd_name}}}; fi; \
    if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} vmlinuz-6.6.63; then true; else load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} {{{kernel_name}}}; fi; \
    setenv bootargs "earlycon=sbi console=tty0 console=ttyS0,115200 quiet splash ${boot_type} locales=en_US.UTF-8 clk_ignore_unused swiotlb=65536"; \
    booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}