def test_zynq_aes_image(u_boot_console): zynq_aes_pre_commands(u_boot_console) test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) f = u_boot_console.config.env.get('env__zynq_aes_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') srcaddr = f.get('srcaddr', None) if not srcaddr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' fn = f['fn'] output = u_boot_console.run_command('tftpboot %x %s' % (srcaddr, fn)) assert expected_tftp in output dstaddr = f.get('dstaddr', None) if not dstaddr: pytest.skip('No dstaddr specified in env file to read') dstsize = f.get('dstlen', None) if not dstsize: pytest.skip('No dstlen specified in env file to read') expected_zynqaes = 'zynqaes [operation type] <srcaddr>' output = u_boot_console.run_command('zynqaes %x $filesize %x %x' % (srcaddr, dstaddr, dstsize)) assert expected_zynqaes not in output
def test_fpga_secure_bit_img_auth_kup(u_boot_console): test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) f = u_boot_console.config.env.get('env__fpga_secure_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') keyaddr = f.get('keyaddr', None) if not keyaddr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' keyfn = f['keyfn'] output = u_boot_console.run_command('tftpboot %x %s' % (keyaddr, keyfn)) assert expected_tftp in output addr = f.get('addr', None) if not addr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' fn = f['enckupfn'] output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn)) assert expected_tftp in output expected_zynqmpsecure = 'Bitstream successfully loaded' output = u_boot_console.run_command('fpga loads 0 %x $filesize 0 1 %x' % (addr, keyaddr)) assert expected_zynqmpsecure in output
def test_zynqmp_secure_boot_img_kup(u_boot_console): test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) f = u_boot_console.config.env.get('env__zynqmp_secure_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') keyaddr = f.get('keyaddr', None) if not keyaddr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' keyfn = f['keyfn'] output = u_boot_console.run_command('tftpboot %x %s' % (keyaddr, keyfn)) assert expected_tftp in output addr = f.get('addr', None) if not addr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' fn = f['enckupfn'] output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn)) assert expected_tftp in output expected_zynqmpsecure = 'Verified image at' output = u_boot_console.run_command('zynqmp secure %x $filesize %x' % (addr, keyaddr)) assert expected_zynqmpsecure in output output = u_boot_console.run_command('pri zynqmp_verified_img_addr') assert "Error" not in output
def test_qspi_boot_images(u_boot_console): qspi_pre_commands(u_boot_console) if not qspi_detected: pytest.skip('QSPI not detected') if not test_net.net_set_up: pytest.skip('Network not initialized') test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) test_net.test_net_tftpboot(u_boot_console) f = u_boot_console.config.env.get('env__net_tftp_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') addr = f.get('addr', None) if not addr: addr = u_boot_utils.find_ram_base(u_boot_console) map = 0x0 temp = 0x50000 expected_write = "OK" output = u_boot_console.run_command('imxtract %x boot@1 %x' % (addr, temp)) assert expected_write in output expected_erase = "Erased: OK" output = u_boot_console.run_command('sf erase %x +$filesize ' % map) assert expected_erase in output expected_write = "Written: OK" output = u_boot_console.run_command('sf write %x %x $filesize' % (temp, map)) assert expected_write in output map = u_boot_console.config.buildconfig.get('config_sys_spi_u_boot_offs', "0x1000") map = int(map, 16) expected_write = "OK" output = u_boot_console.run_command('imxtract %x boot@2 %x' % (addr, temp)) assert expected_write in output expected_erase = "Erased: OK" output = u_boot_console.run_command('sf erase %x +$filesize ' % map) assert expected_erase in output expected_write = "Written: OK" output = u_boot_console.run_command('sf write %x %x $filesize' % (temp, map)) assert expected_write in output
def load_file_from_var(u_boot_console, name): dev, f = check_dev(u_boot_console) addr = f.get('addr', -1) if addr < 0: pytest.fail('No address specified via env__fpga_under_test') test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) bit = f['%s' % (name)] bit_size = f['%s_size' % (name)] expected_tftp = 'Bytes transferred = %d' % bit_size output = u_boot_console.run_command('tftpboot %x %s' % (addr, bit)) assert expected_tftp in output return f, dev, addr, bit, bit_size
def test_net_tftpboot_boot_config2(u_boot_console): if not test_net.net_set_up: pytest.skip('Network not initialized') test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) test_net.test_net_tftpboot(u_boot_console) f = u_boot_console.config.env.get('env__net_tftp_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') addr = f.get('addr', None) if not addr: addr = u_boot_utils.find_ram_base(u_boot_console) response = u_boot_console.run_command('imi %x' % addr) if not "config@2" in response: pytest.skip("Second configuration not found") timeout = 50000 with u_boot_console.temporary_timeout(timeout): try: # wait_for_prompt=False makes the core code not wait for the U-Boot # prompt code to be seen, since it won't be on a successful kernel # boot u_boot_console.run_command('bootm %x#config@2' % addr, wait_for_prompt=False) # You might want to expand wait_for() with options to add extra bad # patterns which immediately indicate a failed boot, or add a new # "with object" function u_boot_console.enable_check() that can # cause extra patterns like the U-Boot console prompt, U-Boot boot # error messages, kernel boot error messages, etc. to fail the # wait_for(). u_boot_console.wait_for('login:') finally: # This forces the console object to be shutdown, so any subsequent # test will reset the board back into U-Boot. We want to force this # no matter whether the kernel boot passed or failed. u_boot_console.drain_console() u_boot_console.cleanup_spawn()
def test_net_tftpboot_boot_config2(u_boot_console): if not test_net.net_set_up: pytest.skip('Network not initialized') test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) test_net.test_net_tftpboot(u_boot_console) f = u_boot_console.config.env.get('env__net_tftp_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') addr = f.get('addr', None) if not addr: addr = u_boot_utils.find_ram_base(u_boot_console) response = u_boot_console.run_command('imi %x' % addr) if not "config@2" in response: pytest.skip("Second configuration not found"); timeout = 50000 with u_boot_console.temporary_timeout(timeout): try: # wait_for_prompt=False makes the core code not wait for the U-Boot # prompt code to be seen, since it won't be on a successful kernel # boot u_boot_console.run_command('bootm %x#config@2' % addr, wait_for_prompt=False) # You might want to expand wait_for() with options to add extra bad # patterns which immediately indicate a failed boot, or add a new # "with object" function u_boot_console.enable_check() that can # cause extra patterns like the U-Boot console prompt, U-Boot boot # error messages, kernel boot error messages, etc. to fail the # wait_for(). u_boot_console.wait_for('login:') finally: # This forces the console object to be shutdown, so any subsequent # test will reset the board back into U-Boot. We want to force this # no matter whether the kernel boot passed or failed. u_boot_console.drain_console() u_boot_console.cleanup_spawn()
def test_zynq_aes_bitstream(u_boot_console): zynq_aes_pre_commands(u_boot_console) test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) f = u_boot_console.config.env.get('env__zynq_aes_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') srcaddr = f.get('srcaddr', None) if not srcaddr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' fn = f['fnbit'] output = u_boot_console.run_command('tftpboot %x %s' % (srcaddr, fn)) assert expected_tftp in output expected_zynqaes = 'zynqaes [operation type] <srcaddr>' output = u_boot_console.run_command('zynqaes load %x $filesize' % (srcaddr)) assert expected_zynqaes not in output
def test_zynq_rsa_image_invalid(u_boot_console): zynq_rsa_pre_commands(u_boot_console) test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) f = u_boot_console.config.env.get('env__zynq_rsa_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') srcaddr = f.get('srcaddr', None) if not srcaddr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' fninvalid = f['fninvalid'] output = u_boot_console.run_command('tftpboot %x %s' % (srcaddr, fninvalid)) assert expected_tftp in output expected_zynqrsa = 'zynq rsa <baseaddr>' output = u_boot_console.run_command('zynq rsa %x ' % (srcaddr)) assert expected_zynqrsa in output
def test_zynq_rsa_image(u_boot_console): zynq_rsa_pre_commands(u_boot_console) test_net.test_net_dhcp(u_boot_console) test_net.test_net_setup_static(u_boot_console) f = u_boot_console.config.env.get('env__zynq_rsa_readable_file', None) if not f: pytest.skip('No TFTP readable file to read') srcaddr = f.get('srcaddr', None) if not srcaddr: addr = u_boot_utils.find_ram_base(u_boot_console) expected_tftp = 'Bytes transferred = ' fn = f['fn'] output = u_boot_console.run_command('tftpboot %x %s' % (srcaddr, fn)) assert expected_tftp in output expected_zynqrsa = 'zynq rsa <baseaddr>' output = u_boot_console.run_command('zynq rsa %x ' % (srcaddr)) assert expected_zynqrsa not in output