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