Adding fonts by modifying system.img #294
-
I want to add Fairfax fonts to my phone. Then I realized I had signed the OS with my own keys thanks to I'm a complete beginner at rooting and have no idea where to start searching for information regarding these sorts of things. Here's the commands I executed and their outputs: $ avbroot ota extract -i FP5-ota_update-24507000.zip -d extracted
0.001s INFO Extracting from the payload: boot, system, vbmeta, vbmeta_system, vendor_boot
1.695s INFO Successfully extracted OTA
$ cd extracted
$ avbroot avb unpack -i system.img
# [OUTPUT OMITTED] (will add, if needed)
$ resize2fs raw.img 1000M
resize2fs 1.47.0 (5-Feb-2023)
Resizing the filesystem on raw.img to 256000 (4k) blocks.
The filesystem on raw.img is now 256000 (4k) blocks long.
$ mkdir raw
$ doas mount raw.img raw
$ doas cp -a /usr/share/fonts/TTF/Fairfax* raw/system/fonts
$ doas umount raw
$ e2fsck -f raw.img # resize2fs requests this after every mount
e2fsck 1.47.0 (5-Feb-2023)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/: ***** FILE SYSTEM WAS MODIFIED *****
/: 3072/3584 files (0.4% non-contiguous), 219385/256000 blocks
$ resize2fs -M raw.img # shrinks the fs to as small as it can
resize2fs 1.47.0 (5-Feb-2023)
Resizing the filesystem on raw.img to 219426 (4k) blocks.
The filesystem on raw.img is now 219426 (4k) blocks long.
$ avbroot avb pack -o system.img
1.285s INFO Leaving AVB header unsigned
4.030s ERROR Failed to write appended AVB image
Caused by:
905834496 byte image size is too small to fit header or footer
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I should add an option to have avbroot recompute the (32 MiB is an arbitrary value that should work. Guessing a size that's too big is totally fine. It's only "wasting" space on the |
Beta Was this translation helpful? Give feedback.
I should add an option to have avbroot recompute the
image_size
field. In the meantime, you can make this work by changingimage_size
at the top ofavb.toml
to be ~32 MiB bigger than the size of your newraw.img
.(32 MiB is an arbitrary value that should work. Guessing a size that's too big is totally fine. It's only "wasting" space on the
super
partition, which isn't usable for anything else anyway.)