-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patherofsfuse-kbuild-test
executable file
·49 lines (45 loc) · 1.42 KB
/
erofsfuse-kbuild-test
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
42
43
44
45
46
47
48
49
#!/bin/bash
[ "$1" -eq 1 ] && args='-zlz4hc,12'
if [ "$1" -eq 2 ]; then
blks=$((RANDOM % 255 + 2))
echo "EROFS pclusterblks=$blks"
args="-zlz4hc,12 -C$((blks*4096)) --random-pclusterblks"
fi
if [ "$1" -eq 3 ]; then
chunksize=$((4096 << (RANDOM % 11)))
echo "EROFS chunksize=$chunksize (blockmap)"
args="--chunksize $chunksize -Eforce-inode-blockmap"
fi
if [ "$1" -eq 4 ]; then
chunksize=$((4096 << (RANDOM % 11)))
echo "EROFS chunksize=$chunksize (chunkindexes)"
args="--chunksize $chunksize -Eforce-chunk-indexes"
fi
[ "$1" -eq 5 ] && args='-zdeflate,9'
if [ "$1" -eq 6 ]; then
blks=$((RANDOM % 255 + 2))
echo "EROFS DEFLATE pclusterblks=$blks"
args="-zdeflate,9 -C$((blks*4096)) --random-pclusterblks"
fi
extractDir=""
case "$2" in
*.tar.gz )
args="$args --gzip --tar=f"
extractDir="${2%%.tar.gz}/"
;;
*.tgz )
args="$args --gzip --tar=f"
extractDir="${2%%.tgz}/"
;;
*.tar )
args="$args --tar=f"
extractDir="${2%%.tar}/"
;;
esac
bin/mkfs.erofs --force-uid="$(id -u)" --force-gid="$(id -g)" $args lowerdir.erofs.img $2 && rm -rf $2
bin/fsck.erofs lowerdir.erofs.img || exit 1
mkdir {lower,upper,work}dir linux
bin/erofsfuse lowerdir.erofs.img lowerdir
fuse-overlayfs -olowerdir=lowerdir,upperdir=upperdir,workdir=workdir linux
cd linux/$extractDir && make defconfig && make -j24 && make mrproper && cd -
fusermount -u linux && fusermount -u lowerdir