
#ifndef WCOM_UBI_PARTITION_APP
/* one flash chip only called boot */
# define WCOM_UBI_LINUX_MTD	ubi.mtd=ubi0
ubiattach=ubi part ubi0
#else /* WCOM_UBI_PARTITION_APP */
/* two flash chips called boot and app */
# define WCOM_UBI_LINUX_MTD	ubi.mtd=ubi0 ubi.mtd=ubi1
ubiattach=if test ${boot_bank} -eq 0;
          then;
		ubi part ubi0;
	  else;
		ubi part ubi1;
	  fi
#endif /* WCOMC_UBI_PARTITION_APP */

actual_bank=0

add_default=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off:
		console=ttyS0,${baudrate} mem=${kernelmem} init=${init}
		phram.phram=phvar,${varaddr},CONFIG_KM_PHRAM
		WCOM_UBI_LINUX_MTD

addpanic=setenv bootargs ${bootargs} panic=1 panic_on_oops=1
backup_bank=0
boot=bootm ${load_addr_r} - ${fdt_addr_r}

bootcmd=km_checkbidhwk &&
	setenv bootcmd 'if km_checktestboot;
			then;
				setenv boot_bank ${test_bank};
			else;
				setenv boot_bank ${actual_bank};
			fi;
			run ${subbootcmds}; reset' &&
	setenv altbootcmd 'setenv boot_bank ${backup_bank};
			   run ${subbootcmds};
			   reset' &&
	saveenv &&
	saveenv &&
	boot

cramfsaddr=CONFIG_KM_CRAMFS_ADDR
cramfsloadfdt=cramfsload ${fdt_addr_r} fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb
cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}

develop=tftp ${load_addr_r} scripts/develop-${arch}.txt &&
	env import -t ${load_addr_r} ${filesize} &&
	run setup_debug_env

env_version=1
fdt_addr_r=CONFIG_KM_FDT_ADDR
flashargs=setenv bootargs root=mtdblock:rootfs${boot_bank} rootfstype=squashfs ro
init=/sbin/init-overlay.sh
load=tftpboot ${load_addr_r} ${hostname}/u-boot.bin
load_addr_r=CONFIG_KM_KERNEL_ADDR
pnvramsize=CONFIG_KM_PNVRAM

ramfs=tftp ${load_addr_r} scripts/ramfs-${arch}.txt &&
      env import -t ${load_addr_r} ${filesize} &&
      run setup_debug_env

release=run newenv; reset
subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt set_fdthigh
                      cramfsloadkernel flashargs add_default addpanic boot
testbootcmd=setenv boot_bank ${test_bank}; run ${subbootcmds}; reset
ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}
