#
# Default parameters & multiboot menu for U-Boot
#
-# (c) 2015-2022 Baikal Electronics JSC
+# (c) 2015-2023 Baikal Electronics JSC
#
# License: GPL2+
#
#
# Network parameters
#
-serverip=192.168.68.10
+netdev=eth1
+serverip=192.168.54.11
+ipaddr=192.168.54.230
##gatewayip=192.168.68.1
##netmask=255.255.255.0
-##ipaddr=192.168.68.230
##dnsip=192.168.65.10
##hostname=baikal
##enet=8
##enet_mode=x:n
##ethact=eth0
##mgmt_enet=e
-netdev=eth1
##rgmii_phyid=3
##xgmii_phyid=:
#
# NFS parameters
#
-nfsroot=/nfsroot/debian
+nfsroot=/srv/nfs
#
# Filenames and addresses
# MTD partitions
#
mtdids=nor2=boot_flash
-mtdparts=mtdparts=boot_flash:748k@0x0(bootloader)ro,64k@0xBB000(environment),4k@0xCB000(information)ro,24k@0xCC000(fdt)ro,15544k@0xD2000(fitimage)ro,16384k@0x0(firmware)
+mtdparts=mtdparts=boot_flash:768k@0x0(bootloader)ro,64k@0xC0000(environment),64k@0xD0000(information)ro,64k@0xE0000(fdt)ro,15424k@0xF0000(fitimage)ro,16384k@0x0(firmware)
+
#
# Main boot parameters
#
bootfile=bfk3.rom
image_name=bfk3.rom
usb_fs=fat
+nvme_fs=fat
#
# Kernel debugger
#
# Common boot scripts
#
-addboard=setenv bootargs ${bootargs} board_name=${board_name}
addmisc=setenv bootargs ${bootargs} earlycon ieee754=relaxed maxcpus=${num_cores}
-addhw=setenv bootargs ${bootargs} nohtw
addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}n8
-addfb=setenv bootargs ${bootargs} video=sma750fb:1600x900-16@60
-addip=setenv bootargs ${bootargs} ip=:::::${netdev}:dhcp
-#
+addhw=setenv bootargs ${bootargs} nohtw
+
ramargs=setenv bootargs ${bootargs} root=/dev/ram rw rootwait
diskargs1=setenv bootargs ${bootargs} root=${sata_dev1} rw rootwait
diskargs2=setenv bootargs ${bootargs} root=${sata_dev2} rw rootwait
-nfsargs=setenv bootargs ${bootargs} root=/dev/nfs rw rootwait nfsroot=${serverip}:${nfsroot} rw rootwait
-#
+
uboot_initrd=setenv uimage_file_name uImage; setenv initrd_file_name uInitrd; setenv initrd_high
uboot_initramfs=setenv uimage_file_name uImage; setenv initrd_file_name uInitramfs; setenv initrd_high
all_bootm=bootm ${uimage_addr_n} ${initrd_addr_n} ${fdt_addr_n}
# Flash boot parameters
#
flash_load=sf probe; mtd read fitimage ${multi_addr_n}; setenv initrd_high
-flash_boot_ram=run flash_load; run ramargs addtty addmisc addhw addfb addboard; bootm ${multi_addr_n}#conf-1
-flash_boot_disk1=run flash_load; run diskargs1 addtty addmisc addhw addfb addboard kdb; bootm ${multi_addr_n}#conf-2
-flash_boot_disk2=run flash_load; run diskargs2 addtty addmisc addhw addfb addboard kdb; bootm ${multi_addr_n}#conf-2
+flash_boot_ram=run flash_load; run ramargs addtty addmisc addhw; bootm ${multi_addr_n}#conf-1
+flash_boot_disk1=run flash_load; run diskargs1 addtty addmisc addhw kdb; bootm ${multi_addr_n}#conf-2
+flash_boot_disk2=run flash_load; run diskargs2 addtty addmisc addhw kdb; bootm ${multi_addr_n}#conf-2
#
# SATA boot parameters
sata_load_fdt=echo Loading FDT: ${fdt_file_name}; load scsi ${sata_port}:1 ${fdt_addr_n} ${fdt_file_name}; fdt addr ${fdt_addr_n}
sata_load_all=run sata_load_kernel; run sata_load_initrd; run sata_load_fdt
#
-sata_common_ram=run sata_load_all; run ramargs addtty addmisc addhw addboard;
-sata_common_disk1=run sata_load_all; run diskargs1 addtty addmisc addhw addboard kdb;
-sata_common_disk2=run sata_load_all; run diskargs2 addtty addmisc addhw addboard kdb;
+sata_common_ram=run sata_load_all; run ramargs addtty addmisc addhw
+sata_common_disk1=run sata_load_all; run diskargs1 addtty addmisc addhw kdb
+sata_common_disk2=run sata_load_all; run diskargs2 addtty addmisc addhw kdb
#
sata_setup_ram=run sata_common_ram;
-sata_setup_disk1=setenv sata_port 0; run all_setup_initramfs; run sata_common_disk1;
-sata_setup_disk2=setenv sata_port 1; run all_setup_initramfs; run sata_common_disk2;
+sata_setup_disk1=setenv sata_port 0; run all_setup_initramfs; run sata_common_disk1
+sata_setup_disk2=setenv sata_port 1; run all_setup_initramfs; run sata_common_disk2
#
# Network boot parameters
net_load_kernel_dhcp=setenv loadaddr ${uimage_addr_n}; setenv bootfile ${uimage_file_name}; dhcp
net_load_kernel_tftp=setenv loadaddr ${uimage_addr_n}; setenv bootfile ${uimage_file_name}; tftp
net_load_initrd_tftp=setenv loadaddr ${initrd_addr_n}; setenv bootfile ${initrd_file_name}; tftp; setenv initrd_len ${filesize}
-net_load_fdt_tftp=setenv loadaddr ${fdt_addr_n}; setenv bootfile ${fdt_file_name}; tftp; fdt addr ${fdt_addr_n};
+net_load_fdt_tftp=setenv loadaddr ${fdt_addr_n}; setenv bootfile ${fdt_file_name}; tftp; fdt addr ${fdt_addr_n}
net_load_kernel_nfs=setenv loadaddr ${uimage_addr_n}; setenv bootfile ${nfsroot}/${uimage_file_name}; nfs
net_load_initrd_nfs=setenv loadaddr ${initrd_addr_n}; setenv bootfile ${nfsroot}/${initrd_file_name}; nfs; setenv initrd_len ${filesize}
net_load_all_tftp=run net_load_kernel_tftp; run net_load_initrd_tftp; run net_load_fdt_tftp
net_load_all_nfs=run net_load_kernel_nfs; run net_load_initrd_nfs; run net_load_fdt_nfs
#
-net_common_ram=run ramargs addtty addmisc addhw addboard
-net_common_disk1=run diskargs1 addtty addmisc addhw addboard;
-net_common_disk2=run diskargs2 addtty addmisc addhw addboard;
-net_common_netdisk=run nfsargs addip addtty addmisc addhw addboard;
+net_common_ram=run ramargs addtty addmisc addhw
+net_common_disk1=run diskargs1 addtty addmisc addhw
+net_common_disk2=run diskargs2 addtty addmisc addhw
#
net_setup_ram=run net_init; run net_common_ram
net_setup_disk1=run all_setup_initramfs; run net_init; run net_common_disk1
net_setup_disk2=run all_setup_initramfs; run net_init; run net_common_disk2
dhcp_setup_disk1=run all_setup_initramfs; run net_common_disk1
dhcp_setup_disk2=run all_setup_initramfs; run net_common_disk2
-net_setup_netdisk=run all_setup_initramfs; run net_init; run net_common_netdisk
#
# USB boot parameters
#
-
usb_load_kernel=echo Loading kernel: ${uimage_file_name}; if test ${usb_fs} = 'fat'; then fatload usb 0:1 ${uimage_addr_n} ${uimage_file_name}; elif test ${usb_fs} = 'ext2'; then ext2load usb 0:1 ${uimage_addr_n} ${uimage_file_name}; elif test ${usb_fs} = 'ext4'; then ext4load usb 0:1 ${uimage_addr_n} ${uimage_file_name}; fi
usb_load_initrd=echo Loading ramdisk: ${initrd_file_name}; setenv initrd_len ${filesize}; if test ${usb_fs} = 'fat'; then fatload usb 0:1 ${initrd_addr_n} ${initrd_file_name}; elif test ${usb_fs} = 'ext2'; then ext2load usb 0:1 ${initrd_addr_n} ${initrd_file_name}; elif test ${usb_fs} = 'ext4'; then ext4load usb 0:1 ${initrd_addr_n} ${initrd_file_name}; fi
usb_load_fdt=echo Loading FDT: ${fdt_file_name}; fdt addr ${fdt_addr_n}; if test ${usb_fs} = 'fat'; then fatload usb 0:1 ${fdt_addr_n} ${fdt_file_name}; elif test ${usb_fs} = 'ext2'; then ext2load usb 0:1 ${fdt_addr_n} ${fdt_file_name}; elif test ${usb_fs} = 'ext4'; then ext4load usb 0:1 ${fdt_addr_n} ${fdt_file_name}; fi
usb_load_all=run usb_load_kernel; run usb_load_initrd; run usb_load_fdt
usb_init=usb start; sleep 1
-usb_setup_ram=run usb_init; run usb_load_all; run ramargs addtty addmisc addhw addboard
+usb_setup_ram=run usb_init; run usb_load_all; run ramargs addtty addmisc addhw
+
+#
+# NVMe boot parameters
+#
+
+nvme_init=pci enum; nvme scan
+nvme_load_kernel=echo Loading kernel: ${uimage_file_name}; if test ${nvme_fs} = 'fat'; then fatload nvme 0:1 ${uimage_addr_n} ${uimage_file_name}; elif test ${nvme_fs} = 'ext2'; then ext2load nvme 0:1 ${uimage_addr_n} ${uimage_file_name}; elif test ${nvme_fs} = 'ext4'; then ext4load nvme 0:1 ${uimage_addr_n} ${UIMAGE_FILE_NAME}; fi
+nvme_load_initrd=echo Loading ramdisk: ${initrd_file_name}; if test ${nvme_fs} = 'fat'; then fatload nvme 0:1 ${initrd_addr_n} ${initrd_file_name}; elif test ${nvme_fs} = 'ext2'; then ext2load nvme 0:1 ${initrd_addr_n} ${initrd_file_name}; elif test ${nvme_fs} = 'ext4'; then ext4load nvme 0:1 ${initrd_addr_n} ${initrd_file_name}; fi; setenv initrd_len ${filesize}
+nvme_load_fdt=echo Loading FDT: ${fdt_file_name}; if test ${nvme_fs} = 'fat'; then fatload nvme 0:1 ${fdt_addr_n} ${fdt_file_name}; elif test ${nvme_fs} = 'ext2'; then ext2load nvme 0:1 ${fdt_addr_n} ${fdt_file_name}; elif test ${nvme_fs} = 'ext4'; then ext4load nvme 0:1 ${fdt_addr_n} ${fdt_file_name}; fi; fdt addr ${fdt_addr_n}
+nvme_load_all=run nvme_load_kernel; run nvme_load_initrd; run nvme_load_fdt
+nvme_setup_ram=run nvme_init; run nvme_load_all; run ramargs addtty addmisc addhw
#
# Boot menu
bootmenu_12=13. Boot from Network to minimal FS (nfs + ramdisk)=run net_setup_ram; run net_load_all_nfs; run all_bootm
bootmenu_13=14. Boot from Network to SATA disk1 (nfs + sda1)=run net_setup_disk1; run net_load_all_nfs; run all_bootm
bootmenu_14=15. Boot from Network to SATA disk2 (nfs + sdb1)=run net_setup_disk2; run net_load_all_nfs; run all_bootm
+#
bootmenu_15=16. Boot from USB storage to minimal FS (rom + ramdisk)=run usb_setup_ram; run all_bootm
+#
+bootmenu_16=17. Boot from NVMe disk to minimal FS (nvme + ramdisk)=run nvme_setup_ram; run all_bootm