[Android Software Development] RiskyINNIT:
Hello, I have a Samsung Galaxy A21s (SM-A217F) running Android 12 stock with an unlocked boot loader. I pulled my boot img from the phone and tried unpacking/repacking it with a number of different tools on both windows and linux, such as Android Image kitchen, mkbootimg and CarlivImageKitchen. But each time i unpack the contents of the boot img and re pack the image, the file size changes from 36MB to 32MB. Then when i try to install this new image (32MB) i get a boot loop, I assume because it is missing some data in the boot img. The boot img that i tried unpacking/repacking had 0 modifications to it.

Here is the log for unpacking, using the Android-Image-Kitchen for Windows:

#################################################################

Android Image Kitchen - UnpackImg Script

by osm0sis @ xda-developers

Supplied image: boot.img

Setting up work folders . . .

Image type: AOSP

Signature with "AVBv2" type detected.

Splitting image to "split_img/" . . .

ANDROID! magic found at: 0

BOARD_KERNEL_CMDLINE androidboot.hardware=exynos850 androidboot.selinux=enforce loop.max_part=7

BOARD_KERNEL_BASE 0x10000000

BOARD_NAME SRPTA21C008

BOARD_PAGE_SIZE 2048

BOARD_HASH_TYPE sha1

BOARD_KERNEL_OFFSET 0x00008000

BOARD_RAMDISK_OFFSET 0x01000000

BOARD_SECOND_OFFSET 0xf0000000

BOARD_TAGS_OFFSET 0x00000100

BOARD_OS_VERSION 12.0.0

BOARD_OS_PATCH_LEVEL 2023-03

BOARD_HEADER_VERSION 2

BOARD_HEADER_SIZE 1660

BOARD_DTB_SIZE 127904

BOARD_DTB_OFFSET 0x00000000

Unpacking ramdisk to "ramdisk/" . . .

Compression used: gzip

6333 blocks

Done!

Press any key to continue . . .

#################################################################

Here is the log for repacking:

#################################################################

Packing ramdisk . . .

Using compression: gzip

Getting build information . . .

kernel = boot.img-kernel

dtb = boot.img-dtb

cmdline = androidboot.hardware=exynos850 androidboot.selinux=enforce loop.max_part=7

board = SRPTA21C008

base = 0x10000000

pagesize = 2048

kernel_offset = 0x00008000

ramdisk_offset = 0x01000000

second_offset = 0xf0000000

tags_offset = 0x00000100

dtb_offset = 0x00000000

os_version = 12.0.0

os_patch_level = 2023-03

header_version = 2

hashtype = sha1

Building image . . .

Using format: AOSP

Done!

Press any key to continue . . .

###################################

Here is the stock boot.img - https://github.com/RiskyGUY22/SM-A217F-Boot

More info about the device:

- arm64

- exynos 850 processor

- made in 2020

Any help or information on this would be greatly appreciated :D

Edit:

- When i try unpacking/repacking the new-boot.img that is created from the original boot.img, the file size stays the same but the output is slightly different, since no signature gets detected:

Image type: AOSP

Splitting image to "split_img/" . . .

ANDROID! magic found at: 0

BOARD_KERNEL_CMDLINE androidboot.hardware=exynos850 androidboot.selinux=enforce loop.max_part=7

BOARD_KERNEL_BASE 0x10000000

BOARD_NAME SRPTA21C008

BOARD_PAGE_SIZE 2048

BOARD_HASH_TYPE sha1

BOARD_KERNEL_OFFSET 0x00008000

BOARD_RAMDISK_OFFSET 0x01000000

BOARD_SECOND_OFFSET 0xf0000000

BOARD_TAGS_OFFSET 0x00000100

BOARD_OS_VERSION 12.0.0

BOARD_OS_PATCH_LEVEL 2023-03

BOARD_HEADER_VERSION 2

BOARD_HEADER_SIZE 1660

BOARD_DTB_SIZE 127904

BOARD_DTB_OFFSET 0x00000000

Unpacking ramdisk to "ramdisk/" . . .

Compression used: gzip

6334 blocks

Done!

Press any key to continue . . .