1.. SPDX-License-Identifier: GPL-2.0+
2
3host command
4============
5
6Synopis
7-------
8
9::
10
11    host bind [-r] <label> [<filename>]
12    host unbind <label|seq>
13    host info [<label|seq>]
14    host dev [<label|seq>]
15
16Description
17-----------
18
19The host command provides a way to attach disk images on the host to U-Boot
20sandbox. This can be useful for testing U-Boot's filesystem implementations.
21
22Common arguments:
23
24<label|seq>
25    This is used to specify a host device. It can either be a label (a string)
26    or the sequence number of the device. An invalid value causes the command
27    to fail.
28
29
30host bind
31~~~~~~~~~
32
33This creates a new host device and binds a file to it.
34
35Arguments:
36
37label
38    Label to use to identify this binding. This can be any string.
39
40filename:
41    Host filename to bind to
42
43Flags:
44
45-r
46    Mark the device as removable
47
48
49host unbind
50~~~~~~~~~~~
51
52This unbinds a host device that was previously bound. The sequence numbers of
53other devices remain unchanged.
54
55
56host info
57~~~~~~~~~
58
59Provides information about a particular host binding, or all of them.
60
61
62host dev
63~~~~~~~~
64
65Allowing selecting a particular device, or (with no arguments) seeing which one
66is selected.
67
68
69Example
70-------
71
72Initially there are no devices::
73
74    => host info
75    dev       blocks label           path
76
77Bind a device::
78
79    => host bind -r test2 2MB.ext2.img
80    => host bind fat 1MB.fat32.img
81    => host info
82    dev       blocks label           path
83      0         4096 test2           2MB.ext2.img
84      1         2048 fat             1MB.fat32.img
85
86Select a device by label or sequence number::
87
88    => host dev fat
89    Current host device: 1: fat
90    => host dev 0
91    Current host device: 0: test2
92
93Write a file::
94
95    => ext4write host 0 0 /dump 1e00
96    File System is consistent
97    7680 bytes written in 3 ms (2.4 MiB/s)
98    => ext4ls host 0
99    <DIR>       4096 .
100    <DIR>       4096 ..
101    <DIR>      16384 lost+found
102                4096 testing
103                7680 dump
104
105Unbind a device::
106
107    => host unbind test2
108    => host info
109    dev       blocks label           path
110      1         2048 fat             1MB.fat32.img
111
112
113Return value
114------------
115
116The return value $? indicates whether the command succeeded.
117