summaryrefslogtreecommitdiff
path: root/doc/usage/cmd/host.rst
blob: e14508986ca5195f2d2a9b198f0bdfcacad8d85b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.. SPDX-License-Identifier: GPL-2.0+

host command
============

Synopis
-------

::

    host bind [-r] <label> [<filename>]
    host unbind <label|seq>
    host info [<label|seq>]
    host dev [<label|seq>]

Description
-----------

The host command provides a way to attach disk images on the host to U-Boot
sandbox. This can be useful for testing U-Boot's filesystem implementations.

Common arguments:

<label|seq>
    This is used to specify a host device. It can either be a label (a string)
    or the sequence number of the device. An invalid value causes the command
    to fail.


host bind
~~~~~~~~~

This creates a new host device and binds a file to it.

Arguments:

label
    Label to use to identify this binding. This can be any string.

filename:
    Host filename to bind to

Flags:

-r
    Mark the device as removable


host unbind
~~~~~~~~~~~

This unbinds a host device that was previously bound. The sequence numbers of
other devices remain unchanged.


host info
~~~~~~~~~

Provides information about a particular host binding, or all of them.


host dev
~~~~~~~~

Allowing selecting a particular device, or (with no arguments) seeing which one
is selected.


Example
-------

Initially there are no devices::

    => host info
    dev       blocks label           path

Bind a device::

    => host bind -r test2 2MB.ext2.img
    => host bind fat 1MB.fat32.img
    => host info
    dev       blocks label           path
      0         4096 test2           2MB.ext2.img
      1         2048 fat             1MB.fat32.img

Select a device by label or sequence number::

    => host dev fat
    Current host device: 1: fat
    => host dev 0
    Current host device: 0: test2

Write a file::

    => ext4write host 0 0 /dump 1e00
    File System is consistent
    7680 bytes written in 3 ms (2.4 MiB/s)
    => ext4ls host 0
    <DIR>       4096 .
    <DIR>       4096 ..
    <DIR>      16384 lost+found
                4096 testing
                7680 dump

Unbind a device::

    => host unbind test2
    => host info
    dev       blocks label           path
      1         2048 fat             1MB.fat32.img


Return value
------------

The return value $? indicates whether the command succeeded.