[U-Boot] [PATCH] sandbox: block driver using host file/device as backing store

Simon Glass sjg at chromium.org
Wed May 15 19:42:25 CEST 2013


Hi Henrik,

On Tue, May 14, 2013 at 4:36 PM, Henrik Nordström
<henrik at henriknordstrom.net> wrote:
> A simple "host" block driver using any host file/device
> as backing store.
>
> The mapping is established using the "sb bind" command
>
> Signed-off-by: Henrik Nordstrom <henrik at henriknordstrom.net>
> ---
>  common/cmd_sandbox.c       |  10 +++-
>  disk/part.c                |  20 ++-----
>  drivers/block/Makefile     |   1 +
>  drivers/block/sandbox.c    | 130 +++++++++++++++++++++++++++++++++++++++++++++
>  include/config_fallbacks.h |   3 +-
>  include/configs/sandbox.h  |   2 +
>  include/part.h             |   3 ++
>  7 files changed, 150 insertions(+), 19 deletions(-)
>  create mode 100644 drivers/block/sandbox.c

This is cool, a great addition to sandbox. Thanks for doing it.

Some high-level comments:

Configuring for sandbox board...
sandbox.c: In function ‘host_dev_bind’:
sandbox.c:90:3: warning: implicit declaration of function ‘free’
[-Wimplicit-function-declaration]
cmd_sandbox.c: In function ‘do_sandbox_bind’:
cmd_sandbox.c:44:2: warning: implicit declaration of function
‘host_dev_bind’ [-Wimplicit-function-declaration]
cmd_sandbox.c:44:2: warning: implicit declaration of function ‘atoi’
[-Wimplicit-function-declaration]

 - should not have any warnings

=>sb bind
Segmentation fault (core dumped)

- should print a nice error if an arg is missing

=>sb bind fred
=>

- should print an error if the file is not found

- should create an example of how to use this

- suggest a test script in test/sandbox which sets up a loopback
device containing a partition table and ext2 filesystem (for example,
then runs U-Boot sandbox and lists and reads a file. Example test
scripts you might copy are:

http://patchwork.ozlabs.org/patch/228876/

and this rather more complicated one:

http://patchwork.ozlabs.org/patch/211049/

Also please enable partitions and EFI support so we get more functionality:

#define CONFIG_PARTITION_UUIDS
#define CONFIG_CMD_PART
#define CONFIG_EFI_PARTITION


Here is the test I did:

$ ./x/u-boot


U-Boot 2013.04-00139-g5a35ef9 (May 15 2013 - 05:47:23)

DRAM:  128 MiB
Using default environment

In:    serial
Out:   serial
Err:   serial
=>sb bind dev chromiumos_test_image.bin
=>part list host 0

Partition Map for UNKNOWN device 0  --   Partition Type: EFI

Part Start LBA End LBA Name
Attributes
Type UUID
Partition UUID
  1 0x002b2000 0x004b1fff "STATE"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
uuid: 8e484e16-9146-a540-aa05-4a01d5b2708e
  2 0x00005000 0x0000cfff "KERN-A"
attrs: 0x01ff000000000000
type: fe3a2a5d-4f32-41a7-b725-accc3285a309
uuid: 3c2cce96-351d-1442-b443-180979877d50
  3 0x00046000 0x002b1fff "ROOT-A"
attrs: 0x0000000000000000
type: 3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec
uuid: ae059dce-752f-934a-a9f5-2e2ae329a763
  4 0x0000d000 0x00014fff "KERN-B"
attrs: 0x00f0000000000000
type: fe3a2a5d-4f32-41a7-b725-accc3285a309
uuid: bdc023ba-749e-6a41-8328-994a67193adf
  5 0x00045000 0x00045fff "ROOT-B"
attrs: 0x0000000000000000
type: 3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec
uuid: 8055a9ee-41e9-f443-8f6e-aff694b92d01
  6 0x00004040 0x00004040 "KERN-C"
attrs: 0x00f0000000000000
type: fe3a2a5d-4f32-41a7-b725-accc3285a309
uuid: 551febf2-23f5-6047-811b-3ba38498e99d
  7 0x00004041 0x00004041 "ROOT-C"
attrs: 0x0000000000000000
type: 3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec
uuid: c26b8ef3-8d80-974e-8871-62b4ef521dda
  8 0x00015000 0x0001cfff "OEM"
attrs: 0x0000000000000000
type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
uuid: 9bc99b8d-00a8-9d48-9897-c328a06299cd
  9 0x00004042 0x00004042 "reserved"
attrs: 0x0000000000000000
type: 2e0a753d-9e48-43b0-8337-b15192cb1b5e
uuid: 796ef203-c110-dc41-acd1-aea3c1a9d040
 10 0x00004043 0x00004043 "reserved"
attrs: 0x0000000000000000
type: 2e0a753d-9e48-43b0-8337-b15192cb1b5e
uuid: 3e086568-db49-6a42-8022-6ce0e4cfb989
 11 0x00000040 0x0000403f "RWFW"
attrs: 0x0000000000000000
type: cab6e88e-abf3-4102-a07a-d4bb9be3c1d3
uuid: eefcac05-3fba-0c4a-a519-8db04a10cd1f
 12 0x0003d000 0x00044fff "EFI-SYSTEM"
attrs: 0x0000000000000000
type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
uuid: 6ddce429-6592-8144-a1c2-d4ac818fbe3e
=>reset



Regards,
Simon


More information about the U-Boot mailing list