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

stdout=serial,vidconsole
stderr=serial,vidconsole

bootcmd= \
    setenv fdtfile k1-x_MUSE-Book.dtb; \
    nvme scan; \
    usb start; \
    if load usb 0:5 ${kernel_addr_r} vmlinuz; 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; 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} vmlinuz; then \
        setenv devtype mmc; setenv devnum 1; setenv bootpart 5; \
        setenv boot_type "boot=live components"; \
    elif load mmc 0:5 ${kernel_addr_r} vmlinuz; 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} spacemit/6.6.63/${fdtfile}; \
    load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} initrd.img; \
    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}
