Simon Glass | 2851cc9 | 2022-10-29 19:47:18 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | host command |
| 4 | ============ |
| 5 | |
| 6 | Synopis |
| 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 | |
| 16 | Description |
| 17 | ----------- |
| 18 | |
| 19 | The host command provides a way to attach disk images on the host to U-Boot |
| 20 | sandbox. This can be useful for testing U-Boot's filesystem implementations. |
| 21 | |
| 22 | Common 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 | |
| 30 | host bind |
| 31 | ~~~~~~~~~ |
| 32 | |
| 33 | This creates a new host device and binds a file to it. |
| 34 | |
| 35 | Arguments: |
| 36 | |
| 37 | label |
| 38 | Label to use to identify this binding. This can be any string. |
| 39 | |
| 40 | filename: |
| 41 | Host filename to bind to |
| 42 | |
| 43 | Flags: |
| 44 | |
| 45 | -r |
| 46 | Mark the device as removable |
| 47 | |
| 48 | |
| 49 | host unbind |
| 50 | ~~~~~~~~~~~ |
| 51 | |
| 52 | This unbinds a host device that was previously bound. The sequence numbers of |
| 53 | other devices remain unchanged. |
| 54 | |
| 55 | |
| 56 | host info |
| 57 | ~~~~~~~~~ |
| 58 | |
| 59 | Provides information about a particular host binding, or all of them. |
| 60 | |
| 61 | |
| 62 | host dev |
| 63 | ~~~~~~~~ |
| 64 | |
| 65 | Allowing selecting a particular device, or (with no arguments) seeing which one |
| 66 | is selected. |
| 67 | |
| 68 | |
| 69 | Example |
| 70 | ------- |
| 71 | |
| 72 | Initially there are no devices:: |
| 73 | |
| 74 | => host info |
| 75 | dev blocks label path |
| 76 | |
| 77 | Bind 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 | |
| 86 | Select 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 | |
| 93 | Write 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 | |
| 105 | Unbind a device:: |
| 106 | |
| 107 | => host unbind test2 |
| 108 | => host info |
| 109 | dev blocks label path |
| 110 | 1 2048 fat 1MB.fat32.img |
| 111 | |
| 112 | |
| 113 | Return value |
| 114 | ------------ |
| 115 | |
| 116 | The return value $? indicates whether the command succeeded. |