We use dm-verity to verify /dev/sda6 linux partition. In order to do this, we created verity.conf file and there we have this line to add cmdline parameters:
KERNEL_CMD_PARAMS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'dm_verity', 'dmname=system version=1 data_device=/dev/sda6 hash_device=/dev/sda6 data_block_size=4096 hash_block_size=4096 number_of_data_blocks=393216 hash_start_block=393217 algorithm=sha256 digest=1c2d8551b79d4b2b3764e7344c31c26a4da6e5dd088a38b34469c5e31e44d75d salt=0bd935893760484302ad2db72b8cdac7647aea8faa3910cdd9945df377952aa9 opt=restart_on_corruption ', '', d)}"Here we can see that we have data_device=/dev/sda6, it means now we want to verify our sda6 partition
As I understand, there is some C code in the linux kernel, that can parse all this parameters(for example data_device) and do some work(calculate hash tree for this partition I guess)
I was even able to find this file. It's called do_mount_verity.c and here the essence of the code:
static char dm_data_device[VERITY_COMMANDLINE_PARAM_LENGTH];...static int __init dm_data_device_param(char *line){ strlcpy(dm_data_device, line, sizeof(dm_data_device)); return 1;}__setup("data_device=", dm_data_device_param);...verity_params += snprintf(verity_params, bufsize, "%s %s %s %s %s %s %s %s %s %s 1 %s", version, data_device, hash_device, data_block_size, hash_block_size, number_of_data_blocks, hash_start_block, algorithm, digest, salt, opt);Code is simple, but since I'm really new in embedded linux, I stuck with a question:
Now I need to use dm-verity to verify sda6 and sda9 partitions during one boot. I understand it might be a complex question, but in fact all I need is to figure out how to pass two parameters to data_device. Now I even don't understand where to go, so any hint or advice would be great
I found do_mount_verity.c using this command from the kernel sources directory:
grep -nr "data_device" ./*
May be I can find some useful files using another strategy.
I am really new in embedded linux and now it's a little stressful for me.
I'll appreciate any advice, hints or comments, thank you!