예제 #1
0
파일: board_machine.py 프로젝트: sjg20/tbot
 def do_boot(self, ub: board.UBootShell) -> channel.Channel:
     ub.exec0("echo", "Booting linux ...")
     ub.exec0("echo", "[  0.000]", "boot: message")
     ub.exec0("echo", "[  0.013]", "boot: info")
     ub.exec0("echo", "[  0.157]", "boot: message")
     return ub.boot(
         board.Raw(
             "printf 'tb-login: '******'Password: '******'root' && $password = '******' ]] || exit 1"
         )
     )
예제 #2
0
    def do_set_env(
        self, ub: board.UBootShell
    ) -> bool:
        ub.env("serverip", tbot.selectable.LabHost.serverip["socrates"])
        ub.env("netmask", "255.255.255.0")
        ub.env("ipaddr", tbot.selectable.LabHost.boardip["socrates"])

        for env in ub_env:
            ub.env(env["name"], env["val"])
예제 #3
0
def ub_get_mem_addr(
    ub: board.UBootShell,
    addr,
    size,
) -> str:
    """
    address  : memory addr
    size: b, w or l
    """
    ub_check_size(size)

    ret = ub.exec(f"md.{size}", addr, "1")
    if ret[0] != 0:
        raise RuntimeError(f"Error reading {addr} {ret}")
    return "0x" + ret[1].split(" ")[1]
예제 #4
0
def ub_set_mem_addr(
    ub: board.UBootShell,
    addr,
    size,
    value,
    count = "1",
) -> None:
    """
    address  : memory addr
    size : b, w or l
    value: the value
    count : count
    """
    ub_check_size(size)

    ret = ub.exec(f"mw.{size}", addr, value, count)
    if ret[0] != 0:
        raise RuntimeError(f"Error wrinting {addr} {value} {ret}")
예제 #5
0
def ub_create_revfile(
    ub: board.UBootShell,
    revfile,
    startaddr,
    endaddr,
    mask = '0xffffffff',
    size = 'l',
) -> bool:
    ub_check_size(size)

    try:
        fd = open(revfile, 'w')
    except IOError:
        raise RuntimeError("Could not open: " + revfile)

    vers = ub.exec0("vers")

    fd.write("# U-Boot   :\n")
    vers = vers.split("\n")
    for line in vers:
        fd.write("# %s\n" % line)
    fd.write("# regaddr mask type defval\n")

    start = int(startaddr, 16)
    stop = int(endaddr, 16)

    if size == 'l':
        step = 4
    if size == 'w':
        step = 2
    if size == 'b':
        step = 1

    for i in iter(range(start, stop, step)):
        val = ub_get_mem_addr(ub, hex(i), size)
        fd.write('%-10s %10s %10s %10s\n' % (hex(i), mask, size, val))

    fd.close()
    return True
예제 #6
0
파일: board_machine.py 프로젝트: sjg20/tbot
 def do_boot(self, ub: board.UBootShell) -> channel.Channel:
     ub.exec0("echo", "Booting linux ...")
     ub.exec0("echo", "[  0.000]", "boot: message")
     ub.exec0("echo", "[  0.013]", "boot: info")
     ub.exec0("echo", "[  0.157]", "boot: message")
     ub.exec0("export", "HOME=/tmp")
     return ub.boot(
         board.Raw(
             "printf 'tb-login: '******'root' ]] || exit 1"
         )
     )
예제 #7
0
 def do_boot(self, ub: board.UBootShell) -> channel.Channel:
     self.uboot.do_set_env(self, ub)
     return ub.boot("run", "bootcmd")
예제 #8
0
 def do_set_env(self, ub: board.UBootShell) -> bool:
     ub.env("serverip", tbot.selectable.LabHost.serverip["wandboard"])
     ub.env("netmask", "255.255.255.0")
     ub.env("ipaddr", tbot.selectable.LabHost.boardip["wandboard"])
     ta = ub.host.tftp_dir_board
     f = ta / "SPL"
     ub.env("spl_file", ge.get_path(f))
     f = ta / "u-boot.img"
     ub.env("ub_file", ge.get_path(f))
     ub.env("cmp_addr_r", "11000000")
     for env in ub_env:
         ub.env(env["name"], env["val"])
예제 #9
0
 def do_set_env(self, ub: board.UBootShell) -> bool:
     ub.env("serverip", tbot.selectable.LabHost.serverip)
     ub.env("netmask", "255.255.255.0")
     ub.env("ipaddr", tbot.selectable.LabHost.boardip["bbb"])
     ub.env("load_addr_r", "81000000")
     ub.env("cmp_addr_r", "82000000")
     tftpboardname = "bbb"
     ub_load_board_env_subdir = tbot.selectable.LabHost.ub_load_board_env_subdir
     #nfs_subdir = ge.get_path(tbot.selectable.LabHost.nfs_root) + "/bbb"
     nfs_subdir = "/work/tbot2go/tbot/nfs/bbb"
     ub.env("mlofile", f"{tftpboardname}/{ub_load_board_env_subdir}/MLO")
     ub.exec0("setenv", "load_mlo", "tftp",
              linux.special.Raw("${load_addr_r}"),
              linux.special.Raw("${mlofile}"))
     ub.env("ubfile",
            f"{tftpboardname}/{ub_load_board_env_subdir}/u-boot.img")
     ub.exec0("setenv", "load_uboot", "tftp",
              linux.special.Raw("${load_addr_r}"),
              linux.special.Raw("${ubfile}"))
     ub.exec0(
         linux.special.Raw(
             'setenv upd_mlo mmc dev 0\;fatwrite mmc 0:1 \${load_addr_r} MLO \${filesize}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv upd_uboot mmc dev 0\;fatwrite mmc 0:1 \${load_addr_r} u-boot.img \${filesize}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv cmp_mlo fatload mmc 0:1 \${load_addr_r} MLO \${filesize}\;tftp \${cmp_addr_r} \${mlofile}\;cmp.b \${load_addr_r} \${cmp_addr_r} \${filesize}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv cmp_uboot fatload mmc 0:1 \${load_addr_r} u-boot.img\;tftp \${cmp_addr_r} \${ubfile}\;cmp.b \${load_addr_r} \${cmp_addr_r} \${filesize}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv tbot_upd_uboot run load_uboot\;run upd_uboot_emmc'))
     ub.exec0(linux.special.Raw('setenv tbot_cmp_uboot run cmp_uboot_emmc'))
     ub.exec0(
         linux.special.Raw(
             'setenv tbot_upd_spl run load_mlo\;run upd_mlo_emmc'))
     ub.exec0(linux.special.Raw('setenv tbot_cmp_spl run cmp_mlo_emmc'))
     ub.exec0(
         linux.special.Raw(
             'setenv upd_mlo_emmc mmc dev 1\;mmc write \${load_addr_r} 100 100'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv upd_uboot_emmc mmc dev 1\;mmc erase 400 400\;mmc write \${load_addr_r} 300 600'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv cmp_mlo_emmc mmc read \${cmp_addr_r} 100 100\;cmp.b \${load_addr_r} \${cmp_addr_r} \${filesize}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv cmp_uboot_emmc mmc read \${cmp_addr_r} 300 600\;cmp.b \${load_addr_r} \${cmp_addr_r} \${filesize}'
         ))
     ub.exec0(linux.special.Raw('setenv console ttyO0,115200n8'))
     ub.exec0(linux.special.Raw('setenv console ttyS0,115200n8'))
     ub.env("bootfile",
            f"{tftpboardname}/{ub_load_board_env_subdir}/zImage")
     ub.env(
         "fdtfile",
         f"{tftpboardname}/{ub_load_board_env_subdir}/am335x-boneblack.dtb")
     ub.exec0(
         linux.special.Raw(
             'setenv netmmcboot echo Booting from network ... with mmcargs ...\; setenv autoload no\; run netloadimage\; run netloadfdt\; run args_mmc\; bootz \${loadaddr} - \${fdtaddr}'
         ))
     ub.env("netdev", "eth0")
     ub.env("hostname", "bbb")
     ub.exec0(
         linux.special.Raw(
             'setenv addip setenv bootargs \${bootargs} ip=\${ipaddr}:\${serverip}:\${gatewayip}:\${netmask}:\${hostname}:\${netdev}::off panic=1'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv addcon setenv bootargs \${bootargs} console=\${console}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv addmisc setenv bootargs \${bootargs} loglevel=8'))
     ub.exec0(
         linux.special.Raw(
             'setenv addmtd setenv bootargs \${bootargs} \${mtdparts}'))
     ub.env("rootpath", nfs_subdir)
     ub.env("nfsopts", "nfsvers=3 nolock rw")
     ub.exec0(
         linux.special.Raw(
             'setenv nfsargs setenv bootargs \${bootargs} root=/dev/nfs rw nfsroot=\${serverip}:\${rootpath},\${nfsopts}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv net_nfs run netloadimage\; run netloadfdt\;run nfsargs addcon addip addmtd addmisc\;bootz \${loadaddr} - \${fdtaddr}'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv sdloadk ext2load mmc 0:2 \${loadaddr} /boot/zImage'))
     ub.exec0(
         linux.special.Raw(
             'setenv sdloadfdt ext2load mmc 0:2 \${fdtaddr} /boot/am335x-boneblack.dtb'
         ))
     ub.exec0(
         linux.special.Raw(
             'setenv sd_sd run sdloadk\; run sdloadfdt\;run args_mmc addip addmtd addmisc\;bootz \${loadaddr} - \${fdtaddr}'
         ))
     for env in ub_env:
         ub.env(env["name"], env["val"])
예제 #10
0
def selftest_decorated_uboot(ub: board.UBootShell) -> None:
    ub.exec0("version")
예제 #11
0
def ub_get_var(
    ub: board.UBootShell,
    name,
) -> str:
    ret = ub.exec0("printenv", name)
    return ret.split("=")[1].strip()
예제 #12
0
def smoke_test(ub: board.UBootShell) -> None:
    ub.exec0("version")
    ub.exec0("bdinfo")
    ub.exec0("printenv")