aboutsummaryrefslogtreecommitdiff
path: root/cmd/ubi.c
diff options
context:
space:
mode:
authorQuentin Schulz2019-09-12 16:41:01 +0200
committerHeiko Schocher2019-10-16 05:42:27 +0200
commit386f20cade50ed36674e3e5827cb282eb1da95c2 (patch)
treeb084513c19101ec67303d61cec05c460be154215 /cmd/ubi.c
parent6891152a4596d38ac25d2fe1238e3b6a938554b8 (diff)
ubi: provide a way to skip CRC checks
Some users of static UBI volumes implement their own integrity check, thus making the volume CRC check done at open time useless. For instance, this is the case when one use the ubiblock + dm-verity + squashfs combination, where dm-verity already checks integrity of the block device but this time at the block granularity instead of verifying the whole volume. Skipping this test drastically improves the boot-time. Adapted to U-Boot by Stefan Roese. Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de> Cc: Quentin Schulz <quentin.schulz@bootlin.com> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'cmd/ubi.c')
-rw-r--r--cmd/ubi.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/cmd/ubi.c b/cmd/ubi.c
index ca5dc9021b1..c857f07d930 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -146,7 +146,8 @@ bad:
return err;
}
-static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id)
+static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
+ bool skipcheck)
{
struct ubi_mkvol_req req;
int err;
@@ -163,7 +164,10 @@ static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id)
strcpy(req.name, volume);
req.name_len = strlen(volume);
req.name[req.name_len] = '\0';
- req.padding1 = 0;
+ req.flags = 0;
+ if (skipcheck)
+ req.flags |= UBI_VOL_SKIP_CRC_CHECK_FLG;
+
/* It's duplicated at drivers/mtd/ubi/cdev.c */
err = verify_mkvol_req(ubi, &req);
if (err) {
@@ -469,6 +473,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int64_t size = 0;
ulong addr = 0;
+ bool skipcheck = false;
if (argc < 2)
return CMD_RET_USAGE;
@@ -527,6 +532,12 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Use maximum available size */
size = 0;
+ /* E.g., create volume with "skipcheck" bit set */
+ if (argc == 7) {
+ skipcheck = strncmp(argv[6], "--skipcheck", 11) == 0;
+ argc--;
+ }
+
/* E.g., create volume size type vol_id */
if (argc == 6) {
id = simple_strtoull(argv[5], NULL, 16);
@@ -555,8 +566,10 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("No size specified -> Using max size (%lld)\n", size);
}
/* E.g., create volume */
- if (argc == 3)
- return ubi_create_vol(argv[2], size, dynamic, id);
+ if (argc == 3) {
+ return ubi_create_vol(argv[2], size, dynamic, id,
+ skipcheck);
+ }
}
if (strncmp(argv[1], "remove", 6) == 0) {
@@ -623,7 +636,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
U_BOOT_CMD(
- ubi, 6, 1, do_ubi,
+ ubi, 7, 1, do_ubi,
"ubi commands",
"detach"
" - detach ubi from a mtd partition\n"
@@ -634,7 +647,7 @@ U_BOOT_CMD(
" - Display volume and ubi layout information\n"
"ubi check volumename"
" - check if volumename exists\n"
- "ubi create[vol] volume [size] [type] [id]\n"
+ "ubi create[vol] volume [size] [type] [id] [--skipcheck]\n"
" - create volume name with size ('-' for maximum"
" available size)\n"
"ubi write[vol] address volume size"