Announcement

Collapse
No announcement yet.

linux-amlogic-toolkit - unpack and repack AMLogic images using Linux (works with Android 7 !)

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

    linux-amlogic-toolkit - unpack and repack AMLogic images using Linux (works with Android 7 !)

    I wanted to unpack and repack Android 7 images for a project I'm working on, so with the help of Magendanz and adg I came up with this little toolkit for Linux : https://github.com/natinusala/linux-amlogic-toolkit

    It allows you to :
    • Unpack and repack any Android image
    • Automatically mounts the system partition to edit the files
    • Unpack and repack logo partition
    • Works with Android 7 !
    It's easy to use, just clone the repository and use the scripts provided to unpack the image. Make your changes, and use the other script to repack the image. Everything needed is in the README. Just be careful not to break everything by chmod'ing the system folder, because your chmod will be replicated in the image and it won't boot !

    #2
    Originally posted by natinusala View Post
    I wanted to unpack and repack Android 7 images for a project I'm working on, so with the help of Magendanz and adg I came up with this little toolkit for Linux : https://github.com/natinusala/linux-amlogic-toolkit

    It allows you to :
    • Unpack and repack any Android image
    • Automatically mounts the system partition to edit the files
    • Unpack and repack logo partition
    • Works with Android 7 !
    It's easy to use, just clone the repository and use the scripts provided to unpack the image. Make your changes, and use the other script to repack the image. Everything needed is in the README. Just be careful not to break everything by chmod'ing the system folder, because your chmod will be replicated in the image and it won't boot !
    Thanks for the nice tool since the customization tool is getting more and more broken in Android 7.

    Must I run the tool as root or can it be run in user mode ?

    Is there a replacement for the sdcard maker tool in linux ? This is allow me to test the modded firmware on the sdcard without switching to windows.

    This might be relevant :-

    https://www.cnx-software.com/2016/11...ogic-tv-boxes/
    Last edited by mxqpro; 02-18-2018, 00:50.

    Comment


      #3
      The tool uses sudo when necessary (mount and umount).

      I thought of including the method you linked as a script (./bin/burn-to-sdcard) but it requires to know the /dev/sdX path of the target device and its mouting point. I found it to be a pain to unmount, dd then remount automatically, so I didn't bother doing it. On the other hand, nothing prevents you from just replacing the image file once the SD card has been made bootable - burn it once on Windows and then just repack the new image by overwriting the old one. The ini file allows you to change its name and burn settings.

      Comment


        #4
        Nice.

        I shall definitely have a look at this.
        MXIII-G II, Chuwi Hibox, Nvidia Shield, NUC6CAYH

        Comment


          #5
          Seems like your tool doesn't like modifications made to 'bootvideo' in /system/etc/.
          When I replaced this file, it didn't manage to compile 'system' at all.
          It compiles the .img just fine, however, when unpacked, system is empty.
          Any ideas? natinusala

          Thanks for redirecting me from the incorrect thread

          Comment


            #6
            I never had any issue when editing a specific file. I've added files to /etc, /system/priv-apps, /system/apps, changed the boot animations, keyboard layouts, never had any problem.

            Would you mind sending the logs of the repack and unpack commands ?

            Comment


              #7
              Originally posted by natinusala View Post
              I never had any issue when editing a specific file. I've added files to /etc, /system/priv-apps, /system/apps, changed the boot animations, keyboard layouts, never had any problem.

              Would you mind sending the logs of the repack and unpack commands ?
              You're right.
              Very interesting. I used "Customization Tool" to unpack the file, just to verify that it showed my boot logo correctly and it did.
              However it was unable to unpack "system", I guess that bug goes with Customization Tool then, nothing wrong with your tool since it could unpack system without any issues

              By the way, might be a bit off-topic, but when changing the default boot-logo, does that one have to be replaced somewhere else as well?
              Because, on the first initial boot, it shows me the boot-logo that I set, however, after a reboot, it goes back to showing the original boot-logo again.
              Do I have to change it somewhere else other than in /logo/? Scoured the web, but couldn't find an answer to that one.

              Comment


                #8
                There are two different things called logos with Amlogic devices :

                - The logo partition is composed of multiple BMP files (one for booting, multiple for upgrading, the boot logo is called "bootup"). It's what's shown by the bootloader when booting the device, before Android starts
                - The Android Boot Animation which is located somewhere in the media directory of the system partition, it's a ZIP containing a sequence of PNG images to make an animation - you can add sound or replace it with a video

                When "upgrading" a device from a bootable SD card it's the device's current boot and upgrading logos which will be shown. When rebooting, the logo partition is updated and the image's logo will be shown.

                Which one are you talking about ?

                Comment


                  #9
                  Originally posted by natinusala View Post
                  There are two different things called logos with Amlogic devices :

                  - The logo partition is composed of multiple BMP files (one for booting, multiple for upgrading, the boot logo is called "bootup"). It's what's shown by the bootloader when booting the device, before Android starts
                  - The Android Boot Animation which is located somewhere in the media directory of the system partition, it's a ZIP containing a sequence of PNG images to make an animation - you can add sound or replace it with a video

                  When "upgrading" a device from a bootable SD card it's the device's current boot and upgrading logos which will be shown. When rebooting, the logo partition is updated and the image's logo will be shown.

                  Which one are you talking about ?
                  I'm talking about the logo that's called "bootup".
                  When I reflash my Android device, on the first bootup after installation, it shows me the new bootup logo, but after a restart of the android device, it shows me the old one again.
                  I read somewhere, that the bootloader.PARTITION also contained bootup logos, is that correct? I've never fiddled with a bootloader before.
                  The flashing happens through the USB-burn tool, so I'm not doing that via an SD card, great info to know though

                  Thanks a lot for being so informative, really appreciate it!

                  Comment


                    #10
                    I don't have this issue on my device so I'm afraid I can't help you with that...

                    Comment


                      #11
                      Originally posted by natinusala View Post
                      I don't have this issue on my device so I'm afraid I can't help you with that...
                      No problem at all
                      By the way, would it possible for you to add the function to be able to modify the initrd image in your tool?
                      I need to edit the init.amlogic.rc and thought I'd ask. Thanks yet again for an awesome tool

                      Comment


                        #12
                        It is already in the tool, just use the extract_initrd and recreate_initrd scripts ! It will change the boot image size so you'll have to reflect this change in the bootimg.cfg file.

                        Comment


                          #13
                          Originally posted by natinusala View Post
                          It is already in the tool, just use the extract_initrd and recreate_initrd scripts ! It will change the boot image size so you'll have to reflect this change in the bootimg.cfg file.
                          Completely missed that. Awesome. Thanks!

                          Comment


                            #14
                            natinusala I've noticed issues with your tool when the size becomes to big. Anything you've noticed?
                            Whenever I manage image-files above 1.5gb, every time it repacks, it magically becomes larger even though no changes have been made to it.
                            If I do this with files below 1gb, this problem doesn't occur.

                            Comment


                              #15
                              Is it causing problems when flashing ? I use it to edit 2gb image files and I didn't notice any issue

                              Comment

                              Working...
                              X