add utils for image modify

This commit is contained in:
Lu Hui
2024-04-22 11:19:46 +08:00
parent cb03057336
commit 89c2b52bbd
3 changed files with 34 additions and 0 deletions

View File

@@ -38,3 +38,11 @@ on some system, qt5svg or qt5base will build failed on first build, please retry
```
build_all
```
# how to modify image after build:
```
./host/mount_image.sh install/xxxxxx/xxxx.img mountpoint
cd mountpoint
touch xxx
```

BIN
host/fuse2fs Executable file

Binary file not shown.

26
host/mount_image.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
THISDIR=$(dirname $(realpath $0))
if [ -z $2 ]
then
echo "usage: $0 image dir"
fi
if [ ! -e $2 ]
then
mkdir -pv $2
fi
set -eux
PART=2
PART_OFFSET=$(partx -s $1 | head -n 3 | tail -n 1 | awk '{print $2}')
PART_OFFSET=$((PART_OFFSET * 512)) # sector size is 512
echo "PART: $PART"
echo "PART OFFSET: $PART_OFFSET"
# some old version fuse2fs not support offset
$THISDIR/fuse2fs -o fakeroot -o offset=$PART_OFFSET $1 $2