Skip to content

Instantly share code, notes, and snippets.

@stu43005
Created July 3, 2022 06:21
Show Gist options
  • Select an option

  • Save stu43005/27da08491b1ae9dbe219db8906ed1a14 to your computer and use it in GitHub Desktop.

Select an option

Save stu43005/27da08491b1ae9dbe219db8906ed1a14 to your computer and use it in GitHub Desktop.

Revisions

  1. stu43005 created this gist Jul 3, 2022.
    15 changes: 15 additions & 0 deletions edit_system.img.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 擴充大小
    system_size=$(( $(du -sB512 system.img | cut -f1) + 200000 ))
    e2fsck -yf system.img
    resize2fs system.img "$system_size"s
    # 掛載映像檔
    mkdir -p /tmp/system
    sudo mount -o loop system.img /tmp/system
    #
    # << 在這邊編輯 /tmp/system 內容
    #
    # 取消掛載
    sudo umount /tmp/system
    # 精簡大小
    e2fsck -yf system.img
    resize2fs -M system.img