Commit abc7f3ff authored by Helen Koike's avatar Helen Koike

wip: striped

parent fac40ca2
......@@ -28,6 +28,63 @@ fill_rootfs()
sudo chmod +x dm-mount/bin/init.sh
}
create_striped()
{
# Create disk
DISK=$1
PREFIX=$2
DM_DEV=dm-striped
if [ -f $DISK -a -f ${DISK}.info ]; then
echo "$DISK already exist, not creating it"
return
else
echo "creating $DISK"
fi
dd if=/dev/zero of=$DISK bs=512M count=4
# Partition 1
sudo sgdisk -n 1:0:+500M -t 1:7f01 "$DISK"
# Partition 2
sudo sgdisk -n 2:0:+500M -t 2:7f01 "$DISK"
# Partition 3
sudo sgdisk -n 3:0:+500M -t 3:7f01 "$DISK"
# Partition 4
sudo sgdisk -n 4:0:+500M -t 4:7f01 "$DISK"
LOOP_DEV=$(sudo losetup -fP --show $DISK)
sectors=$(sudo blockdev --getsz "${LOOP_DEV}"p1)
sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p2) + $sectors))
sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p3) + $sectors))
sectors=$(($(sudo blockdev --getsz "${LOOP_DEV}"p4) + $sectors))
PAGESIZE=$(getconf PAGESIZE)
table="0 $sectors striped 4 $PAGESIZE ${LOOP_DEV}p1 0 ${LOOP_DEV}p2 0 ${LOOP_DEV}p3 0 ${LOOP_DEV}p4 0"
echo "$table" | sudo dmsetup create $DM_DEV
bash -c "cat > ${DISK}.info" <<- EOF
${PREFIX}sectors=${sectors}
${PREFIX}PAGESIZE=${PAGESIZE}
EOF
echo "concise table (with loopback device)"
sudo dmsetup table --concise /dev/mapper/$DM_DEV
# Format
sudo mkfs.ext4 -L ROOT-STRIPED /dev/mapper/$DM_DEV
mkdir -p dm-mount
sudo mount /dev/mapper/$DM_DEV dm-mount
fill_rootfs "striped disk $DISK"
# Umount disk/dm/loopback
sudo umount dm-mount
rm -r dm-mount
sudo dmsetup remove $DM_DEV
sudo losetup -d $LOOP_DEV
}
# Create a simple rootfs - target verity
create_verity()
{
......@@ -179,6 +236,11 @@ launch_test()
fi
}
DS1=disk-strped-1.img
create_striped $DS1 DS1_
# Load disk info
source ${DS1}.info
DL1=disk-linear-1.img
create_linear $DL1 DL1_
# Load disk info
......@@ -357,3 +419,24 @@ launch_test \
"dm-verity,${UUID},4,ro,0 $DV1_sectors verity $DV1_hash_type 8:1 8:2 $DV1_data_block_size $DV1_hash_block_size $DV1_data_blocks 1 $DV1_hash_algorithm $DV1_root_hash $DV1_salt"
}
verity_tests
# --------------
# Striped
# --------------
striped_tests()
{
launch_test \
"striped: with minor" \
"-hda ${DS1}" \
/dev/dm-4 \
"dm-striped,,4,ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0"
UUID=123123123
launch_test \
"striped: with uuid" \
"-hda ${DS1}" \
/dev/dm-4 \
"dm-striped,${UUID},4,ro,0 $DS1_sectors striped 4 $DS1_PAGESIZE 8:1 0 8:2 0 8:3 0 8:4 0"
}
striped_tests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment