diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2023-01-19 14:03:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-01-19 14:03:27 +0000 |
commit | c0ec063b397e3c4de7ccad664b633ddc5b5fa311 (patch) | |
tree | 5017b2c234256a5b31bcb468a48d0846201cb1f2 | |
parent | 084c47eaa98075799606b6375a92bb13f237de5d (diff) | |
parent | 11fda8554a72d08b0dc3ac032aa6ac4b3b009525 (diff) | |
download | tests-c0ec063b397e3c4de7ccad664b633ddc5b5fa311.tar.gz |
Merge "build_rootfs.sh: do not use e2fsck with offset after qemu"
-rwxr-xr-x | net/test/build_rootfs.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/net/test/build_rootfs.sh b/net/test/build_rootfs.sh index 3a88cad..ef5f491 100755 --- a/net/test/build_rootfs.sh +++ b/net/test/build_rootfs.sh @@ -374,8 +374,14 @@ if [[ ${rootfs_partition} = "raw" ]]; then sudo e2fsck -p -f "${disk}" || true else rootfs_partition_start=$(partx -g -o START -s -n "${rootfs_partition}" "${disk}" | xargs) + rootfs_partition_end=$(partx -g -o END -s -n "${rootfs_partition}" "${disk}" | xargs) + rootfs_partition_num_sectors=$((${rootfs_partition_end} - ${rootfs_partition_start} + 1)) rootfs_partition_offset=$((${rootfs_partition_start} * 512)) - e2fsck -p -f "${disk}"?offset=${rootfs_partition_offset} || true + rootfs_partition_tempfile2=$(mktemp) + dd if="${disk}" of="${rootfs_partition_tempfile2}" bs=512 skip=${rootfs_partition_start} count=${rootfs_partition_num_sectors} + e2fsck -p -f "${rootfs_partition_tempfile2}" || true + dd if="${rootfs_partition_tempfile2}" of="${disk}" bs=512 seek=${rootfs_partition_start} count=${rootfs_partition_num_sectors} conv=fsync,notrunc + rm -f "${rootfs_partition_tempfile2}" e2fsck -fy "${disk}"?offset=${rootfs_partition_offset} || true fi if [[ -n "${system_partition}" ]]; then @@ -500,8 +506,14 @@ if [[ ${rootfs_partition} = "raw" ]]; then sudo e2fsck -p -f "${disk}" || true else rootfs_partition_start=$(partx -g -o START -s -n "${rootfs_partition}" "${disk}" | xargs) + rootfs_partition_end=$(partx -g -o END -s -n "${rootfs_partition}" "${disk}" | xargs) + rootfs_partition_num_sectors=$((${rootfs_partition_end} - ${rootfs_partition_start} + 1)) rootfs_partition_offset=$((${rootfs_partition_start} * 512)) - e2fsck -p -f "${disk}"?offset=${rootfs_partition_offset} || true + rootfs_partition_tempfile2=$(mktemp) + dd if="${disk}" of="${rootfs_partition_tempfile2}" bs=512 skip=${rootfs_partition_start} count=${rootfs_partition_num_sectors} + e2fsck -p -f "${rootfs_partition_tempfile2}" || true + dd if="${rootfs_partition_tempfile2}" of="${disk}" bs=512 seek=${rootfs_partition_start} count=${rootfs_partition_num_sectors} conv=fsync,notrunc + rm -f "${rootfs_partition_tempfile2}" e2fsck -fy "${disk}"?offset=${rootfs_partition_offset} || true fi if [[ -n "${system_partition}" ]]; then |