~aleteoryx/muditaos

ref: c34a85f49470b224954fbb89342e1df79e6e5362 muditaos/module-platform/linux/tests/gendisktestimg.sh -rwxr-xr-x 1.1 KiB
c34a85f4 — Lefucjusz [MOS-1037] Fix disappearing 'Call' label in phonebook 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash -e
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
#For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

if [ $# -ne 1 ]; then
	echo "Error! Invalid argument count"
	exit -1
fi
IMAGE_FILE_DIR="$1"

dd if=/dev/zero of=$IMAGE_FILE_DIR/test_disk.img bs=512 count=8
sfdisk $IMAGE_FILE_DIR/test_disk.img << ==sfdisk
,1,L
,1,L
,,L
==sfdisk

dd if=/dev/zero of=$IMAGE_FILE_DIR/test_disk_ext.img bs=512 count=16
sfdisk $IMAGE_FILE_DIR/test_disk_ext.img << ==sfdisk
,1,L
,,E
,1,L
,1,L
,1,L
,1,L
,1,L
,,L
==sfdisk

dd if=/dev/zero of=$IMAGE_FILE_DIR/test_disk_bad_tmp.img bs=512 count=16
sfdisk $IMAGE_FILE_DIR/test_disk_bad_tmp.img << ==sfdisk
,1,L
==sfdisk

# Modify parition table to simply broke it, which ten can be tested.
{ head -c 458 $IMAGE_FILE_DIR/test_disk_bad_tmp.img; printf '\xFF'; tail -c +460 $IMAGE_FILE_DIR/test_disk_bad_tmp.img; } > $IMAGE_FILE_DIR/test_disk_bad.img
rm $IMAGE_FILE_DIR/test_disk_bad_tmp.img