GithubHelp home page GithubHelp logo

natinusala / linux-amlogic-toolkit Goto Github PK

View Code? Open in Web Editor NEW
170.0 10.0 63.0 3.83 MB

Allows to unpack and repack AMLogic images for Android 7 without the Customization Tool

Shell 19.19% Makefile 2.36% C 73.57% Python 4.02% Roff 0.86%

linux-amlogic-toolkit's Introduction

Linux AMLogic Toolkit

Allows to unpack and repack AMLogic Android images on Linux systems without using the Customization Tool - works for Android 7.

Features

  • Unpack and repack any image
  • Mount and edit system partition
  • Unpack and repack logo partition (for bootup and upgrading logos)
  • Unpack and repack boot image and initrd ramdisk
  • Flash the image directly to a device without repacking it (faster than using the USB Burning Tool)
  • Works for Android 7
  • No need to unpack the image each time you want to use the tool

What it cannot do (yet)

  • Edit other partitions of the image such as recovery (you can still replace the PARTITION files by hand)

Dependencies

  • zlib1g-dev for simg2img and img2simg
  • libblkid-dev for abootimg (unpacking and repacking boot image)
  • the i386 packages if needed (for the logo unpacking / repacking binary)

How to use it

  • Clone or download this repository
  • Install the dependencies
  • Move to the directory of the repository, and stay there
  • (first time, or after a cleanup) Run ./bin/build to build the required tools
  • (when editing a new image file) Run ./bin/unpack input.img to unpack input.img
  • The result is :
    • output/image : raw image files (PARTITION files)
    • output/system : system partition files
    • output/logo : logo partition files
    • output/boot : boot partition files
  • From now on you can edit the files of the output directory
    • Note that those files will be overwritten when repacking :
      • output/image/system.PARTITION
      • output/image/boot.PARTITION
      • output/image/logo.PARTITION
      • output/boot/initrd.img if using ./bin/extract_initrd
    • If you happen to loose the output/system mounting point (after a reboot for instance), just run ./bin/remount to mount it again
    • On the other hand, you can unmount the system partition using ./bin/unmount
    • If you want to extract the initrd ramdisk, use the ./bin/extract_initrd and ./bin/recreate_initrd scripts (output in output/initrd)
  • Be careful :
    • Don't break everything by chmod'ing the whole output/system folder, because it will be replicated in the image and it won't boot !
    • Don't rename the files in output/boot.img
    • If you extract and recreate the initrd ramdisk, its size will change and it will most likely break the boot image. To fix this, edit the bootimg.cfg file in output/boot to replicate the change in size (you can repack the image, let it fail and read the logs to see the new size).
  • When you have finished editing the files, run ./bin/repack output.img to repack the image to output.img
  • Additionnaly, you can use ./bin/flash to flash the image to a device through USB (you will need the udev rule, see https://github.com/Stane1983/aml-linux-usb-burn)
    • The device type (gxl) is hardcoded into the flashing script, edit it if you're not using S905, S905X or S919
  • Done !

Troubleshooting

Credits

linux-amlogic-toolkit's People

Contributors

natinusala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linux-amlogic-toolkit's Issues

关于部署失败的问题在虚拟机中

pifu@pifu-Virtual-Machine:~/linux-amlogic-toolkit$ ./bin/build
umount: output/system: not mounted
make: Entering directory '/home/pifu/linux-amlogic-toolkit/bin/src/simg2img'
rm -f -f *.o *.a simg2img simg2simg img2simg append2simg .depend
make: Leaving directory '/home/pifu/linux-amlogic-toolkit/bin/src/simg2img'
Cleanup done
make: Entering directory '/home/pifu/linux-amlogic-toolkit/bin/src/simg2img'
cc -c -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -Iinclude backed_block.c -o backed_block.o
cc -c -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -Iinclude output_file.c -o output_file.o
output_file.c:30:18: fatal error: zlib.h: 没有那个文件或目录
compilation terminated.
Makefile:95: recipe for target 'output_file.o' failed
make: *** [output_file.o] Error 1
make: Leaving directory '/home/pifu/linux-amlogic-toolkit/bin/src/simg2img'
cp: 无法获取'bin/src/simg2img/simg2img' 的文件状态(stat): 没有那个文件或目录
cp: 无法获取'bin/src/simg2img/img2simg' 的文件状态(stat): 没有那个文件或目录
Build done

zlib.h 是不是被修改了或者精简了,麻烦开发者看看感激!

edited system partition stays same

When I am repacking rom with edited system partition it packs the original system partition.

I get "./bin/repack: line 9: bin/recreate: Permission denied" when repacking. I also get permission denied when I try "./bin/flash".

I solved it. The problem was that flash.sh and recreate.sh had unchecked "is executable".

Can not extract initrd.img by using extract_initrd

$./bin/extract_initrd initrd.img
Extracting initrd ramdisk...

gzip: stdin: not in gzip format
$ file boot/initrd.img 
boot/initrd.img: data

And it's not xz compressed, not ext2/ext4 image

phicomm N1 S905D soc.

bin/logo_img_packer?!

Image unpack OK!
Converting system.PARTITION to system.img...
Mounting system image...
Unpacking logo...
./bin/unpack: line 27: bin/logo_img_packer: There is no file or directory
Unpacking boot...
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
extracting second stage image in stage2.img
Done

thanks fixed

Can some one help?

Unpacking image /home/sam/Desktop/input.img...
[Msg]Image package version 0x2
[Msg]Unpack item [USB , DDR] to (output/image/DDR.USB) size:49152 bytes
[Msg]Unpack item [USB , UBOOT] to (output/image/UBOOT.USB) size:704512 bytes
[Msg]Unpack item [PARTITION , _aml_dtb] to (output/image/_aml_dtb.PARTITION) size:40962 bytes
[Msg]Unpack item [UBOOT , aml_sdc_burn] to (output/image/aml_sdc_burn.UBOOT) size:754176 bytes
[Msg]Unpack item [ini , aml_sdc_burn] to (output/image/aml_sdc_burn.ini) size:602 bytes
[Msg]Unpack item [PARTITION , boot] to (output/image/boot.PARTITION) size:8437760 bytes
[Msg]Unpack item [PARTITION , bootloader] to (output/image/bootloader.PARTITION) size:753664 bytes
[Msg]Unpack item [PARTITION , logo] to (output/image/logo.PARTITION) size:1333440 bytes
[Msg]Unpack item [xml , manifest] to (output/image/manifest.xml) size:75817 bytes
[Msg]Backup item [dtb , meson1] backItemId[2][PARTITION, _aml_dtb]
[Msg]Unpack item [conf , platform] to (output/image/platform.conf) size:202 bytes
[Msg]Unpack item [PARTITION , recovery] to (output/image/recovery.PARTITION) size:12486656 bytes
[Msg]Unpack item [PARTITION , system] to (output/image/system.PARTITION) size:1365420424 bytes
[Msg]Write config file "output/image/image.cfg" OK!
Image unpack OK!
Converting system.PARTITION to system.img...
Mounting system image...
Unpacking logo...
bin/logo_img_packer: 1: bin/logo_img_packer: Syntax error: "(" unexpected
Done

Flash repacked rom

Good Day

I have a MXQ Pro S905x
I managed to complete all the steps to build my own rom and repack the image in Ubuntu 18.04 however have a issue flashing it. I'm using the USB Burning Tool 2.1.7.0 in Windows 10. I get the following error from the USB Burning Tool.

[10:48:03 686][HUB1-4][Inf]-------------Download system.PARTITION-----------
[10:48:03 687][HUB1-4][Inf]--0-7-0-16
[10:48:03 687][HUB1-4][Inf]--download store system sparse 1724405900
[10:48:03 687][HUB1-4][Inf]--Send download command success
[10:48:03 705][HUB1-4][Inf]--Read command status success
[10:52:11 842]Write Media read Continue:32,will sleep 3s
[10:52:27 932]Write Media read Continue:32,will sleep 3s
[10:52:43 988]Write Media read Continue:32,will sleep 3s
[10:53:00 073]Write Media read Continue:32,will sleep 3s
[10:53:03 074]UsbRomDll Return buffer=Continue:32
[10:53:06 459][HUB1-4][Inf]--Transfer complete
[10:53:06 460][HUB1-4][Inf]--Send download get_status command succeed
[10:55:36 460][HUB1-4][Err]--usb_reap_async_nocancel Try 2 time! usbReadFile len=512, ret=-116 error_msg=libusb0-dll:err [_usb_reap_async] reaping request failed, win error: The I/O operation has been aborted because of either a thread exit or an application request.

[10:55:36 465][HUB1-4][Err]--[0x30404002]UBOOT/Partition system/Get download status/USB Control setup error
[10:55:36 465][HUB1-4][Inf]--Close device handle 0x000005a0

I suspect that I have to edit a pointer that indicates the new system.img partition size inside the bootloader or something within the package file that indicates the size of the new partitions.

How do I correct the new size within the bootloader step by step or if I missed something what could it be?

Johann

output folder locked

I am using this toolkit on ubuntu 18.04 lts in vmware on windows 10 64 bit. I have allready installed the toolkit and the dependencies succesfully, and also i have unpacked the stock firmware for x96 tv box amlogic s905w with android 7 everything ok! but the problem is that the system is locked, the whole output folder is locked!! I can not change anything i want!! do you have any idea?? also i try to change permission on this folder but nothing!! thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.