AmlogicKitchen使用

环境

# cat /etc/issue
Ubuntu 22.04.1 LTS \n \l

下载AmlogicKitchen

# git clone https://github.com/xKern/AmlogicKitchen.git
# cd AmlogicKitchen
# git submodule update --init --recursive

unpack固件

上传img

# mkdir in
# cp update-YS-A98-AP6212-11.0-20230310.img in

运行脚本

# ./unpack.sh

level 1

.....................
Amlogic Kitchen
.....................
.....................
Select level 1,2,3 or q/Q to exit: 
1
Deleting existing level1
.....................
Amlogic Kitchen
.....................
Files in input dir (*.img)
1 - update-YS-A98-AP6212-11.0-20230310
.....................
Enter a file name :
update-YS-A98-AP6212-11.0-20230310
[Msg]Image package version 0x2
[Msg]Unpack item [USB         ,              DDR] to (level1/DDR.USB) size:3158016 bytes
[Msg]Backup item [USB         ,            UBOOT] backItemId[0][USB, DDR]
[Msg]Unpack item [PARTITION   ,         _aml_dtb] to (level1/_aml_dtb.PARTITION) size:258048 bytes
[Msg]Unpack item [UBOOT       ,     aml_sdc_burn] to (level1/aml_sdc_burn.UBOOT) size:3158528 bytes
[Msg]Unpack item [ini         ,     aml_sdc_burn] to (level1/aml_sdc_burn.ini) size:602 bytes
[Msg]Unpack item [PARTITION   ,           boot_a] to (level1/boot_a.PARTITION) size:67108864 bytes
[Msg]Unpack item [PARTITION   ,       bootloader] to (level1/bootloader.PARTITION) size:3158016 bytes
[Msg]Unpack item [PARTITION   ,           dtbo_a] to (level1/dtbo_a.PARTITION) size:2097152 bytes
[Msg]Unpack item [conf        ,             keys] to (level1/keys.conf) size:11 bytes
[Msg]Unpack item [PARTITION   ,             logo] to (level1/logo.PARTITION) size:1621872 bytes
[Msg]Backup item [dtb         ,           meson1] backItemId[2][PARTITION, _aml_dtb]
[Msg]Unpack item [PARTITION   ,        odm_ext_a] to (level1/odm_ext_a.PARTITION) size:8056908 bytes
[Msg]Unpack item [PARTITION   ,            oem_a] to (level1/oem_a.PARTITION) size:33554432 bytes
[Msg]Backup item [PARTITION   ,            oem_b] backItemId[18][PARTITION, oem_a]
[Msg]Unpack item [conf        ,         platform] to (level1/platform.conf) size:28 bytes
[Msg]Unpack item [PARTITION   ,            super] to (level1/super.PARTITION) size:1407186640 bytes
[Msg]Unpack item [aml         ,         usb_flow] to (level1/usb_flow.aml) size:189024 bytes
[Msg]Unpack item [PARTITION   ,         vbmeta_a] to (level1/vbmeta_a.PARTITION) size:8192 bytes
[Msg]Unpack item [PARTITION   ,    vendor_boot_a] to (level1/vendor_boot_a.PARTITION) size:25165824 bytes
[Msg]Write config file "level1/image.cfg" OK!
Image unpack OK!
Done.
.....................
Amlogic Kitchen
.....................
.....................
# ls -l level1
总用量 1518289
-rwxrwxrwx 1 root root     258048 3月  15 15:00 _aml_dtb.PARTITION
-rwxrwxrwx 1 root root        602 3月  15 15:00 aml_sdc_burn.ini
-rwxrwxrwx 1 root root    3158528 3月  15 15:00 aml_sdc_burn.UBOOT
-rwxrwxrwx 1 root root   67108864 3月  15 15:00 boot_a.PARTITION
-rwxrwxrwx 1 root root    3158016 3月  15 15:00 bootloader.PARTITION
-rwxrwxrwx 1 root root    3158016 3月  15 15:00 DDR.USB
-rwxrwxrwx 1 root root    2097152 3月  15 15:00 dtbo_a.PARTITION
-rwxrwxrwx 1 root root       1608 3月  15 15:00 image.cfg
-rwxrwxrwx 1 root root         11 3月  15 15:00 keys.conf
-rwxrwxrwx 1 root root    1621872 3月  15 15:00 logo.PARTITION
-rwxrwxrwx 1 root root    8056908 3月  15 15:00 odm_ext_a.PARTITION
-rwxrwxrwx 1 root root   33554432 3月  15 15:00 oem_a.PARTITION
-rwxrwxrwx 1 root root         28 3月  15 15:00 platform.conf
-rwxrwxrwx 1 root root         35 3月  15 15:00 projectname.txt
-rwxrwxrwx 1 root root 1407186640 3月  15 15:00 super.PARTITION
-rwxrwxrwx 1 root root     189024 3月  15 15:00 usb_flow.aml
-rwxrwxrwx 1 root root       8192 3月  15 15:00 vbmeta_a.PARTITION
-rwxrwxrwx 1 root root   25165824 3月  15 15:00 vendor_boot_a.PARTITION

level 2

Select level 1,2,3 or q/Q to exit: 
2
Extracting odm_ext_a
.....Extraction from odm_ext_a.raw.img to odm_ext_a
.....Done! All extraction in odm_ext_a
.....Extraction from system_a.img to system_a
.....Done! All extraction in system_a
.....Extraction from system_ext_a.img to system_ext_a
.....Done! All extraction in system_ext_a
.....Extraction from vendor_a.img to vendor_a
.....Done! All extraction in vendor_a
.....Extraction from product_a.img to product_a
.....Done! All extraction in product_a
.....Extraction from odm_a.img to odm_a
.....Done! All extraction in odm_a
Done.
.....................
Amlogic Kitchen
.....................
.....................
# ls -l level2/
total 1374048
drwxr-xr-x  2 root root      4096 Mar 15 16:07 config
drwxr-xr-x  6 root root      4096 Mar 15 16:07 odm_a
-rw-r--r--  1 root root   1605632 Mar 15 16:07 odm_a.img
-rw-r--r--  1 root root         0 Mar 15 16:07 odm_b.img
drwxr-xr-x  5 root root      4096 Mar 15 16:07 odm_ext_a
drwxr-xr-x  9 root root      4096 Mar 15 16:07 product_a
-rw-r--r--  1 root root 103866368 Mar 15 16:07 product_a.img
-rw-r--r--  1 root root         0 Mar 15 16:07 product_b.img
drwxr-xr-x 23 root root      4096 Mar 15 16:07 system_a
-rw-r--r--  1 root root 813899776 Mar 15 16:07 system_a.img
-rw-r--r--  1 root root         0 Mar 15 16:07 system_b.img
drwxr-xr-x  8 root root      4096 Mar 15 16:07 system_ext_a
-rw-r--r--  1 root root 163942400 Mar 15 16:07 system_ext_a.img
-rw-r--r--  1 root root         0 Mar 15 16:07 system_ext_b.img
drwxr-xr-x 12 root root      4096 Mar 15 16:07 vendor_a
-rw-r--r--  1 root root 328515584 Mar 15 16:07 vendor_a.img
-rw-r--r--  1 root root         0 Mar 15 16:07 vendor_b.img

pack 固件

修改包名称

# echo update-YS-A98-AP6212-11.0-20230315 level1/projectname.txt

新增文件

system_a.img

# cd level2/system_a/system/app/t982prod/
# touch 1.txt

system_a_file_contexts

# echo "/system_a/system/app/t982prod/1\.txt u:object_r:system_file:s0" >> level2/config/system_a_file_contexts

system_a_fs_config

# echo "system_a/system/app/t982prod/1.txt 0 0 0644" >> level2/config/system_a_fs_config

运行脚本

# ./pack.sh

level 2

.....................
Amlogic Kitchen
.....................
.....................
Select level 1,2,3 or q/Q to exit: 
2
Creating odm_ext_a image
loaded 146 fs_config entries
Creating filesystem with parameters:
    Size: 134217728
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 0
    Label: odm_ext_a
    Blocks: 32768
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 155/8192 inodes and 2535/32768 blocks
Done.
Creating system_a image
loaded 2967 fs_config entries
Creating filesystem with parameters:
    Size: 981266432
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7488
    Inode size: 256
    Journal blocks: 0
    Label: system_a
    Blocks: 239567
    Block groups: 8
    Reserved block group size: 63
Created filesystem with 2976/59904 inodes and 225901/239567 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on level2/system_a.img to 225394 (4k) blocks.
The filesystem on level2/system_a.img is now 225394 (4k) blocks long.

Done.
Creating system_ext_a image
loaded 113 fs_config entries
Creating filesystem with parameters:
    Size: 177954816
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 5440
    Inode size: 256
    Journal blocks: 0
    Label: system_ext_a
    Blocks: 43446
    Block groups: 2
    Reserved block group size: 15
Created filesystem with 122/10880 inodes and 40947/43446 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on level2/system_ext_a.img to 40951 (4k) blocks.
The filesystem on level2/system_ext_a.img is now 40951 (4k) blocks long.

Done.
Creating vendor_a image
loaded 1121 fs_config entries
Creating filesystem with parameters:
    Size: 396664832
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8080
    Inode size: 256
    Journal blocks: 0
    Label: vendor_a
    Blocks: 96842
    Block groups: 3
    Reserved block group size: 23
Created filesystem with 1130/24240 inodes and 91240/96842 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on level2/vendor_a.img to 91251 (4k) blocks.
The filesystem on level2/vendor_a.img is now 91251 (4k) blocks long.

Done.
Creating product_a image
loaded 108 fs_config entries
Creating filesystem with parameters:
    Size: 109948928
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 6720
    Inode size: 256
    Journal blocks: 0
    Label: product_a
    Blocks: 26843
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 117/6720 inodes and 25287/26843 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on level2/product_a.img to 25290 (4k) blocks.
The filesystem on level2/product_a.img is now 25290 (4k) blocks long.

Done.
Creating odm_a image
loaded 24 fs_config entries
Creating filesystem with parameters:
    Size: 1560576
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 96
    Inode size: 256
    Journal blocks: 0
    Label: odm_a
    Blocks: 381
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 32/96 inodes and 371/381 blocks
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on level2/odm_a.img to 371 (4k) blocks.
The filesystem on level2/odm_a.img is now 371 (4k) blocks long.

Done.
lpmake I 03-15 16:52:48  1860  1860 builder.cpp:1031] [liblp]Partition system_ext_a will resize from 0 bytes to 167735296 bytes
lpmake I 03-15 16:52:48  1860  1860 builder.cpp:1031] [liblp]Partition system_a will resize from 0 bytes to 923213824 bytes
lpmake I 03-15 16:52:48  1860  1860 builder.cpp:1031] [liblp]Partition odm_a will resize from 0 bytes to 1519616 bytes
lpmake I 03-15 16:52:48  1860  1860 builder.cpp:1031] [liblp]Partition product_a will resize from 0 bytes to 103587840 bytes
lpmake I 03-15 16:52:48  1860  1860 builder.cpp:1031] [liblp]Partition vendor_a will resize from 0 bytes to 373764096 bytes
Invalid sparse file format at header magic
Invalid sparse file format at header magic
Invalid sparse file format at header magic
Invalid sparse file format at header magic
Invalid sparse file format at header magic
.....................

level 1

.....................
Amlogic Kitchen
.....................
.....................
Select level 1,2,3 or q/Q to exit: 
1
Can't find out folder
Created out folder
[Msg]Pack Item[USB         ,              DDR] from (level1/DDR.USB),sz[0x303000]B,fileType[normal]	
[Msg]Pack Item[USB         ,            UBOOT] from (level1/DDR.USB),Duplicated for DDR.USB

[Msg]Pack Item[PARTITION   ,         _aml_dtb] from (level1/_aml_dtb.PARTITION),sz[0x3f000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,         _aml_dtb] from (level1/_aml_dtb.PARTITION),vry[sha1sum 29c7f61951fa8e6686601006071997ff3bbbcf9e]	
[Msg]Pack Item[UBOOT       ,     aml_sdc_burn] from (level1/aml_sdc_burn.UBOOT),sz[0x303200]B,fileType[normal]	
[Msg]Pack Item[ini         ,     aml_sdc_burn] from (level1/aml_sdc_burn.ini),sz[0x25a]B,fileType[normal]	
[Msg]Pack Item[PARTITION   ,           boot_a] from (level1/boot_a.PARTITION),sz[0x4000000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,           boot_a] from (level1/boot_a.PARTITION),vry[sha1sum 5ec5ee9210ab13d69d7d340ee354ead43397c331]	
[Msg]Pack Item[PARTITION   ,       bootloader] from (level1/bootloader.PARTITION),sz[0x303000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,       bootloader] from (level1/bootloader.PARTITION),vry[sha1sum 1d60c16e1e4c11d4f7377a3067230715f6e73542]	
[Msg]Pack Item[PARTITION   ,           dtbo_a] from (level1/dtbo_a.PARTITION),sz[0x200000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,           dtbo_a] from (level1/dtbo_a.PARTITION),vry[sha1sum 8f8fa275d688766bd1cc7211eb580a3a939fcf24]	
[Msg]Pack Item[conf        ,             keys] from (level1/keys.conf),sz[0xb]B,fileType[normal]	
[Msg]Pack Item[PARTITION   ,             logo] from (level1/logo.PARTITION),sz[0x18bf70]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,             logo] from (level1/logo.PARTITION),vry[sha1sum 8fb2ec1405918227095c0a3d92e74ce0c80df0d8]	
[Msg]Pack Item[dtb         ,           meson1] from (level1/_aml_dtb.PARTITION),Duplicated for _aml_dtb.PARTITION

[Msg]Pack Item[PARTITION   ,        odm_ext_a] from (level1/odm_ext_a.PARTITION),sz[0x9e7748]B,fileType[sparse]	
[Msg]Pack Item[VERIFY      ,        odm_ext_a] from (level1/odm_ext_a.PARTITION),vry[sha1sum 823f5f056cee7d0d5a42631b94ff3b227d37f60f]	
[Msg]Pack Item[PARTITION   ,            oem_a] from (level1/oem_a.PARTITION),sz[0x2000000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,            oem_a] from (level1/oem_a.PARTITION),vry[sha1sum 056783fd669671c5a3397a989737d25c7bef39f2]	
[Msg]Pack Item[PARTITION   ,            oem_b] from (level1/oem_a.PARTITION),Duplicated for oem_a.PARTITION

[Msg]Pack Item[VERIFY      ,            oem_b] from (level1/oem_a.PARTITION),Duplicated for oem_a.VERIFY

[Msg]Pack Item[conf        ,         platform] from (level1/platform.conf),sz[0x1c]B,fileType[normal]	
[Msg]Pack Item[PARTITION   ,            super] from (level1/super.PARTITION),sz[0x5b6135b8]B,fileType[sparse]	
[Msg]Pack Item[VERIFY      ,            super] from (level1/super.PARTITION),vry[sha1sum 2e1505fbc0d541d0fa7e92a77c9905db9f019547]	
[Msg]Pack Item[aml         ,         usb_flow] from (level1/usb_flow.aml),sz[0x2e260]B,fileType[normal]	
[Msg]Pack Item[PARTITION   ,         vbmeta_a] from (level1/vbmeta_a.PARTITION),sz[0x2000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,         vbmeta_a] from (level1/vbmeta_a.PARTITION),vry[sha1sum 37c3e844310cdc298d38f7fa53f3e54c4a85d430]	
[Msg]Pack Item[PARTITION   ,    vendor_boot_a] from (level1/vendor_boot_a.PARTITION),sz[0x1800000]B,fileType[normal]	
[Msg]Pack Item[VERIFY      ,    vendor_boot_a] from (level1/vendor_boot_a.PARTITION),vry[sha1sum 0dc1d5b8fdf630eb92e50c843072ab2bfb0cad7e]	
[Msg]version:0x2 crc:0x15a32916 size:1682979060 bytes[1605MB]
Pack image[out/update-YS-A98-AP6212-11.0-20230315.img] OK
Done.
.....................
Amlogic Kitchen
.....................
.....................

out

# ls -l out
total 1643540
-rw-r--r-- 1 root root 1682979060 Mar 15 16:54 update-YS-A98-AP6212-11.0-20230315.img

参考文档

https://github.com/xKern/AmlogicKitchen

posted @ 2023-03-15 17:50  小吉猫  阅读(829)  评论(0编辑  收藏  举报