Written by Anonymous
KHADAS-UBOOT-CONFIG echo "Starting raxy boot.ini v0.1" setenv kernel_loadaddr "0x11000000" setenv dtb_loadaddr "0x1000000" setenv initrd_loadaddr "0x13000000" setenv env_loadaddr "0x20000000" setenv hdmiargs "logo=${display_layer},loaded,${fb_addr},${outputmode} vout=${outputmode},enable hdmimode=${hdmimode}" if test "X$lcd_exist" = "X1"; then setenv panelargs "panel_exist=${lcd_exist} panel_type=${panel_type}";fi; setenv boot_start booti ${kernel_loadaddr} ${initrd_loadaddr} ${dtb_loadaddr} setenv mmc_devplist "1 5" setenv mmc_devnums "0 1" setenv usb_devplist "1" setenv usb_devnums "0 1 2 3" setenv mark_prefix "" if test "$hostname" = "KVim"; then setenv ml_dtb "/dtb/meson-gxl-s905x-khadas-vim.dtb"; else if test "$hostname" = "KVIM2"; then setenv ml_dtb "/dts/amlogic/meson-gxm-khadas-vim2.dtb";fi;fi; ## First, boot from mmc ## 0 - SD card, higher priority ## 1 - eMMC for dev_num in ${mmc_devnums}; do if ${dev_num} = "1"; then setenv c_load "ext4load"; else setenv c_load "fatload";fi; for distro_bootpart in ${mmc_devplist}; do echo "Scanning mmc ${dev_num}:${distro_bootpart}..."; if ${c_load} mmc ${dev_num}:${distro_bootpart} ${initrd_loadaddr} uInitrd; then if ${c_load} mmc ${dev_num}:${distro_bootpart} ${kernel_loadaddr} zImage; then if ${c_load} mmc ${dev_num}:${distro_bootpart} ${dtb_loadaddr} dtb.img || ${c_load} mmc ${dev_num}:${distro_bootpart} ${dtb_loadaddr} ${ml_dtb}; then if ${c_load} mmc ${dev_num}:${distro_bootpart} ${env_loadaddr} /boot/env.txt || ${c_load} mmc ${dev_num}:${distro_bootpart} ${env_loadaddr} env.txt; then echo "Import env.txt"; env import -t ${env_loadaddr} ${filesize};fi;if test "X${rootdev}" = "X"; then echo "rootdev is missing! use default: root=LABEL=ROOTFS!";setenv rootdev "LABEL=ROOTFS";fi;if test "X${custom_ethmac}" != "X"; then echo "Found custom ethmac: ${custom_ethmac}, overwrite eth_mac!"; setenv eth_mac ${custom_ethmac};fi;if test "X${eth_mac}" = "X"; then echo "Set default mac address to ethaddr: ${ethaddr}!";setenv eth_mac ${ethaddr};setenv save_ethmac "yes";fi;if ${dev_num} -eq 0 -o test -e mmc ${dev_num}:${boot_env_part} ${mark_prefix}.next; then echo "Booting mainline kernel...";setenv condev "console=ttyS0,115200n8 console=tty0 no_console_suspend consoleblank=0";else echo "Booting legacy kernel...";setenv condev "console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0";fi;if test "X${hwver}" = "XVIM2.V14"; then fdt addr ${dtb_loadaddr};fdt resize 65536;fdt set /fan hwver "VIM2.V14";fdt set /i2c@c11087c0/khadas-mcu hwver "VIM2.V14";fdt set /soc/cbus@c1100000/i2c@87c0/khadas-mcu hwver "VIM2.V14";fi;setenv bootargs "root=${rootdev} rootflags=data=writeback rw ${condev} ${hdmiargs} ${panelargs} fsck.repair=yes net.ifnames=0 ddr_size=${ddr_size} wol_enable=${wol_enable} jtag=disable mac=${eth_mac} androidboot.mac=${eth_mac} save_ethmac=${save_ethmac} fan=${fan_mode} hwver=${hwver} coherent_pool=${dma_size}";run boot_start;fi;fi;fi;done;done; for dev_num in ${mmc_devnums}; do for distro_bootpart in ${mmc_devplist}; do echo "Scanning mmc ${dev_num}:${distro_bootpart}..."; if load mmc ${dev_num}:${distro_bootpart} ${initrd_loadaddr} uInitrd; then if load mmc ${dev_num}:${distro_bootpart} ${kernel_loadaddr} zImage; then if load mmc ${dev_num}:${distro_bootpart} ${dtb_loadaddr} dtb.img || load mmc ${dev_num}:${distro_bootpart} ${dtb_loadaddr} ${ml_dtb}; then if load mmc ${dev_num}:${distro_bootpart} ${env_loadaddr} /boot/env.txt || load mmc ${dev_num}:${distro_bootpart} ${env_loadaddr} env.txt; then echo "Import env.txt"; env import -t ${env_loadaddr} ${filesize};fi;if test "X${rootdev}" = "X"; then echo "rootdev is missing! use default: root=LABEL=ROOTFS!";setenv rootdev "LABEL=ROOTFS";fi;if test "X${custom_ethmac}" != "X"; then echo "Found custom ethmac: ${custom_ethmac}, overwrite eth_mac!"; setenv eth_mac ${custom_ethmac};fi;if test "X${eth_mac}" = "X"; then echo "Set default mac address to ethaddr: ${ethaddr}!";setenv eth_mac ${ethaddr};setenv save_ethmac "yes";fi;if test -e mmc ${dev_num}:${boot_env_part} ${mark_prefix}.next; then echo "Booting mainline kernel...";setenv condev "console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0";else echo "Booting legacy kernel...";setenv condev "console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0";fi;if test "X${hwver}" = "XVIM2.V14"; then fdt addr ${dtb_loadaddr};fdt resize 65536;fdt set /fan hwver "VIM2.V14";fdt set /i2c@c11087c0/khadas-mcu hwver "VIM2.V14";fdt set /soc/cbus@c1100000/i2c@87c0/khadas-mcu hwver "VIM2.V14";fi;setenv bootargs "root=${rootdev} rootflags=data=writeback rw ${condev} ${hdmiargs} ${panelargs} fsck.repair=yes net.ifnames=0 ddr_size=${ddr_size} wol_enable=${wol_enable} jtag=disable mac=${eth_mac} androidboot.mac=${eth_mac} save_ethmac=${save_ethmac} fan=${fan_mode} hwver=${hwver} coherent_pool=${dma_size}";run boot_start;fi;fi;fi;done;done; ## Second, boot from USB storage for dev_num in ${usb_devnums}; do for distro_bootpart in ${usb_devplist}; do echo "Scanning usb ${dev_num}:${distro_bootpart}...";if fatload usb ${dev_num}:${distro_bootpart} ${initrd_loadaddr} uInitrd; then if fatload usb ${dev_num}:${distro_bootpart} ${kernel_loadaddr} zImage; then if fatload usb ${dev_num}:${distro_bootpart} ${dtb_loadaddr} dtb.img || fatload usb ${dev_num}:${distro_bootpart} ${dtb_loadaddr} ${ml_dtb}; then if fatload usb ${dev_num}:${distro_bootpart} ${env_loadaddr} /boot/env.txt || fatload usb ${dev_num}:${distro_bootpart} ${env_loadaddr} env.txt; then echo "Import env.txt"; env import -t ${env_loadaddr} ${filesize};fi;if test "X${rootdev}" = "X"; then echo "rootdev is missing! use default: root=LABEL=ROOTFS!";setenv rootdev "LABEL=ROOTFS";fi;if test "X${custom_ethmac}" != "X"; then echo "Found custom ethmac: ${custom_ethmac}, overwrite eth_mac!"; setenv eth_mac ${custom_ethmac};fi;if test "X${eth_mac}" = "X"; then echo "Set default mac address to ethaddr: ${ethaddr}!";setenv eth_mac ${ethaddr};setenv save_ethmac "yes";fi;if test -e usb ${dev_num}:${distro_bootpart} ${mark_prefix}.next; then echo "Booting mainline kernel...";setenv condev "console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0";else echo "Booting legacy kernel...";setenv condev "console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0";fi;if test "X${hwver}" = "XVIM2.V14"; then fdt addr ${dtb_loadaddr};fdt resize 65536;fdt set /fan hwver "VIM2.V14";fdt set /i2c@c11087c0/khadas-mcu hwver "VIM2.V14";fdt set /soc/cbus@c1100000/i2c@87c0/khadas-mcu hwver "VIM2.V14";fi;setenv bootargs "root=${rootdev} rootflags=data=writeback rw ${condev} ${hdmiargs} ${panelargs} fsck.repair=yes net.ifnames=0 ddr_size=${ddr_size} wol_enable=${wol_enable} jtag=disable mac=${eth_mac} androidboot.mac=${eth_mac} save_ethmac=${save_ethmac} fan=${fan_mode} hwver=${hwver} coherent_pool=${dma_size}";run boot_start;fi;fi;fi;done;done;