Skip to contentSkip to conversation

Sandbox: document support of block device emulation

PATCH New Stefan Brüns 3 participants 7 messages Aug 11, 2016 – Sep 8, 2016 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/3 Sandbox: document support of block device emulation

---
 board/sandbox/README.sandbox | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
board/sandbox/README.sandbox +19 -0
index ed820d3..02d8ab3 100644
@@ -320,6 +320,25 @@ CONFIG_SPI_IDLE_VAL
 	The idle value on the SPI bus
 
 
+Block Device Emulation
+----------------------
+
+U-Boot can use raw disk images for block device emulation. To e.g. list
+the contents of the root directory on the second partion of the image
+"disk.raw", you can use the following commands:
+
+=>host bind 0 ./disk.raw
+=>ls host 0:2
+
+A disk image can be created using the following commands:
+
+$> truncate -s 1200M ./disk.raw
+$> echo -e "label: gpt\n,64M,U\n,,L" | /usr/sbin/sfdisk  ./disk.raw
+$> lodev=`sudo losetup -P -f --show ./disk.raw`
+$> sudo mkfs.vfat -n EFI -v ${lodev}p1
+$> sudo mkfs.ext4 -L ROOT -v ${lodev}p2
+
+
 Writing Sandbox Drivers
 -----------------------
 
Signature · 1 line
2.9.2
#3 lore raw

PATCH v2 2/3 sandbox: Add "host size" hostfs command for fs test

In reply to a message not in the archive

This complements the size/fatsize/ext4size commands added in commit cf6598193aed5de8855eaf70c1994f2bc437255a
load, save and ls are already implemented for hostfs, now tests can cover the same operations on hostfs and emulated block devices.

---
 cmd/host.c | 8 ++++++++
 1 file changed, 8 insertions(+)
cmd/host.c +8 -0
index 8d84415..b427e54 100644
@@ -25,6 +25,12 @@ static int do_host_ls(cmd_tbl_t *cmdtp, int flag, int argc,
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
+static int do_host_size(cmd_tbl_t *cmdtp, int flag, int argc,
+			   char * const argv[])
+{
+	return do_size(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
+}
+
 static int do_host_save(cmd_tbl_t *cmdtp, int flag, int argc,
 			   char * const argv[])
 {
@@ -138,6 +144,7 @@ static cmd_tbl_t cmd_host_sub[] = {
 	U_BOOT_CMD_MKENT(load, 7, 0, do_host_load, "", ""),
 	U_BOOT_CMD_MKENT(ls, 3, 0, do_host_ls, "", ""),
 	U_BOOT_CMD_MKENT(save, 6, 0, do_host_save, "", ""),
+	U_BOOT_CMD_MKENT(size, 3, 0, do_host_size, "", ""),
 	U_BOOT_CMD_MKENT(bind, 3, 0, do_host_bind, "", ""),
 	U_BOOT_CMD_MKENT(info, 3, 0, do_host_info, "", ""),
 	U_BOOT_CMD_MKENT(dev, 0, 1, do_host_dev, "", ""),
@@ -174,6 +181,7 @@ U_BOOT_CMD(
 	"host ls hostfs - <filename>                    - list files on host\n"
 	"host save hostfs - <addr> <filename> <bytes> [<offset>] - "
 		"save a file to host\n"
+	"host size hostfs - <filename> - determine size of file on host"
 	"host bind <dev> [<filename>] - bind \"host\" device to file\n"
 	"host info [<dev>]            - show device binding & info\n"
 	"host dev [<dev>] - Set or retrieve the current host device\n"
Signature · 1 line
2.9.2
#4 lore raw

PATCH v2 2/3 sandbox: Add "host size" hostfs command for fs test

Quoted 10 lines · Stefan Br?ns

This complements the size/fatsize/ext4size commands added in commit cf6598193aed5de8855eaf70c1994f2bc437255a
load, save and ls are already implemented for hostfs, now tests can cover the same operations on hostfs and emulated block devices.

---
 cmd/host.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied to u-boot-dm/next, thanks!

#5 lore raw

PATCH v2 3/3 test/fs: strip carriage-return from sandbox output

In reply to a message not in the archive

DM added carriage-returns to every newline. Strip everything after the 32 character long mdsum.

---
 test/fs/fs-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/fs/fs-test.sh +1 -1
index 043e5d0..171b1de 100755
@@ -402,7 +402,7 @@ check_md5() {
 	# the 7th field is the actual md5
 	md5_src=`grep -A3 "$1" "$2" | grep "md5 for"`
 	md5_src=($md5_src)
-	md5_src=${md5_src[6]}
+	md5_src=${md5_src[6]:0:32}
 
 	# The md5 list, each line is of the form:
 	# - <md5>
Signature · 1 line
2.9.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

PATCH v2 3/3 test/fs: strip carriage-return from sandbox output

Quoted 13 lines · On Donnerstag, 11. August 2016 22:52:05 CEST you wrote:

DM added carriage-returns to every newline. Strip everything after the 32 character long mdsum.

---
 test/fs/fs-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/fs/fs-test.sh +0 -0
index 043e5d0..171b1de 100755

test/fs/fs-test.sh check_md5() { · line 408

Quoted 8 lines
test/fs/fs-test.sh +1 -1
@@ -402,7 +402,7 @@ check_md5() {
 	# the 7th field is the actual md5
 	md5_src=`grep -A3 "$1" "$2" | grep "md5 for"`
 	md5_src=($md5_src)
-	md5_src=${md5_src[6]}
+	md5_src=${md5_src[6]:0:32}
 
 	# The md5 list, each line is of the form:
 	# - <md5>

This issue has been fixed in a different way.

Superseded-by: 634a4d2e825ba2effc01298ca194cd5cb09f6e3a "fs-test.sh: Correct check_md5() test with newlines"

Kind regards,

Stefan

Signature · 3 lines
Stefan Br?ns  /  Bergstra?e 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019
work: +49 2405 49936-424
#8 lore raw

PATCH v2 3/3 test/fs: strip carriage-return from sandbox output

Quoted 20 lines · Stefan Bruens
Quoted 19 lines · On Donnerstag, 11. August 2016 22:52:05 CEST you wrote:

DM added carriage-returns to every newline. Strip everything after the 32 character long mdsum.

---
 test/fs/fs-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/fs/fs-test.sh +1 -1
index 043e5d0..171b1de 100755
@@ -402,7 +402,7 @@ check_md5() {
 	# the 7th field is the actual md5
 	md5_src=`grep -A3 "$1" "$2" | grep "md5 for"`
 	md5_src=($md5_src)
-	md5_src=${md5_src[6]}
+	md5_src=${md5_src[6]:0:32}
 
Quoted 7 lines

test/fs/fs-test.sh check_md5() { · line 408

Quoted 2 lines
test/fs/fs-test.sh +0 -0
 	# The md5 list, each line is of the form:
 	# - <md5>

This issue has been fixed in a different way.

Superseded-by: 634a4d2e825ba2effc01298ca194cd5cb09f6e3a "fs-test.sh: Correct check_md5() test with newlines"

Ug, sorry I missed this. On the plus side, I hit this (and cursed and fixed it) since I'm running fs-test.sh automatically on every batch of commits I bring in now, and it errors if the output changes.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160908/552cd68a/attachment.sig>